Table of contents
No headings in the article.
- Installation environment for the subquery
Node.js
Docker & Docker-compose
Git (Usually comes with the Linux OS, maybe not need to install it.)
this guide can help you https://tonymoon.hashnode.dev/subquery-frontier-reseau-guide-par-tony
Initialisation Ethereum project
subql init ethereum-index
Enter ethereum-index folder, then yarn install and codegen
cd ethereum-index
yarn install
yarn codegen
Take free API for Ethereum with your key from app.onfinality.io
Modified project.yaml file
endpoint: "https://eth.api.onfinality.io/rpc?apikey=<your_key>"
startBlock: 15695385
nano project.yaml
Build Ethereum project and run docker-compose
yarn build
docker-compose pull && docker-compose up
Check this query at
http://<your_host>:3000
{ query { transactions(first:2 orderBy:BLOCK_HEIGHT_ASC){ totalCount nodes{ id txHash blockHeight to from value contractAddress } } } }
Stop docker-compose at your host, export SUBQL_ACCESS_TOKEN and publish to get CID
docker-compose stop
export SUBQL_ACCESS_TOKEN=<your_token>
subql publish
Create project at managedservice.subquery.network by using CID and check query at explorer.subquery.network
You can also push your project to GitHub repo. Good Luck!