The Graph 백서

The Graph

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 18쪽 중 4쪽

m source: 1 graph indexer actions get all 2 3 graph indexer actions get --status queued 4 5 graph indexer actions queue allocate QmeqJ6hsdyk9dVbo1tvRgAxWrVS3rkERiEMsxzPShKLco6 5000 6 7 graph indexer actions queue reallocate QmeqJ6hsdyk9dVbo1tvRgAxWrVS3rkERiEMsxzPShKLco6 0x4a58d33e27d3acbaecc92c15101fbc82f47c2ae5 55000 8 9 graph indexer actions queue unallocate QmeqJ6hsdyk9dVbo1tvRgAxWrVS3rkERiEMsxzPShKLco6 0x4a58d33e27d3acbaecc92c15101fbc82f47c2ae 10 11 graph indexer actions cancel 12 13 graph indexer actions approve 1 3 5 14 15 graph indexer actions execute approve Note that supported action types for allocation management have different input requirements: Allocate - allocate stake to a specific Subgraph deployment required action params: deploymentID amount Unallocate - close allocation, freeing up the stake to reallocate elsewhere required action params: allocationID deploymentID optional action params: poi force (forces using the provided POI even if it doesn’t match what the graph-node provides) Reallocate - atomically close allocation and open a fresh allocation for the same Subgraph deployment required action params: allocationID deploymentID amount optional action params: poi force (forces using the provided POI even if it doesn’t match what the graph-node provides) Cost models Cost models provide dynamic pricing for queries based on market and query attributes. The Indexer Service shares a cost model with the gateways for each Subgraph for which they intend to respond to queries. The gateways, in turn, use the cost model to make Indexer selection decisions per query and to negotiate payment with chosen Indexers. Interacting with the network Stake in the protocol The first steps to participating in the network as an Indexer are to approve the protocol, stake funds, and (optionally) set up an operator address for day-to-day protocol interactions. Note: For the purposes of these instructions Remix will be used for contract interaction, but feel free to use your tool of choice ( OneClickDapp ⁠ , ABItopic ⁠ , and MyCrypto ⁠ are a few other known tools). Once an Indexer has staked GRT in the protocol, the Indexer components can be started up and begin their interactions with the network. Approve tokens Open the Remix app ⁠ in a browser In the File Explorer create a file named GraphToken.abi with the token ABI ⁠ . With GraphToken.abi selected and open in the editor, switch to the Deploy and run transactions section in the Remix interface. Under environment select Injected Web3 and under Account select your Indexer address. Set the GraphToken contract address - Paste the GraphToken contract address ( 0xc944E90C64B2c07662A292be6244BDf05Cda44a7 ) next to At Address and click the At address button to apply. Call the approve(spender, amount) function to approve the Staking contract. Fill in spender with the Staking contract address ( 0xF55041E37E12cD407ad00CE2910B8269B01263b9 ) and amount with the tokens to stake (in wei). Stake tokens Open the Remix app ⁠ in a browser In the File Explorer create a file named Staking.abi with the staking ABI ⁠ . With Staking.abi selected and open in the editor, switch to the Deploy and run transactions section in the Remix interface. Under environment select Injected Web3 and under Account select your Indexer address. Set the Staking contract address - Paste the Staking contract address ( 0xF55041E37E12cD407ad00CE2910B8269B01263b9 ) next to At Address and click the At address button to apply. Call stake() to stake GRT in the protocol. (Optional) Indexers may approve another address to be the operator for their Indexer infrastructure in order to separate the keys that control the funds from those that are performing day to day actions such as allocating on Subgraphs and serving (paid) queries. In order to set the operator call setOperator() with the operator address. (Optional) In order to control the distribution of rewards and strategically attract Delegators Indexers can update their delegation parameters by updating their indexingRewardCut (parts per million), queryFeeCut (parts per million), and cooldownBlocks (number of blocks). To do so call setDelegationParameters() . The following example sets the queryFeeCut to distribute 95% of query rebates to the Indexer and 5% to Delegators, set the indexingRewardCut to distribute 60% of indexing rewards to the Indexer and 40% to Delegators, and set the cooldownBlocks period to 500 blocks. 1 setDelegationParameters(950000, 600000, 500) Setting delegation parameters The setDelegationParameters() function in the staking contract ⁠ is essential for Indexers, allowing them to set parameters that define their interactions with Delegators, influencing their reward sharing and delegation capacity. How to set delegation parameters To set the delegation parameters using Graph Explorer interface, follow these steps: Navigate to Graph Explorer . Connect your wallet. Choose multisig (such as Gnosis Safe) and then select mainnet. Note: You will need to repeat this process for Arbitrum One. Connect the wallet you have as a signer. Navigate to the ‘Settings’ section and select ‘Delegation Parameters’. These parameters should be configured to achieve an effective cut within the desired range. Upon entering values in the provided input fields, the interface will automatically calculate the effective cut. Adjust these values as necessary to attain the desired effective cut percentage. Submit the transaction to the network. Note: This transaction will need to be confirmed by the multisig wallet signers. The life of an allocation Under Graph Horizon, allocations follow a new lifecycle managed by the SubgraphService: 1. Open An indexer opens an allocation by staking GRT against a subgraph deployment via a provision to the SubgraphService. The allocation is now active and the indexer begins accruing indexing rewards proportional to their allocated stake and the subgraph’s curation signal. 2. Active (ongoing POI collection) The indexer submits Proofs of Indexing (POIs) periodically to collect accrued rewards. The allocation remains open — there is no time limit. Submitting a POI does not close the allocation. If a POI becomes stale (exceeds maxPOIStaleness , currently 28 days ), any network participant can force-close the allocation. There is no retroactive recovery of uncollected rewards. 3. Close (optional) An indexer may close an allocation at any time. Closing is optional and is not required to collect rewards. Transition period note: The current indexer-agent ( indexer-agent v0.x) continues to cycle allocations approximately every 28 days during the transition to Horizon. This is a compatibility behavior, not a protocol requirement. Future agent versions will support long-lived allocations natively. Indexers are recommended to utilize offchain syncing functionality to sync Subgraph deployments to chainhead before creating the allocation onchain. Provisions and Data Services Graph Horizon introduces a modular architecture where indexers explicitly assign (“provision”) staked GRT to specific data services before it can be used for indexing. SubgraphService is the first and currently primary data service. To index subgraphs and earn rewards, an indexer must: Stake GRT in the core staking contract Create a provision assigning that stake to the SubgraphService Open allocations against subgraph deployments via the SubgraphService Stake that has not been provisioned to a data service cannot be used for indexing or earn rewards. See the Graph Horizon migration guide for step-by-step provisioning instructions. ## /docs/en/gateways/subgraphs/overview Gateway Software > Subgraph Gateway A Subgraph Gateway is the entry point between Data Consumers and the Indexers who serve their data on The Graph Network. This documentation is written for teams who want to operate a Gateway: it covers what a Gateway does, how it fits into The Graph, and the consumer-side and supply-side responsibilities that come with running one. Who Runs Subgraph Gateways Operator type Benefits of Subgraph Gateway Data and API providers Resell access to 15,000+ Subgraphs under own brand and billing Analytics platforms Query protocol data across many chains without maintaining own indexing infrastructure Wallets and portfolio apps Position and activity data without protocol-specific indexing AI data services x402-native, pay-per-query access for autonomous agents Enterprises Self-hosted, SLA-controlled access to blockchain data The Subgraph Network The Graph is an indexing and query protocol for blockchain data. One of The Graph’s products are Subgraphs, which open APIs that extract, process, and store blockchain data so anyone can query it. Through The Graph protocol, the Subgraph Network is the decentralized set of independent Indexers who sync those Subgraphs and serve those results to end consumers. The network hosts 15,000+ published Subgraphs across dozens of chains , including high-demand ones like Uniswap, ENS, and Lido. With Graph Horizon now live , The Graph protocol has generalized into an open marketplace of interchangeable data services: the Subgraph data service is the first, and the payment rails in this documentation (Graph Tally and Horizon Escrow) are the same ones future services will use. A Subgraph Gateway lets a service provider put all of this to work under their own brand. Consumers send GraphQL queries to a gateway endpoint, and it discovers which Indexers can serve each one, routes to the best candidates, returns the response, and pays the Indexers it used. It is not strictly required (as consumers can query Indexers directly), but since individual Indexers are independent operators that may slow down or drop offline at any time, a Gateway absorbs that variability to maintain higher quality of service (QoS) while handling per-query payment. For an Operator that runs data infrastructure (like an RPC provider, analytics platform, wallet backend, AI data service, or any product that resells or embeds blockchain data), running a Subgraph Gateway offers their customers managed access to The Graph Network under the Operator’s own authentication, billing, and service level agreements (SLAs). Why Providers Run Subgraph Gateways Enable Vertical Integration of Data Services A Gateway is not only cheaper than running an Operator’s own indexing stack, it changes what an Operator can offer. Because a Gateway owns authentication, routing, payment, and QoS, a service provider can integrate The Graph Network into a full product stack: pair network data with their own APIs, add their own auth and rate limits, bundle Subgraph access with adjacent services, and present one endpoint and one bill to their customers. An Operator controls the consumer experience end to end while the network absorbs the cost and complexity of indexing. This vertical integration, owning the customer relationship while outsourcing the indexing, is the core commercial advantage of operating a Gateway. Leverage 15,000+ Public Blockchain Data APIs Running a Gateway gives service providers and their customers query access to every published Subgraph on The Graph Network, including the high-demand, hard-to-maintain ones, without having to stand up and babysit that indexing infrastructure directly. For most teams, the alternative is running Graph Node (or equivalent) for every protocol they want to support, each with its own archive node, sync time, re-org handling, and ongoing maintenance. A Gateway replaces that with a single integration point in front of infrastructure that already exists on the network. Support More Indexed Chains The Graph Network indexes Subgraphs across dozens of chains, and that coverage grows as new chains are integrated. Routing through a Gateway means Operators can support more chains for their customers without operating a node on each one: as The Graph adds chain support, Gateway Operators can serve those Subgraphs through the same endpoint. This lets a service provider expand multichain coverage at the speed of the network rather than the speed of their own infrastructure buildout. An Operator is not limited to the chains already integrated, either: an Operator that needs a new chain can help drive its integration onto the network, covered in Chain Integrations . Offset Indexing Infrastructure Costs Indexing popular protocols is expensive and operationally heavy: archive nodes, storage, sync times measured in days, and around-the-clock reliability engineering. By routing to Indexers who already run that infrastructure, a Gateway converts a large fixed infrastructure cost into a usage-based query cost. Operators pay Indexers for the queries they actually serve, settled as efficient micropayments through Graph Tally rather than a per-query on-chain transaction. To learn more, see Pricing & Payments . Curate Common Data through Collections Most consumers do not want the full surface area of 15,000+ Subgraphs. Instead, consumers typically want the handful that matter to their product, presented simply. Subgraph Collections let a Gateway Operator group and curate a chosen set of Subgraphs for end users, reducing complexity and turning raw network access into a tailored data product. Offering curated, common data (the pools, names, and balances an Operator’s customers actually query) is a clear advantage over an unfiltered view of every Subgraph on the network. Enabling Blockchain Data for Humans and Agents A Gateway authenticates requests with either API keys (best for humans and applications) or x402 pay-per-query in USDC (best for autonomous AI agents that pay as they go with no account). One piece of infrastructure serves both audiences. See Serving Queries . Eliminating Single Points of Failure Queries are served by a decentralized set of Indexers rather than one hosted backend, and responses can carry attestations backed by Proof of Indexing (POI) and Fisherman dispute resolution. A Gateway can select multiple Indexers per query that fails over automatically, so no single Indexer outage takes down the Operator’s service. What Subgraph Gateway Operators Run Running a Gateway means running a small set of services and managing a few wallets. At a high level these components include: Graph Gateway: routes queries, discovers and selects Indexers, and signs payment receipts. Indexer Selection: the mechanism that picks the best Indexers per query. Graph Tally: the payment layer (receipts, RAVs, on-chain settlement) plus the aggregator and escrow-manager services a Gateway Operator runs. Titorelli: an optional data-science service that aggregates a Gateway’s Kafka output. Operations: wallets, escrow funding, configuration, authentication, and monitoring. How Graph Gateway Docs Are Organized This documentation is split into the two sides of a Gateway plus the shared components and ecosystem context. Components: the internals of a Subgraph Gateway, how a query flows through it, and how to deploy one. Consumer-Side: everything facing the developers and consumers who use a Subgraph Gateway, including pricing, query routing, collections, publication, and support. Supply-Side: everything facing the Indexers who serve an Operator’s queries, including routing, escrow, sync incentives, and quality of service. Ecosystem Contributions: how operating a Gateway connects back to the broader Graph ecosystem, including Graph Node and chain integrations. ## /docs/en/graph-horizon/overview Data Services This document provides a high level overview of Graph Horizon. For a deep dive the following GIPs are recommended: GIP-0066: Introducing Graph Horizon - A data services protocol ⁠ GIP-0068: Subgraph Service - A subgraph data service in Graph Horizon ⁠ GIP-0085: Graph Horizon: Arbitration Charter ⁠ The Graph Protocol is evolving with Horizon, a major upgrade that transforms the protocol into a more flexible and modular data services platform. While The Graph’s core mission of organizing the world’s public data remains unchanged, Horizon introduces a new architecture that enables permissionless innovation and improved economic mechanisms. This upgrade represents the next evolution of The Graph, making it more composable, efficient, and capable of supporting various types of data services beyond just subgraphs. Graph Horizon in a nutshell The Graph Protocol as originally designed and launched back in 2021 is comprised of three distinct parts: Staking mechanisms to provide economic security to the network Payments mechanisms to allow users to pay for access to data Support for the subgraphs use case The protocol achieves this goals very well however it was designed specifically with the subgraph use case in mind. This resulted in those three components being very tightly coupled, making changes to the protocol hard to do and risky, and also not providing enough flexibility to support other use cases. Graph Horizon’s main goal is to transform The Graph into a protocol capable of serving a multitude of data services, not just subgraphs. It achieves this by extracting the core functionality into primitives that can be reused by arbitrary data service implementations: Core staking protocol Core payments protocol Arbitrary data service implementations These primitives can be permissionlessly composed by developers by means of the Data Service Framework. The Data Service Framework Horizon introduces a modular Data Service Framework that allows different types of data services to be built on top of The Graph’s core staking and payments infrastructure. The SubgraphService is the first and currently only data service implementation, supporting the existing functionality of indexing subgraphs and serving queries. This modular approach means that in the future, other data services could be added to support different use cases like SQL queries, data streams, or other data delivery mechanisms. A key benefit of Horizon is that new data services can be developed and deployed permissionlessly with minimal cost and development time, as they can leverage the existing staking and payments infrastructure. Enhanced Payment System Integrated Payments Protocol Horizon brings the payments infrastructure directly into the core protocol. The payments protocol in Horizon was designed as a generalized framework, with GraphTally (formerly TAP) as the integrated payment collection system. This architecture also supports other arbitrary payment collection systems in the future. GraphPayments and PaymentsEscrow A new set of contracts GraphPayments and PaymentsEscrow contracts handle the escrow and distribution of fees to all relevant parties. This contracts enforce things like the protocol tax and ensures that payments are properly distributed between data services, delegators, and indexers, making the payment process transparent. ## /docs/en/resources/glossary Resources The Graph : A decentralized protocol for indexing and querying data. Query : A request for data. In the case of The Graph, a query is a request for data from a Subgraph that will be answered by an Indexer. GraphQL : A query language for APIs and a runtime for fulfilling those queries with your existing data. The Graph uses GraphQL to query Subgraphs. Endpoint : A URL that can be used to query a Subgraph. The testing endpoint for Subgraph Studio is https://api.studio.thegraph.com/query/<ID>/<SUBGRAPH_NAME>/<VERSION> and the Graph Explorer endpoint is https://gateway.thegraph.com/api/<API_KEY>/subgraphs/id/<SUBGRAPH_ID> . The Graph Explorer endpoint is used to query Subgraphs on The Graph’s decentralized network. Subgraph : An open API that extracts data from a blockchain, processes it, and stores it so that it can be easily queried via Gr
프로젝트로 돌아가기