The Graph
The Graph enables you to easily query data about your contract from the blockchain
โ€‹The Graph lets you process on-chain events to create a Subgraph, an easy to query graphQL endpoint!
scaffold-eth comes with a built in demo subgraph, as well as a local docker setup to run a graph-node locally.
A 15-minutes speedrun on how to integrate The Graph
Step 1: Clean up previous data:
yarn clean-graph-node
Step 2: Spin up a local graph node by running
yarn run-graph-node
Step 3: Create your local subgraph by running
yarn graph-create-local
This is only required once!
Step 4: Deploy your local subgraph by running
yarn graph-ship-local
Step 5: Edit your local subgraph in packages/subgraph/src
Learn more about subgraph definition hereโ€‹
Step 6: Deploy your contracts and your subgraph in one go by running:
yarn deploy-and-graph
Copy link