Skip to main content

logs

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

_id

The _id field for this index is composed of hex-encoded hash of the transaction of the smart contract result that generated the log.

Fields

FieldDescription
addressThe address field holds the address in bech32 encoding. It can be the address of the smart contract that generated the log or the address of the receiver address of the transaction.
eventsThe events field holds a list of events.
originalTxHashThe originalTxHash field holds the hex-encoded hash of the initial transaction. When this field is not empty the log is generated by a smart contract result and this field represents the hash of the initial transaction.
timestampThe timestamp field represents the timestamp of the block in which the log was generated.

Event structure

FieldDescription
identifierThis field represents the identifier of the event.
addressThe address field holds the address in bech32 encoding. It can be the address of the smart contract that generated the event or the address of the receiver address of the transaction.
topicsThe topics field holds a list with extra information. They don't have a specific order because the smart contract is free to log anything that could be helpful.
dataThe data field can contain information added by the smart contract that generated the event.
orderThe order field represents the index of the event indicating the execution order.

Query examples

Fetch all the logs generated by a transaction

curl --request GET \
--url ${ES_URL}/logs/_search \
--header 'Content-Type: application/json' \
--data '{
"query": {
"match": {
"_id":"d6.."
}
}
}'

Fetch all the logs generated by a transaction and the smart contract results triggered by it

curl --request GET \
--url ${ES_URL}/logs/_search \
--header 'Content-Type: application/json' \
--data '{
"query": {
"bool": {
"should": [
{
"match": {
"_id":"d6.."
}
},
{
"match": {
"originalTxHash": "d6.."
}
}
]
}
}
}'