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.
This very basic SubQuery indexes staked rewards and determines the total rewards for each account, demonstrating how to aggregate data.
git clone https://github.com/subquery/tutorials-simple-aggregation.git
cd tutorials-simple-aggregation
# Yarn
yarn
#NPM
npm install
#Yarn
yarn codegen
#NPM
npm run-script codegen
#Yarn
yarn build
#NPM
npm run-script build
#Yarn
yarn start:docker
#NPM
npm run start:docker
query{
sumRewards(first:10){
nodes{
id
accountReward
createdAt
blockheight
}
}
}