Aptos GraphQL and Analytics
Raw blockchain data can be difficult for developers to work with for a number of reasons.
- It is often stored in a proprietary format that is not easily accessible or readable by external systems or tools.
- It can be voluminous and complex, making it difficult to extract and analyze the specific information that is needed for a particular application or use case
- It may be distributed across multiple nodes in the blockchain network, requiring developers to devise complex strategies for accessing and integrating the data from multiple sources
BlockEden.xyz solves this by indexing blockchain data in real-time and presents the result to you with an analytics web portal and indexer GraphQL.
Analytics web portal
BlockEden.xyz Analytics is a metabase web portal for exploring and analyzing blockchain data. It allows users to easily query, visualize, and share data from Aptos and Sui blockchains.
Quick start
SQL examples
select date(timestamp) as date, count(*) as user_tx_count from user_transactions group by 1;
Aptos NFT swap volume last 14 days
SELECT date(inserted_at) AS date,
sum(((DATA #>> '{coin_amount}')::bigint / pow(10, 8))) AS coin_amount
FROM EVENTS
WHERE TYPE like '%::token_coin_swap::TokenSwapEvent'
AND inserted_at BETWEEN NOW() - INTERVAL '14 DAYS' AND NOW()
GROUP BY 1;
Indexer GraphQL
GraphQL is a query language and runtime for building APIs that allows clients to request and receive only the data they need, in a predictable and flexible format. It provides a way for clients to specify the shape of the data they need, and for the server to describe the data it can provide, enabling more efficient and flexible communication between the client and the server. GraphQL is often used as an alternative to REST APIs, and is particularly well-suited for modern, data-driven applications that need to be flexible and easily extended.
You may create an api key at the dashboard to get transaction, block, coin, NFT, and events data from our GraphQL API.
Indexer database schema
block_metadata_transactions
Field | Type | Description |
---|---|---|
version | Int8 | A version is the sequence id of a transaction. |
block_height | Int8 | height of the block where the transactions are recorded |
id | Varchar | identifier of the block |
round | Int8 | A round consists of achieving consensus on a block of transactions and their execution results. |
epoch | Int8 | An epoch is a fixed duration of time, currently defined as two hours on mainnet. |
previous_block_votes_bitvec | Jsonb | bitvector of previous block votes |
proposer | Varchar | address of the block proposer |
failed_proposer_indices | Jsonb | list of failed proposer indices |
timestamp | Timestamp | Timestamp is the machine timestamp of when the block is committed. |
inserted_at | Timestamp | inserted_at is when the row is inserted into the database. |
coin_activities
The coin_activities
table contains all the coin transfter activity history.
Field | Type | Description |
---|---|---|
transaction_version | Int8 | version of the transaction |
event_account_address | Varchar | account address where event is recorded |
event_creation_number | Int8 | block creation number of the event |
event_sequence_number | Int8 | unique identifier of the event |
owner_address | Varchar | address of the owner of the coin |
coin_type | Varchar | Coin type or symbol. Get all registered coin types. |
amount | Numeric | amount of the coin |
activity_type | Varchar | The type of the activity among 0x1::coin::DepositEvent , 0x1::aptos_coin::GasFeeEvent, 0x1::coin::WithdrawEvent |
is_gas_fee | Bool | indicates if the transaction is a gas fee or not |
is_transaction_success | Bool | indicates if the transaction is successful or not |
entry_function_id_str | Nullable<Varchar> | entry function identifier of the transaction |
block_height | Int8 | height of the block where the transaction is recorded |
transaction_timestamp | Timestamp | when is the transaction minted |
inserted_at | Timestamp | time when the transaction was inserted into the database |
Example
List 10 most recent USDC coin activities for deposits into a specific address after a date.
Query:
query CoinActivities($owner_address: String, $limit: Int, $offset: Int, $coin_type: String, $after_at: timestamp) {
coin_activities(
where: {owner_address: {_eq: $owner_address}, activity_type: {_eq: "0x1::coin::DepositEvent"}, coin_type: {_eq: $coin_type}, transaction_timestamp: {_gte: $after_at}}
order_by: {transaction_version: desc}
limit: $limit
offset: $offset
) {
inserted_at
activity_type
amount
block_height
coin_type
entry_function_id_str
event_account_address
event_creation_number
event_sequence_number
is_gas_fee
is_transaction_success
owner_address
transaction_timestamp
transaction_version
}
}
Variables:
{
"owner_address": "0x8304621d9c0f6f20b3b5d1bcf44def4ac5c8bf7c11a1ce80b53778532396312b",
"limit": 10,
"offset": 0,
"coin_type": "0x5e156f1207d0ebfa19a9eeff00d62a282278fb8719f4fab3a586a0a2c0fffbea::coin::T",
"after_at": "2021-01-07T19:15:58.268388"
}
coin_balances
Field | Type | Description |
---|---|---|
transaction_version | Int8 | version of the transaction |
owner_address | Varchar | address of the owner |
coin_type_hash | Varchar | hash of the coin type |
coin_type | Varchar | symbol or name of the coin type |
amount | Numeric | amount of the transaction |
transaction_timestamp | Timestamp | when the transaction was initiated |
inserted_at | Timestamp | when the row was inserted into the database |
coin_infos
Field | Type | Description |
---|---|---|
coin_type_hash | Varchar | Hash of the coin type metadata. |
coin_type | Varchar | The type or symbol of the coin. |
transaction_version_created | Int8 | Version of the transaction that created the coin type. |
creator_address | Varchar | The address of the transaction creator. |
name | Varchar | The name of the coin. |
symbol | Varchar | The symbol used to represent the coin. |
decimals | Int4 | The number of decimal places used to represent the coin value. |
transaction_created_timestamp | Timestamp | The timestamp of when the transaction was created. |
inserted_at | Timestamp | The timestamp of when the row was inserted into the database. |
supply_aggregator_table_handle | Nullable<Varchar> | Handle to the table that contains the supply aggregation data for the coin. |
supply_aggregator_table_key | Nullable<Text> | Key used to identify the supply aggregation data for the coin. |
coin_supply
Field | Type | Description |
---|---|---|
transaction_version | Int8 | Transaction version |
coin_type_hash | Varchar | Hash of the coin type |
coin_type | Varchar | Type of coin |
supply | Numeric | Total supply of the coin |
transaction_timestamp | Timestamp | Timestamp of the transaction |
transaction_epoch | Int8 | Epoch of the transaction |
inserted_at | Timestamp | Timestamp of when the data was inserted |
collection_datas
Field | Type | Description |
---|---|---|
collection_data_id_hash | Varchar | Hash of the collection data ID |
transaction_version | Int8 | Transaction version |
creator_address | Varchar | Address of the creator |
collection_name | Varchar | Name of the collection |
description | Text | Description of the collection |
metadata_uri | Varchar | URI of the metadata |
supply | Numeric | Total supply of the collection |
maximum | Numeric | Maximum supply of the collection |
maximum_mutable | Bool | Flag indicating if the maximum supply is mutable |
uri_mutable | Bool | Flag indicating if the metadata URI is mutable |
description_mutable | Bool | Flag indicating if the description is mutable |
inserted_at | Timestamp | Timestamp of when the data was inserted |
table_handle | Varchar | Handle of the table |
transaction_timestamp | Timestamp | Timestamp of the transaction |
current_ans_lookup
Field | Type | Description |
---|---|---|
domain | Varchar | Domain name |
subdomain | Varchar | Subdomain name |
registered_address | Nullable<Varchar> | Address that is registered |
expiration_timestamp | Timestamp | Timestamp of when the registration expires |
last_transaction_version | Int8 | Last transaction version |
inserted_at | Timestamp | Timestamp of when the data was inserted |
current_coin_balances
Field | Type | Description |
---|---|---|
owner_address | Varchar | Address of the owner |
coin_type_hash | Varchar | Hash of the coin type |
coin_type | Varchar | Type of coin |
amount | Numeric | Amount of coins |
last_transaction_version | Int8 | Last transaction version |
last_transaction_timestamp | Timestamp | Timestamp of the last transaction |
inserted_at | Timestamp | Timestamp of when the data was inserted |
current_collection_datas
Field | Type | Description |
---|---|---|
collection_data_id_hash | Varchar | Unique identifier of the collection |
creator_address | Varchar | Address of the creator of the collection |
collection_name | Varchar | Name of the collection |
description | Text | Description of the collection |
metadata_uri | Varchar | URI of the metadata of the collection |
supply | Numeric | Current supply of the collection |
maximum | Numeric | Maximum supply of the collection |
maximum_mutable | Bool | Indicates if the maximum supply can be changed |
uri_mutable | Bool | Indicates if the URI of the collection can be changed |
description_mutable | Bool | Indicates if the description of the collection can be changed |
last_transaction_version | Int8 | Version of the last transaction |
inserted_at | Timestamp | Timestamp of when the collection was created |
table_handle | Varchar | Handle of the table where the collection data is stored |
last_transaction_timestamp | Timestamp | Timestamp of the last transaction |
current_staking_pool_voter
Field | Type | Description |
---|---|---|
staking_pool_address | Varchar | Address of the staking pool |
voter_address | Varchar | Address of the voter |
last_transaction_version | Int8 | Version of the last transaction |
inserted_at | Timestamp | Timestamp of when the voting relationship was created |