Skip to main content

accountsesdthistory

This page describes the structure of the accounts-esdt-history index (Elasticsearch), and also depicts a few examples of how to query it.

_id

The _id field of this index is composed in this way: {bech32address}_{tokenIdentifier}_{nonce}_{timestamp} (example: erd.._abcd-0123-01).

Fields

FieldDescription
addressThe address field holds the address in bech32 encoding.
balanceThe balance field holds the amount of ESDT tokens the address possesses.
tokenThe token field holds the token name of the token.
identifierThe identifier field is composed of the token field and the nonce field, hex encoded.
tokenNonceThe tokenNonce field holds the sequence number of the token. This field can be empty in the case of FungibleESDT.
timestampThe timestamp field represents the timestamp when the address balance was changed.
isSmartContractThe isSmartContract field is true if the address is a smart contract address.
shardIDThe shardID field represents the shard of the account.

Query examples

Fetch the latest 10 entries of an address' tokens sorted by timestamp

curl --request GET \
--url ${ES_URL}/accountsesdthistory/_search \
--header 'Content-Type: application/json' \
--data '{
"query": {
"bool": {
"must": [
{
"match": {
"identifier": {
"query": "MY-TOKEN-aaabbb",
"operator": "AND"
}
}
},
{
"match": {
"address": "erd..."
}
}
]
}
},
"sort": [
{
"timestamp": {
"order": "desc"
}
}
],
"size":10
}'