Read and play with Graph in one article
Editor's Note: This article comes fromGolden Finance, reprinted by Odaily with authorization.
Editor's Note: This article comes from
Golden Finance
Golden Finance
, reprinted by Odaily with authorization.
first level title
What are APIs? Why are APIs important?
An API, or "Application Programming Interface," is a set of instructions and standards by which interaction occurs between an application or web tool and the applications that use its assets. Without an API, each application would need to build its own interface. At the end of the day, APIs allow developers to save time and reduce the amount of code they create.
Why does the Web3 stack need indexing protocols and standards?
There is a huge amount of raw data on Ethereum. This data needs to be stored in a format that can be easily and efficiently queried. This is essential for a fast loading web application and a good user experience. Graph makes querying blockchain data reliable, safe, and fast because subgraphs sort and index specific data to be used by applications. Graph is the indexing standard of the web3 stack!
How Graph Fits into the Crypto Ecosystem
With the popularity of open public networks like Ethereum and DeFi, Graph lays the foundation for all crypto applications using open data. The picture below is an example of an AMM that many people like.
GRT Token
info.uniswap.org This is an analytics tool for Uniswap dApps
Uniswap subgraphs query data directly from Uniswap smart contracts. Graph indexes useful data sets, allowing the creation of graphs, such as the visualization of token transaction data on Uniswap.
Dismantling Graph
Now that we have a basic understanding of Graph and its role in the Web3 stack, let's disassemble the components and network participants in the Graph protocol.
GRT Token
GRT is the native token of the protocol. This is a work token used to allocate resources in the network, including providing indexing, management and delegation services. All of the above participants can earn income from the network proportional to the amount of work done and the GRT staked.
Consumers need to pay indexers (indexes) in GRT. Tokens align incentives and economic security across all participants within the network, rewarding healthy participants and punishing malicious behavior.
Indexer indexes
Indexers are node operators of the protocol. They run the physical infrastructure needed to handle indexing and querying services. Indexers must stake GRT to earn query fees and inflation rewards. Indexers are compensated the most among all participants and can use their own pricing models and strategies to create marketplaces.
CuratorGateThe leader pledges GRT to the subgraph. Their votes generate market signals about which subgraphs are valuable, helping indexers allocate resources. As a result, the leader will receive a portion of the indexer rewards and fees.
Delegators
Delegators stake GRT with indexers to earn a portion of rewards and fees. This allows token holders to passively participate in network security and Sybil attacks.
Consumers
Consumers of subgraphs (mainly Ethereum DeFi applications) need to access data on the Graph without performing the work of computing and storing that data. They leverage Graph to query data safely and efficiently. Fees can be determined by the gateway (
ways, in progress) or a query engine (which can be an extension or embedded in a dApp) to decide which indexers to use from the fee market.
Consumers query indexers and pay based on usage meters. This creates a supply and demand model that supports the protocol.
Visualized Network Value Stream
How to earn income through Graph
There are three main ways to contribute to the Graph network and earn GRT. Below we list them from easiest (least technical) to hardest (most technical).
The Graph network has just launched its mainnet. Currently, only a handful of subgraphs have migrated from escrow services to the mainnet. Query fees are still low, but will grow as more and more subgraphs are migrated to the mainnet.
Earn income through principals
Skills: Easy (no technical skills required)
Risk: Low - principal will not be penalized
ROI: Positive, but depends on indexer performance
Any individual with GRT can contribute to network security without running a graph node. This is the easiest way to participate in the Graph, which makes your GRT useful. Nor does the principal need the higher technical knowledge that comes with the "Guidelines" or "Indexes". The delegator entrusts his GRT to the existing indexer and earns a part of the indexer's reward and fee.
You can delegate GRT to indexers by:
1. First make sure that Metamask is set to "Ethereum Mainnet" and there is enough ETH to cover all transaction fees.
2. Add GRT tokens to Metamask
Token contract address: 0xc944e90c64b2c07662a292be6244bdf05cda44a7
Token symbol: GRT
Decimal places: 18gate3. Go to Graph's Network Site and connect your wallet. In this tutorial, we will use Metamask as a browser wallet
Delegated GRT tokens can only be withdrawn after the indexer unfreeze period of 28 days. Settlers are also required to post a 0.5% deposit to incentivize long-term commitment.
4. Scroll down to view active indexers.
As mentioned earlier, indexers earn GRT network inflation and query fees. "Fee Cut %" is the percentage of query fees that the indexer will keep, and "Rewards Cut %" is the inflation rewards that will be kept.
"Stake Owned" is the amount of GRT pledged by the indexer, "Stake Delegated" is the amount of GRT that other delegators have delegated to the indexer. You can also see the "remining capacity", which is the amount of GRT that can be placed in the hands of the node operator without requiring the indexer to put more amount .
"Revenue Query Fees" are the query fees earned so far by this indexer, while "Revenue Indexer Rewards" are the amount of GRT inflation rewards earned so far.
There are a few variables that delegators should highlight when choosing which indexers to delegate to.
For example, an indexer who shares a smaller share of rewards with delegators but is less risky to delegate may be more profitable than a competitor who shares more rewards, since you may gain more rewards shared with fewer delegators. Large percentage of delegator rewards.
With an indexer selected, click the icon on the far right of the row. Set the pop-up option to "Dele
" or "Undelegate"
5. Click on the delegate (Delegate), another window will appear. It will show you the Rewards Cut along with the cooldown and remaining delegation balance. If all goes well, you can enter the GRT balance you wish to delegate, and then you can submit the transaction.
6. Click Submit Transaction. This will open your Metamask. If this is your first time using Graph, you must approve the contract on Metamask. The transaction can be confirmed after completion.
Wait a few minutes for on-chain confirmations to complete. You are now a client of The Graph and passively earn GRT based on the performance of indexers.
If you click on the address in the upper right corner of the Network Beta dApp, you can manage and find your delegation status.
Earn income as a guide
Skills: Intermediate (semi-technical)
Risk: Moderate, staking poor subgraphs may result in negative returns
Return on Investment (ROI): Subgraph share tokens will be minted and burned on the Bonding Curve as market demand dictates, and the ROI will vary accordingly. For a given subgraph, the leader will earn 10% of the query fee, which is proportional to the staked GRT.
The role of the indexer in the network is to evaluate subgraphs and signal to the indexer which APIs should have resources dedicated to them.
Leaders can stake GRT in any number of subgraphs they choose. When staking GRT, the leader will deposit GRT into the Bonding Curve and mint share tokens in return. These tokens can be used to redeem GRT from the curve (by burning shared tokens) at any point in the future. In short, a guide essentially locks up GRT in exchange for a guide reward, which is a portion of future query fees.
The decentralized explorer is expected to be released in Q1 2021, and currently, you can use the hosting service to explore the current "built/released" subgraph that has not yet migrated to mainnet.
Side Quest: Getting Started with Bonding Curves
The Bonding Curve creates a continuous token model in which the purchase and sale of tokens are handled by smart contracts without intermediaries facilitating transactions. Tokens will be exchanged for the parent currency held by the smart contract.
Below is an example of Bancor's Bonding Curve.
Bancor Bonding Curve
The Y-axis above represents the share token price, while the X-axis represents the number of share tokens produced by the curve. The area under the curve is the reserve (liquidity pool) from which any depositor can withdraw more or less of their deposit. It all depends on the supply and demand of the curve at the time of redemption.
How does this apply to Graph
When acting as a leader, you deposit funds into the reserve of a specific subgraph. This way, you will mint shares of tokens for that subgraph along the bonding curve.
In the example above, the orange area would be the deposit amount required to go from the "current price" to the "new price", and the amount of share tokens minted to depositors would be the difference between the current share and the new share.
The goal of the leader is to attract liquidity by depositing subgraphs that are or suspect to have a lot of query demand. If the subgraph's liquidity is reduced due to lack of demand (leaders are withdrawing their shares), some GRT may be lost when redeemed.
The earlier you stake on the subgraph, the larger (more stakers) you can earn as a share of query fees for a given amount of GRT reserved into the contract.
A "guidance tax" could be implemented in the future, which would make certain types of economic attacks unprofitable and eliminate poor decisions that could compromise network integrity.Discordsubgraph selectionguide。
Anyone can create a subgraph, so there will be duplicates with more or less the same functionality. Some may have bugs, some may not work properly, or some may be optimized for certain datasets. Guiders should carefully consider the choice of subgraphs where there are real economic risks (and rewards). Evaluation metrics like the following can help you: Completeness, Accuracy, Complexity.
The first thing to look at is the submap page on the explorer, you should find a Github link to find the code repository to dig into the code. You can also test query data, and in some cases default query examples are provided, or you may need to write your own.
guide community (
) has more and more resources and more collaborations on this, where you can find information on what to look for in subgraph evaluation
guide
Earn as an indexer
Skills: Advanced (Technical)Risks: High knowledge of server operation/maintenance, downtime and incorrect data will result in partial share penaltiesROI: High, indexers get the majority of network revenue, indexers with personalized pricing models compete for the market
Token issuance is currently 3% per annum. The future GRT monetary policy will be formulated by the Graph Council.EthereumIf you are interested in running Graph nodes,
The Github repository can be found here
and more information on operational requirements.
Note that this is very computationally expensive. Archive nodes are required to index data on Ethereum as well as other chains (for example, if you are indexing data on the Ethereum Ropsten Testnet, then you need a Ropsten Ethereum Node). many
Nodes run in a load-balanced fashion, and a single Ethereum node may limit the number of subgraphs you can index due to the required I/O throughput.
final thoughts
Additionally, indexer agents programmatically monitor their resource usage, set prices, and determine which subgraphs to index. Operating nodes can decide their own pricing models and strategies to gain a competitive advantage in the market.
The query fee is collected in the rebate pool, which can be claimed in the future according to the rebate reward function. Indexers are incentivized to stake proportionally to the query fees they earn, signaling the economic security behind the queries they serve, while consumers see that indexer's ability to satisfy their needs.
Indexers also have delegation power, which is the ratio at which an indexer has stake, and can be penalized if an indexer is malicious and feeds incorrect data to the application or indexes incorrectly, which makes inactive token holdings Participants can participate without risk of being punished.
With less trust relationship between delegators and indexers, they will focus on indexers on on-chain activities such as uptime or fees incurred to encourage decentralization.https://newsletter.banklesshq.com/p/how-to-make-bank-with-the-graph


