#Querying
Below are some sample queries you can use to gather information from the Art Blocks contracts.
You can build your own queries using a GraphQL Explorer and enter your endpoint to limit the data to exactly what you need.
#Subgraph Querying Walkthrough
The following provides some examples of how to use the Art Blocks subgraph to perform a handful of common queries.
#Important Notes
- Performance/indexing on the hosted subgraph service is oftentimes slower compared to the decentralized subgraph. That being said, the hosted subgraph is free while the decentralized one requires pay-per-query in GRT.
- The Art Blocks subgraphs currently also index any PBAB (Powered by Artblocks) contracts, in addition to the core Art Blocks contracts. Please keep that in mind and make use of the
contract_in
filter to ensure you are working with Art Blocks data only, if that is your intention.
- While querying against the mainnet subgraph if using the
contract_in
filter the Art Blocks contracts to restrict for are0x059edd72cd353df5106d2b9cc5ab83a52287ac3a
(for the V0 contract that supports projects 0-3) and0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270
(for the V1 contract that supports projects 4-current). - The Art Blocks contract to restrict for is
0xda62f67be7194775a75be91cbf9feedcc5776d4b
on testnet.
#The Basics
Retrieving a specific Art Blocks project by short ID (no contract):
Network | Contract Type | Query |
Mainnet | Flagship | |
Mainnet | Engine | |
Testnet | Flagship | |
Testnet | Engine |
Retrieving a specific Art Blocks project by full ID (includes contract):
Network | Contract Type | Query |
Mainnet | Flagship | |
Mainnet | Engine | |
Testnet | Flagship | |
Testnet | Engine |
Retrieving a specific Art Blocks token by short ID (no contract):
Network | Contract Type | Query |
Mainnet | Flagship | |
Mainnet | Engine | Requires full ID (includes contract) |
Testnet | Flagship | |
Testnet | Engine | Requires full ID (includes contract) |
Retrieving a specific Art Blocks token by full ID (includes contract):
Network | Contract Type | Query |
Mainnet | Flagship | |
Mainnet | Engine | |
Testnet | Flagship | |
Testnet | Engine |
#Beyond The Basics
Retrieve the last 5 most recently created projects across Art Blocks and Powered by Art Blocks (remember that you can use a contract_in
filter to restrict this to only specific contracts):
Retrieve the top 10 projects across Art Blocks and Powered by Art Blocks, based on # of invocations:
Retrieve the most recently minted Art Blocks token:
Retrieve all tokens owned by a specific address, across Art Blocks and Powered by Art Blocks:
Retrieve the general metadata/status for the Art Blocks subgraph (useful for debugging):
Retrieve the project script for a given project id
Pagination should be used for large queries. The Graph enforces upper limits on first
and skip
parameters since they generally perform poorly when set to large values (limits as of 01/2022 are first<=1000
and skip<=5000
). It is much better to page through entities based on an attribute such as token ID, block number, or some other parameter. For more information, see The Graph documentation
#Project info
- Pull all projects and return their name, as well as lots of additional data:
- Get all the wallet owners of a project (Replace PROJECT with the project name you are looking for)
- If you're looking for the addresses of anyone that owns a mint from a project
- Get that txnhash for squiggle 0, you could run the following query on the AB subgraph playground