Query And Indexing Smart Contracts Made Easier | GRT(The Graph)

0 14
Avatar for LJCrypto
3 years ago

GRT:

For years in blockchain technology, developers have had to query information about their smart contracts manually. However, there is data that might be very hard and complex to query. Well, last December, GRT(The Graph), was launched to try and solve this problem. GRT is considered the google of the blockchain, which queries(ask) data from smart contracts. 

 

 

 

What makes Querying and Indexing Data in the Blockchain So Hard:

If we use an Example of an NFT. When looking at an NFT’s smart contract(blockchain code), it’s pretty easy to find the owner of that specific NFT by searching up the public address. However, when it comes to searching up the characteristics of that particular NFT, things get much more complicated. You would have to process every single data that’s happened with that NFT in terms of transferring from different addresses, read the data from an IPFS(Interplanetary File System), and aggregate it. This can take days to finally get the information you’re looking for. There’s also the option of building your own server, but it is very hard to manage that. This really shows how slow the blockchain is, despite it being very secure, permissionless, and transparent.



The Solution That GRT Brings:

When using GRT’s protocol, you can create APIs called subgraphs,where you input all of the data that you want to be queried. An API stands for Application Programming Interface, which is sort of like a third-party source where you can grab and receive information from an outside source that is not from your primary source. The subgraph APIs are then queried using GraphQL.

 

How GRT Works:



  • A dApp adds data to the ETH blockchain through a transaction on a smart contract

  • The smart contract logs a couple of events through a transaction.

  • GRT Node will search for new blocks of data for your subgraph.

  • GRT Node finds ETH events for your subgraph and runs mapping handles(WASM module). This creates or updates the data entities GRT stores.

  • The dApp queries the Graph Node for data indexed from the blockchain, using GraphQL.

 

There are Four Roles That Help To Maintain and Grow The GRT Ecosystem:

 

Developer - Developers will create subgraphs for their dApps, which will help to query that data and will be written on the Ethereum blockchain. You will have to check out the GRT website to get full details on how to deploy a subgraph(link will be at the bottom of this article).

Indexer - Node operators on the GRT protocol stake GRT tokens(ERC-20) to provide indexing and query services. Indexers earn rewards through query fees and indexing rewards. Also through a rebate pool. Indexers can lose their role in the protocol if there is any malicious behavior if they’re doing their job wrong altogether. Indexers choose subgraphs based on Curators curation signal. 

 

queryFeeCut - The percent of query fee rebates accumulated on a subgraph that will be distributed to the indexer. 

 

indexingRewardCut - The percent of indexing rewards earned on a subgraph that goes to the indexer.

 

Delegator - This is an investor in the GRT protocol who can earn GRT rewards under an Indexer. There is a system installed in delegation that will prevent those from harming and spamming the network:

 

Delegation Fee - This is a 0.5% charge when you delegate to an indexer. If you delegate 1000 GRT, 5 of that gets burned.

 

Delegation Unbonding Period - When you undelegate(unstake) you have to wait 28 days to transfer your GRT funds.

 

How To Choose The Best Indexer to Earn The Most Rewards As A Delegator:

 

Indexing Reward Cut - This is the portion of the rewards the Indexer will obtain. If the reward cut is 100%, the Indexer will get 100% of it and the Delegator will get 0%. If the reward cut was 10%, the Indexer will get 10% of the rewards and the Delegator will get 90% the rewards.

 

Query Fee Cut - This works exactly like the Indexing Reward Cut. If it’s 95%, then the Indexer will get 95% of the rewards while the Delegator only gets 5% of the rewards.

 

Indexer Delegation Pool - This will be your pool share. The more GRT the Delegator has compared to everyone else, the bigger their rewards are.

 

Delegation Capacity - This is the capacity of the amount of GRT an Indexer can contribute to the pool. The Delegation Ratio right now is 16, so if an Indexer stakes 1,000,000 GRT, their max is 16,000,000. GRT delegated over this maximum amount will decrease the Delegator rewards.

 

These Are Formulas to Consider in terms of Indexing Rewards and your position in an Indexing Pool.

Curator - These groups of people assess and signal on the subgraphs that should be indexed by GRT. Curators earn rewards through signaling good quality subgraphs and signal subgraphs as early as possible. Curators can signal a specific version of a subgraph or auto-migrate. Subgraphs are permissionless, meaning anybody can create a subgraph, so a Curator has to be careful on what subgraphs they signal.

 

Signaling - This is choosing the right subgraphs to be indexed and implemented on the GRT network. A subgraph has to be indexed before a consumer can query it.

 

GRT solves a significant problem in the crypto ecosystem and it will continue to grow from here.

 

 


1
$ 0.00
Avatar for LJCrypto
3 years ago

Comments