Skip to main content
Version: 2.2

Get block by height

GEThttps://mainnet-aptos-api.moralis.io/blocks/:block_height

Get block by specific block height.

PATH PARAMS
block_heightnumberrequired
Block height to lookup. Starts at 0
QUERY PARAMS
with_transactionsboolean
If set to true, include all transactions in the block
Responses
API KEY
import Moralis from 'moralis';

try {
await Moralis.start({
apiKey: "YOUR_API_KEY"
});

const response = await Moralis.AptosApi.blocks.getBlockByHeight({
"network": "mainnet"
});

console.log(response);
} catch (e) {
console.error(e);
}
Response Example
{
"block_height": "32425224034",
"block_hash": "32425224034",
"block_timestamp": "32425224034",
"first_version": "32425224034",
"last_version": "32425224034",
"transactions": [
{
"hash": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"sender": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"sequence_number": "32425224034",
"max_gas_amount": "32425224034",
"gas_unit_price": "32425224034",
"expiration_timestamp_secs": "32425224034"
},
{
"type": "",
"version": "32425224034",
"hash": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"state_change_hash": "",
"event_root_hash": "",
"state_checkpoint_hash": "",
"gas_used": "32425224034",
"success": true,
"vm_status": "",
"accumulator_root_hash": "",
"changes": [
{
"type": "delete_module",
"address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"state_key_hash": ""
},
{
"type": "delete_module",
"address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"state_key_hash": ""
},
{
"type": "delete_module",
"state_key_hash": "",
"data": {
"key": "",
"key_type": ""
}
},
{
"type": "delete_module",
"address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"state_key_hash": "",
"data": {
"bytecode": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"abi": {
"address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"name": "",
"exposed_functions": [
{
"name": "",
"visibility": "private",
"is_entry": true
}
],
"structs": [
{
"name": "",
"is_native": true,
"fields": [
{
"name": "sender",
"type": "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>"
}
]
}
]
}
}
},
{
"type": "delete_module",
"address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"state_key_hash": "",
"data": {
"type": "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>"
}
},
{
"type": "delete_module",
"state_key_hash": "",
"handle": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"key": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"value": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"data": {
"key": "",
"key_type": "",
"value": "",
"value_type": ""
}
}
],
"sender": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"sequence_number": "32425224034",
"max_gas_amount": "32425224034",
"gas_unit_price": "32425224034",
"expiration_timestamp_secs": "32425224034",
"events": [
{
"guid": {
"creation_number": "32425224034",
"account_address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1"
},
"sequence_number": "32425224034",
"type": "0x1::account::Account"
}
],
"timestamp": "32425224034"
},
{
"type": "genesis_transaction",
"version": "32425224034",
"hash": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"state_change_hash": "",
"event_root_hash": "",
"state_checkpoint_hash": "",
"gas_used": "32425224034",
"success": true,
"vm_status": "",
"accumulator_root_hash": "",
"changes": [
{
"type": "delete_module",
"address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"state_key_hash": ""
},
{
"type": "delete_module",
"address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"state_key_hash": ""
},
{
"type": "delete_module",
"state_key_hash": "",
"data": {
"key": "",
"key_type": ""
}
},
{
"type": "delete_module",
"address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"state_key_hash": "",
"data": {
"bytecode": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"abi": {
"address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"name": "",
"exposed_functions": [
{
"name": "",
"visibility": "private",
"is_entry": true
}
],
"structs": [
{
"name": "",
"is_native": true,
"fields": [
{
"name": "sender",
"type": "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>"
}
]
}
]
}
}
},
{
"type": "delete_module",
"address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"state_key_hash": "",
"data": {
"type": "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>"
}
},
{
"type": "delete_module",
"state_key_hash": "",
"handle": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"key": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"value": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"data": {
"key": "",
"key_type": "",
"value": "",
"value_type": ""
}
}
],
"events": [
{
"guid": {
"creation_number": "32425224034",
"account_address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1"
},
"sequence_number": "32425224034",
"type": "0x1::account::Account"
}
]
},
{
"type": "block_metadata_transaction",
"version": "32425224034",
"hash": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"state_change_hash": "",
"event_root_hash": "",
"state_checkpoint_hash": "",
"gas_used": "32425224034",
"success": true,
"vm_status": "",
"accumulator_root_hash": "",
"changes": [
{
"type": "delete_module",
"address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"state_key_hash": ""
},
{
"type": "delete_module",
"address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"state_key_hash": ""
},
{
"type": "delete_module",
"state_key_hash": "",
"data": {
"key": "",
"key_type": ""
}
},
{
"type": "delete_module",
"address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"state_key_hash": "",
"data": {
"bytecode": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"abi": {
"address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"name": "",
"exposed_functions": [
{
"name": "",
"visibility": "private",
"is_entry": true
}
],
"structs": [
{
"name": "",
"is_native": true,
"fields": [
{
"name": "sender",
"type": "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>"
}
]
}
]
}
}
},
{
"type": "delete_module",
"address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"state_key_hash": "",
"data": {
"type": "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>"
}
},
{
"type": "delete_module",
"state_key_hash": "",
"handle": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"key": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"value": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"data": {
"key": "",
"key_type": "",
"value": "",
"value_type": ""
}
}
],
"id": "",
"epoch": "32425224034",
"round": "32425224034",
"events": [
{
"guid": {
"creation_number": "32425224034",
"account_address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1"
},
"sequence_number": "32425224034",
"type": "0x1::account::Account"
}
],
"proposer": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"timestamp": "32425224034"
},
{
"type": "state_checkpoint_transaction",
"version": "32425224034",
"hash": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"state_change_hash": "",
"event_root_hash": "",
"state_checkpoint_hash": "",
"gas_used": "32425224034",
"success": true,
"vm_status": "",
"accumulator_root_hash": "",
"changes": [
{
"type": "delete_module",
"address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"state_key_hash": ""
},
{
"type": "delete_module",
"address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"state_key_hash": ""
},
{
"type": "delete_module",
"state_key_hash": "",
"data": {
"key": "",
"key_type": ""
}
},
{
"type": "delete_module",
"address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"state_key_hash": "",
"data": {
"bytecode": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"abi": {
"address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"name": "",
"exposed_functions": [
{
"name": "",
"visibility": "private",
"is_entry": true
}
],
"structs": [
{
"name": "",
"is_native": true,
"fields": [
{
"name": "sender",
"type": "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>"
}
]
}
]
}
}
},
{
"type": "delete_module",
"address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"state_key_hash": "",
"data": {
"type": "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>"
}
},
{
"type": "delete_module",
"state_key_hash": "",
"handle": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"key": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"value": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"data": {
"key": "",
"key_type": "",
"value": "",
"value_type": ""
}
}
],
"timestamp": "32425224034"
}
]
}