The Graph
The Graph is a indexing protocol and be used to create subgraphs on SKALE Chain data.
You can reach out to the Graph community to request a Graph node, or you may run your own Graph node. These instructions assume you are using a Testnet or Mainnet SKALE Chain and are running your own graph node.
-
Install Prerequisites
- docker
- docker-compose
- nodejs
- npm
- yarn
- truffle
-
Get a SKALE Endpoint
Get the SKALE chain endpoint assigned to your project here OR use your your own dedicated chain as available.
-
Configure a Graph Node
Then modify the
docker-compose.yml
file:(1) Replace with your SKALE Chain endpoint if not using the SKALE-IMA-SDK. (2) Add this if using
host.docker.internal
on a Linux machine. -
Start the Graph Node
To follow the container output, run
docker logs docker_graph-node_1 --follow
-
Prepare the Subgraph test
In another terminal on the same machine, execute:
Modify the .env file.
(1) You will add the contract address in step 7.
-
Deploy Test contract
-
Add deployed MyToken Contract address to subgraph.yaml
(1) Change from
mainnet
toskale
to match docker-compose.yml in graph-node. (2) Replace with deployed contract address. -
Add deployed MyToken contract address to .env file
-
Execute yarn
-
Create local Subgraph
Expected output:
Expected output in Graph-node container:
-
Deploy to Local
-
Verify graph-node terminal
Expected output in graph-node container:
-
Execute graph test
Expected output:
-
Execute token test
Output:
-
Check your GraphQL
-
Perform a test query
Expected output:
Additional The Graph Documentation
Click here for the official documentation.