What is SubQuery?
SubQuery powers the next generation of Polkadot dApps by allowing developers to extract, transform and query blockchain data in real time using GraphQL. In addition to this, SubQuery provides production quality hosting infrastructure to run these projects in.
SubQuery Example - Account transfers
This subquery example indexes the amount transferred of each account and it is an example of a 1-many entity relationshp. In other words, one account can have many receiving addresses.
Getting Started
1. Clone the entire subql-example repository
git clone https://github.com/subquery/tutorials-account-transfers.git
2. Install dependencies
cd <folder>
yarn
3. Generate types
yarn codegen
4. Build the project
yarn build
5. Start Docker
docker-compose pull & docker-compose up
6. Run locally
Open http://localhost:3000/ on your browser
7. Example query to run
query{
transfers(first: 3){
nodes{
id
amount
blockNumber
to{
id
}
}
}
}