This subgraph tracks events occuring on Winding Tree's ORGiD contract.
The data can later be queried using a GraphQL API.
Get 5 random ORGiDs, their owner and the country of the legal entity:
curl -X POST \
-d '{ "query": "query { organizations(first: 5) { id owner legalEntity { country }}}" }' \
https://api.thegraph.com/subgraphs/name/windingtree/orgid-subgraph
The below instructions are adapted from The Graph quickstart.
Clone the source code:
git clone git@github.com:windingtree/orgid-subgraph.git
Install dependencies:
yarn install
In a dedicated terminal:
# Clone the Graph Node repository
cd /tmp
git clone https://github.com/graphprotocol/graph-node/
# Change directory to Docker
cd graph-node/docker
By default, the ethereum node will be assumed to be the docker host IP and the network mainnet, but you can update it in the docker-compose.yml
file.
For Linux: the docket host IP must be updated using the setup.sh
script:
# ! Linux Only ! run setup.sh to update the host IP in docker settings
./setup.sh
For an externally hosted node type infura, the ethereum node URL must be updated in the docker-compose.yml
file.
Then launch the node:
# Start the graph node
docker-compose up
Generate code:
yarn codegen
Build the subgraph:
yarn build
Allocate the subgraph in the Graph Node with:
yarn create-local
Deploy the subgraph locally:
yarn deploy-local
This will trigger the indexing of the subgraph in the Graph node and can take some time. Check the Graph node logs to check when data ingestion is completed.
Once the ingestion is completed, you can query the Graph Node, for example to get all organizations:
curl -X POST \
-d '{ "query": "{organizations {id, owner, isActive}}" }' \
http://localhost:8000/subgraphs/name/windingtree/orgid-subgraph
Create an access token and store it locally. <ACCESS_TOKEN>
is from The Graph Dashboard.
graph auth https://api.thegraph.com/deploy/ <ACCESS_TOKEN>
Then deploy:
yarn deploy
Status on the syncronization can be retrieved using:
curl -X POST \
-d '{ "query": "query { indexingStatusForPendingVersion(subgraphName: \"windingtree/orgid-subgraph\") { synced health fatalError { message handler} }}" }' \
https://api.thegraph.com/index-node/graphql