|
| 1 | +--- |
| 2 | +id: es-index-executionresults |
| 3 | +title: execution results |
| 4 | +description: "Elasticsearch executionresults index: execution result block hash, header fields and example queries." |
| 5 | +--- |
| 6 | + |
| 7 | +[comment]: # (mx-abstract) |
| 8 | + |
| 9 | +This page describes the structure of the `executionresults` index (Elasticsearch), and also depicts a few examples of how to query it. |
| 10 | + |
| 11 | +[comment]: # (mx-context-auto) |
| 12 | + |
| 13 | +## _id |
| 14 | + |
| 15 | +The _id field of this index is the block hash associated with the execution result, in a hexadecimal encoding. |
| 16 | + |
| 17 | +[comment]: # (mx-context-auto) |
| 18 | + |
| 19 | +## Fields |
| 20 | + |
| 21 | +[comment]: # (table:blocks) |
| 22 | + |
| 23 | +| Field | Description | |
| 24 | +|----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| 25 | +| nonce | The nonce field represents the sequence number of the block (block height) associated with the execution result. | |
| 26 | +| round | The round field represents the round of the block associated with the execution result. | |
| 27 | +| epoch | The epoch field represents the epoch of the block associated with the execution result. | |
| 28 | +| miniBlocksHashes | The miniBlocksHashes field contains an array of the miniblock hashes (hexadecimal encoded) that were included in the block. | |
| 29 | +| miniBlocksDetails | The miniBlocksDetails field contains an array of structures indicating processing details of the miniblocks, such as the index of the first processed transaction. | |
| 30 | +| timestampMs | The timestampMs field represents the timestamp of the block associated with the execution result. | |
| 31 | +| rootHash | The rootHash field represents the trie's state root hash when of the block associated with the execution result. | |
| 32 | +| shardId | The shardId field represents the shard this block belongs to. | |
| 33 | +| txCount | The txCount field represents the number of transactions from the block associated with the execution result. | |
| 34 | +| gasUsed | The gasUsed field represents the total gas that was used in the block associated with the execution result. | |
| 35 | +| accumulatedFees | The accumulatedFees field represents the accumulated fees that were paid in the block associated with the execution result. | |
| 36 | +| developerFees | The developerFees field represents the developer fees that were accumulated in the block. | |
| 37 | +| epochStartInfo | The epochStartInfo field is a structure that contains economic data, such as total supply. | |
| 38 | +| notarizedInBlockHash | The notarizedInBlockHash field represents the hash of the block in which the execution result was notarized. | |
| 39 | + |
| 40 | +[comment]: # (mx-context-auto) |
| 41 | + |
| 42 | +### Fetch blocks for a shard |
| 43 | +In order to fetch the latest execution results from a shard, one has to do a query that matches the field `shardId`. |
| 44 | +``` |
| 45 | +curl --request GET \ |
| 46 | + --url ${ES_URL}/executionresults/_search \ |
| 47 | + --header 'Content-Type: application/json' \ |
| 48 | + --data '{ |
| 49 | + "query": { |
| 50 | + "match": { |
| 51 | + "shardId": "1" |
| 52 | + } |
| 53 | + }, |
| 54 | + "sort": [ |
| 55 | + { |
| 56 | + "timestamp": { |
| 57 | + "order": "desc" |
| 58 | + } |
| 59 | + } |
| 60 | + ] |
| 61 | +}' |
| 62 | +``` |
| 63 | + |
| 64 | +### Fetch the latest 10 execution results for all shards |
| 65 | + |
| 66 | +``` |
| 67 | +curl --request GET \ |
| 68 | + --url ${ES_URL}/executionresults/_search \ |
| 69 | + --header 'Content-Type: application/json' \ |
| 70 | + --data '{ |
| 71 | + "sort": [ |
| 72 | + { |
| 73 | + "timestamp": { |
| 74 | + "order": "desc" |
| 75 | + } |
| 76 | + } |
| 77 | + ], |
| 78 | + "size":10 |
| 79 | +}' |
| 80 | +``` |
0 commit comments