iExec subgraph
Reading and aggregating complex data from blockchains can be slow and tedious, that's why developers build systems to index onchain data and redistribute it as web API.
The GraphQL API is publicly available:
- for queries:
https://thegraph.bellecour.iex.ec/subgraphs/name/bellecour/poco-v5
- for subscriptions:
wss://ws-thegraph.bellecour.iex.ec/subgraphs/name/bellecour/poco-v5
This subgraph is hosted by iExec and shared across all developers.
Keep in mind that you must use efficient calls and caching policy when querying this subgraph to avoid being rate limited.
{
protocol(id: "iExec") {
appsCount
datasetsCount
workerpoolsCount
dealsCount
tasksCount
completedTasksCount
claimedTasksCount
}
}
query appUsages($appAddress: String!) {
app(id: $appAddress) {
usages(orderBy: timestamp, orderDirection: desc) {
dealid: id
timestamp
tasks {
taskid: id
status
}
}
}
}
query workerRewardsAndSeizes($worker: String!) {
rewards(
where: { account: $worker }
orderBy: timestamp
orderDirection: desc
) {
value
timestamp
task {
taskid: id
}
transaction {
txHash: id
}
}
seizes(
where: { account: $worker }
orderBy: timestamp
orderDirection: desc
) {
value
timestamp
task {
taskid: id
}
transaction {
txHash: id
}
}
}
Here are some frequently asked questions about iExec's subgraph.
You may also find useful information on these resources:
Although an ethereum address has multiple valid formats, The Graph requires lowercase addresses.
- lowercase✔
0xf048ef3d7e3b33a465e0599e641bb29421f7df92
- checksum❌
0xF048eF3d7E3B33A465E0599E641BB29421f7Df92
- uppercase❌
0XF048EF3D7E3B33A465E0599E641BB29421F7DF92
By default, query responses are limited to 100 items per collection. If you want to receive more, you can go up to 1000 items per collection and beyond that, you can paginate with:
someCollection(first: 1000, skip: <number>) { ... }
Subgraphs are built to quickly access a representation of onchain state through a friendly API.
Under the hood, a subgraph is a centralized system watching the blockchain events and indexing data in a database. Like any system, it may be subject to issues (bugs, sync problems...) and reflect an erroneous or outdated state of the onchain data.
However relying on a subgraph to read and display non critical data is fine, users must always check the onchain state before interacting with a contract.
The subgraph source code is publicly available on the GitHub repository. You can use it to deploy the subgraph on a graphnode connected to the iExec Sidechain.
No, as the subgraph reflects the onchain data, GraphQL mutations are disabled. Changes only occurs when an onchain event is indexed.
Last modified 1mo ago