The Graph 백서

The Graph

원문

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

call, and event data. Modules are written in Rust and composed into reusable packages. Find an Existing Module on Substreams.dev Before writing any code, check the Substreams Registry ⁠ for a package that already does what you need. The registry hosts community- and team-built modules — DEX trades, token transfers, contract events, and more — that you can run as-is or compose into your own pipeline. Search for the protocol or data you want on Arc ; if a module fits, you can consume its output directly or import it as a dependency in your own project. Develop Your Own Substreams Module If no existing module fits, you can build one. The Substreams Quick Start is the full walkthrough. In short: Install the Substreams CLI and get an API key from [Pinax Network](https://app.pinax.network/) . Scaffold a project with substreams init and choose the EVM path, pointing it at your Arc contract. Write your extraction and transformation logic in Rust, then run substreams build . Stream the output with substreams gui (or substreams run ) to iterate, then publish your package to the Substreams Registry ⁠ to reuse or share it. Guides 10 min Subgraph quick start Kickstart your journey into subgraph development. 12 min Graph Explorer Find and query existing blockchain data. 5 min Studio Billing Optimize costs and manage billing efficiently. 15 min Substreams quick start Stream high-speed data for real-time indexing. 5 min Substreams.dev Access tutorials, templates, and documentation to build custom data modules. 5 min Substreams Pricing Compare providers and pricing to consume Substreams data. ## /docs/en/supported-networks/btc Bitcoin Mainnet Substreams (Non-EVM) The Graph Market ⁠ • Pinax Network ⁠ Type mainnet Identifier btc Chain ID bip122:000000000019d6689c085ae165831e93 Native Currency BTC Chain Docs https://developer.bitcoin.org ⁠ Indexing Data on Bitcoin Bitcoin is the original and largest proof-of-work blockchain, securing the BTC asset and a growing ecosystem of layers and protocols built on top of it. The Graph can stream that onchain activity — blocks and transactions, inputs and outputs, and address activity — as real-time data with Substreams. Bitcoin is supported by The Graph with Substreams — a parallelized, real-time streaming engine for high-throughput use cases — via The Graph Market ⁠ and Pinax Network ⁠ . Indexing Bitcoin with Substreams Substreams is a parallelized, real-time streaming engine for extracting and transforming blockchain data. Where a Subgraph indexes into a hosted GraphQL API, Substreams lets you consume high-throughput data directly or via 10+ supported sinks . Substreams streams Bitcoin’s blocks, transactions, and their inputs and outputs. Modules are written in Rust and composed into reusable packages. Find an Existing Module on Substreams.dev Before writing any code, check the Substreams Registry ⁠ for a package that already does what you need. The registry hosts community- and team-built modules covering common onchain data that you can run as-is or compose into your own pipeline. Search for the protocol or data you want on Bitcoin; if a module fits, you can consume its output directly or import it as a dependency in your own project. Develop Your Own Substreams Module If no existing module fits, you can build one. The Substreams Quick Start is the full walkthrough. In short: Install the Substreams CLI and get a key at thegraph.market ⁠ (no personal information required). substreams init does not have a template for Bitcoin yet, so set up the project by hand: write a substreams.yaml manifest ⁠ with network: btc and a Rust map module that takes sf.bitcoin.type.v1.Block as its input (the protobuf definitions are published on Buf ⁠ ). Write your extraction and transformation logic in Rust, then run substreams build . Stream the output with substreams gui (or substreams run ) to iterate, then publish your package to the Substreams Registry ⁠ to reuse or share it. Guides 15 min Substreams quick start Stream high-speed data for real-time indexing. 10 min Substreams.dev Access tutorials, templates, and documentation to build custom data modules. 8 min Custom Substreams Sinks Leverage existing Substreams sinks to access data. 5 min Substreams starter Leverage this boilerplate to create your first Substreams module. 7 min Substreams GitHub repository Study, contribute to, or customize the core Substreams framework. ## /docs/en/supported-networks/blast-mainnet Blast Mainnet Substreams (Base EVM) Pinax Network ⁠ Type mainnet Protocol ethereum Identifier blast-mainnet Chain ID eip155:81457 Native Currency ETH Chain Docs https://docs.blast.io ⁠ Indexing Data on Blast Blast is an Ethereum Layer 2 built on the OP Stack that offers native yield on ETH and stablecoins for its DeFi and dApp ecosystem. The Graph can stream that onchain activity — DEX swaps, pools, and liquidity; lending and borrowing positions; token transfers and holder balances; and contract events — as real-time data with Substreams. Blast is supported by The Graph with Substreams — a parallelized, real-time streaming engine for high-throughput use cases — via Pinax Network ⁠ . Indexing Blast with Substreams Substreams is a parallelized, real-time streaming engine for extracting and transforming blockchain data. Where a Subgraph indexes into a hosted GraphQL API, Substreams lets you consume high-throughput data directly or via 10+ supported sinks . Blast is served with the base EVM block model, so Substreams modules have access to block, transaction, and event (log) data. Modules are written in Rust and composed into reusable packages. Find an Existing Module on Substreams.dev Before writing any code, check the Substreams Registry ⁠ for a package that already does what you need. The registry hosts community- and team-built modules covering common onchain data that you can run as-is or compose into your own pipeline. Search for the protocol or data you want on Blast ; if a module fits, you can consume its output directly or import it as a dependency in your own project. Develop Your Own Substreams Module If no existing module fits, you can build one. The Substreams Quick Start is the full walkthrough. In short: Install the Substreams CLI and get an API key from [Pinax Network](https://app.pinax.network/) . Scaffold a project with substreams init and choose the EVM path, pointing it at your Blast contract. Write your extraction and transformation logic in Rust, then run substreams build . Stream the output with substreams gui (or substreams run ) to iterate, then publish your package to the Substreams Registry ⁠ to reuse or share it. Guides 15 min Substreams quick start Stream high-speed data for real-time indexing. 10 min Substreams.dev Access tutorials, templates, and documentation to build custom data modules. 8 min Custom Substreams Sinks Leverage existing Substreams sinks to access data. 5 min Substreams starter Leverage this boilerplate to create your first Substreams module. 7 min Substreams GitHub repository Study, contribute to, or customize the core Substreams framework. ## /docs/en/supported-networks/boba Boba Network Subgraphs Subgraph Studio (API Keys) ⁠ • Community Indexing Type mainnet Protocol ethereum Identifier boba Chain ID eip155:288 Native Currency ETH Chain Docs https://docs.boba.network ⁠ Indexing Data on Boba Boba Network is an Ethereum Layer 2 optimistic rollup that adds hybrid compute for calling external APIs from smart contracts, supporting DeFi and consumer applications. The Graph can index that onchain activity — DEX swaps, pools, and liquidity; lending and borrowing positions; token transfers and holder balances; and contract events — and serve it over GraphQL with Subgraphs. Boba is supported by The Graph with Subgraphs — open APIs you publish to The Graph Network, where Indexers sync and serve the data while you manage your service in Subgraph Studio . Indexing Boba with Subgraphs Getting smart contract data is hard. You write your own indexer, run your own database, and handle chain reorganizations yourself. The Graph removes that work, giving you an open API, called a Subgraph , that you query with GraphQL. Boba is EVM-compatible, so the Subgraph workflow is the same as on most EVM chains. You point a Subgraph at your Boba contract, define the entities you want, and Indexers on The Graph Network keep those entities current and queryable. Quick Start: Build Your Own Subgraph Building a Subgraph for Boba takes three steps: Initialize a Subgraph project from your Boba contract. Publish it to The Graph Network for decentralized indexing. Query it over GraphQL with an API key. See the Subgraph pricing page for current query rates and free-tier limits. Step 1: Initialize your Subgraph project Install the Graph CLI with the package manager you prefer: 1 # npm 2 npm install -g @graphprotocol/graph-cli@latest 3 4 # or yarn 5 yarn global add @graphprotocol/graph-cli Verify the install: 1 graph --version Initialize from your Boba contract: 1 graph init The CLI walks you through a set of prompts : Protocol : choose ethereum . Boba is EVM-compatible. Subgraph slug : an identifier for your Subgraph, for example my-boba-subgraph . Directory : where the project is scaffolded. Ethereum network : select boba from the list of supported networks. Contract address : the address of the contract you want to index. Find it on bobascan.com . ABI : if the CLI cannot fetch the ABI, export it from your build artifacts or the BobaScan contract page. Supply it as a JSON file. Start block : the block your contract was deployed at. Set this so indexing does not scan from genesis. The explorer shows the deployment block. Contract name : the name of your contract. Index contract events as entities : set this to true . The CLI then scaffolds entities and mappings for every emitted event. The network value for Boba is boba . graph init recognizes it directly, so you can select it from the list of supported networks. You can also set the network field manually in subgraph.yaml (next step). Step 2: Write and build your Subgraph You work with three files: Manifest: subgraph.yaml defines which data sources your Subgraph indexes. Schema: schema.graphql defines the entities you want to query. Mappings: src/mapping.ts uses AssemblyScript that translates on-chain events into your entities. Point the manifest at Boba : 1 dataSources: 2 - kind: ethereum 3 name: MyContract 4 network: boba 5 source: 6 address: '0xYourBobaContractAddress' 7 abi: MyContract 8 startBlock: 123456 # your contract's deployment block For a full walkthrough of schema and mapping authoring, see Creating a Subgraph . Generate types and build: 1 graph codegen && graph build Optional: verify locally before publishing. You can test indexing with a local Graph Node ⁠ pointed at an RPC endpoint for Boba . In your docker-compose.yml , set the Ethereum environment to Boba : 1 environment: 2 ethereum: 'boba:https://mainnet.boba.network' Create and deploy to your local node: 1 graph create --node http://localhost:8020/ my-boba-subgraph 2 graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 my-boba-subgraph Query the local endpoint until your entities look right, then publish. Step 3: Publish & Curate on The Graph Network Publishing is an on-chain action that: makes your Subgraph available for decentralized Indexers to index, makes it publicly searchable and queryable in Graph Explorer , and makes it available for Curators to add signal. Build, then publish from the Graph CLI: 1 graph codegen && graph build 2 graph publish A browser window opens. Connect your wallet, add metadata (name, description, image), and publish your Subgraph. The --protocol-network flag refers to where The Graph’s protocol contracts live (Arbitrum One), not to Boba . During the publish transaction, you can add 500 GRT in curation signal to save on gas fees. Signal tells Indexers that your Subgraph is worth indexing. Any Subgraph with 500 GRT or more signal will automatically be indexed; without signal, no Indexer is incentivized to pick up your Subgraph. Step 4: Query your Subgraph After you publish, open your Subgraph in Graph Explorer and copy its query URL from the Query button. Create an API key from the API Keys dashboard at thegraph.com/studio . This dashboard handles API keys and billing for The Graph Network . Send GraphQL queries to the query URL with your API key. See the Subgraph pricing page for query rates, and Querying The Graph for the full query API. Guides 10 min Subgraph quick start Kickstart your journey into subgraph development. 12 min Graph Explorer Find and query existing blockchain data. 5 min Billing Optimize costs and manage billing efficiently. 5 min Timeseries & Aggregations Learn to track metrics like daily volumes or user growth. 7 min Advanced subgraph features Leverage features like custom data sources, event handlers, and topic filters. ## /docs/en/supported-networks/chiliz Chiliz Mainnet Subgraphs Subgraph Studio ⁠ Type mainnet Protocol ethereum Identifier chiliz Chain ID eip155:88888 Native Currency CHZ Chain Docs https://docs.chiliz.com ⁠ Indexing Data on Chiliz Chiliz is an EVM-compatible Layer 1 built for sports and entertainment, powering fan tokens and fan-engagement apps, with CHZ as its native token. The Graph can index that onchain activity — DEX swaps, pools, and liquidity; lending and borrowing positions; token transfers and holder balances; and contract events — and serve it over GraphQL with Subgraphs. Chiliz is supported by The Graph with Subgraphs — develop, test, and publish them in Subgraph Studio . Publishing is enabled, though guaranteed indexing via The Graph Network is not yet available for Chiliz. Indexing Chiliz with Subgraphs Getting smart contract data is hard. You write your own indexer, run your own database, and handle chain reorganizations yourself. The Graph removes that work, giving you an open API, called a Subgraph , that you query with GraphQL. Chiliz is EVM-compatible, so the Subgraph workflow is the same as on most EVM chains. You develop and test your Subgraph in Subgraph Studio , then query it through the development endpoint. Subgraph publishing is enabled for Chiliz , but no guaranteed indexing is available via The Graph Network at this time. You can develop, test, and publish your Subgraph in Subgraph Studio , but Indexers on the decentralized network are not guaranteed to index and serve it yet. Quick Start: Build Your Own Subgraph Building a Subgraph for Chiliz takes four steps: Create your Subgraph in Subgraph Studio. Initialize a Subgraph project from your Chiliz contract. Deploy it to Subgraph Studio and test it in the playground. Query it over GraphQL with the development endpoint. See the Subgraph pricing page for current query rates and free-tier limits. Step 1: Create your Subgraph in Subgraph Studio Open Subgraph Studio and connect your wallet (MetaMask, Coinbase Wallet, WalletConnect, or Safe). Create a Subgraph, then copy its slug and your deploy key from the Subgraph details page — you use both from the CLI. For a full walkthrough, see Using Subgraph Studio . Step 2: Initialize your Subgraph project Install the Graph CLI with the package manager you prefer: 1 # npm 2 npm install -g @graphprotocol/graph-cli@latest 3 4 # or yarn 5 yarn global add @graphprotocol/graph-cli Initialize from your Chiliz contract: 1 graph init The CLI walks you through a set of prompts: Protocol : choose ethereum . Chiliz is EVM-compatible. Subgraph slug : use the slug of the Subgraph you created in Subgraph Studio, for example my-chiliz-subgraph . Directory : where the project is scaffolded. Ethereum network : select chiliz from the list of supported networks. Contract address : the address of the contract you want to index. Find it on chiliscan.com . ABI : if the CLI cannot fetch the ABI, export it from your build artifacts or the Chiliscan contract page. Supply it as a JSON file. Start block : the block your contract was deployed at. Set this so indexing does not scan from genesis. The explorer shows the deployment block. Contract name : the name of your contract. Index contract events as entities : set this to true . The CLI then scaffolds entities and mappings for every emitted event. Point the manifest at Chiliz : 1 dataSources: 2 - kind: ethereum 3 name: MyContract 4 network: chiliz 5 source: 6 address: '0xYourChilizContractAddress' 7 abi: MyContract 8 startBlock: 123456 # your contract's deployment block For a full walkthrough of schema and mapping authoring, see Creating a Subgraph . Then generate types and build: 1 graph codegen && graph build Step 3: Deploy to Subgraph Studio Authenticate the CLI with the deploy key from your Subgraph details page: 1 graph auth <DEPLOY_KEY> Then deploy your Subgraph to Subgraph Studio (the CLI asks for a version label such as 0.0.1 ): 1 graph deploy <SUBGRAPH_SLUG> Deploying pushes your Subgraph to Subgraph Studio, where you can test it in the playground and check indexing logs. It does not publish it to the decentralized network — see Using Subgraph Studio for details. Step 4: Query your Subgraph Once your Subgraph is syncing in Studio, test your queries against the development query URL shown on the Subgraph details page. Create an API key from the API Keys dashboard at thegraph.com/studio . Send GraphQL queries to the development query URL with your API key. The development endpoint is rate-limited (currently 3,000 queries per day). You can publish your Subgraph to The Graph Network at any time, but Indexers are not guaranteed to serve Chiliz Subgraphs yet, so the Subgraph Studio development endpoint is the reliable way to query today. See Querying The Graph for the full query API. Guides 10 min Subgraph quick start Kickstart your journey into subgraph development. 12 min Graph Explorer Find and query existing blockchain data. 5 min Billing Optimize costs and manage billing efficiently. 5 min Timeseries & Aggregations Learn to track metrics like daily volumes or user growth. 7 min Advanced subgraph features Leverage features like custom data sources, event handlers, and topic filters. ## /docs/en/supported-networks/etherlink-mainnet Etherlink Mainnet Subgraphs Subgraph Studio ⁠ Type mainnet Protocol ethereum Identifier etherlink-mainnet Chain ID eip155:42793 Native Currency XTZ Chain Docs https://docs.etherlink.com ⁠ Indexing Data on Etherlink Etherlink is an EVM-compatible Layer 2 built on Tezos Smart Rollups, offering low fees and fast confirmations with XTZ for gas. The Graph can index that onchain activity — DEX swaps, pools, and liquidity; lending and borrowing positions; token transfers and holder balances; and contract events — and serve it over GraphQL with Subgraphs. Etherlink is supported by The Graph with Subgraphs — develop, test, and publish them in Subgraph Studio . Publishing is enabled, though guaranteed indexing via The Graph Network is not yet available for Etherlink. Indexing Etherlink with Subgraphs Getting smart contract data is hard. You write your own indexer, run your own database, and handle chain reorganizations yourself. The Graph removes that work, giving you an open API, called a Subgraph , that you query with GraphQL. Etherlink is EVM-compatible, so the Subgraph workflow is the same as on most EVM chains. You develop and test your Subgraph in Subgraph Studio , then query it through the development endpoint. Subgraph publishing is enabled for Etherlink , but no guaranteed indexing is available via The Graph Network at this time. You can develop, test, and publish your Subgraph in Subg
프로젝트로 돌아가기