evm_api.block
evm_api.block.get_block()
Get the contents of a block given the block hash.
from moralis import evm_api
api_key = "YOUR_API_KEY"
params = {
"block_number_or_hash": "15863321",
"chain": "eth",
"include": "",
}
result = evm_api.block.get_block(
api_key=api_key,
params=params,
)
print(result)
Name | Type | Description | Required | Default | Example |
---|---|---|---|---|---|
block_number_or_hash | str | The block number or block hash | Yes | “15863321” | |
chain | enum[str]: - “eth” - “0x1” - “goerli” - “0x5” - “sepolia” - “0xaa36a7” - “polygon” - “0x89” - “mumbai” - “0x13881” - “bsc” - “0x38” - “bsc testnet” - “0x61” - “avalanche” - “0xa86a” - “fantom” - “0xfa” - “palm” - “0x2a15c308d” - “cronos” - “0x19” - “arbitrum” - “0xa4b1” - “chiliz” - “0x15b38” - “chiliz testnet” - “0x15b32” - “gnosis” - “0x64” - “gnosis testnet” - “0x27d8” - “base” - “0x2105” - “base testnet” - “0x14a33” - “optimism” - “0xa” |
The chain to query | “eth” | “eth” | |
include | enum[str]: - “internal_transactions” |
If the result should contain the internal transactions. | ”” | ”” |
evm_api.block.get_block_stats()
Get the stats for a block
from moralis import evm_api
api_key = "YOUR_API_KEY"
params = {
"block_number_or_hash": "",
"chain": "eth",
}
result = evm_api.block.get_block_stats(
api_key=api_key,
params=params,
)
print(result)
Name | Type | Description | Required | Default | Example |
---|---|---|---|---|---|
block_number_or_hash | str | The block number or hash | Yes | ”” | |
chain | enum[str]: - “eth” - “0x1” - “goerli” - “0x5” - “sepolia” - “0xaa36a7” - “polygon” - “0x89” - “mumbai” - “0x13881” - “bsc” - “0x38” - “bsc testnet” - “0x61” - “avalanche” - “0xa86a” - “fantom” - “0xfa” - “palm” - “0x2a15c308d” - “cronos” - “0x19” - “arbitrum” - “0xa4b1” - “chiliz” - “0x15b38” - “chiliz testnet” - “0x15b32” - “gnosis” - “0x64” - “gnosis testnet” - “0x27d8” - “base” - “0x2105” - “base testnet” - “0x14a33” - “optimism” - “0xa” |
The chain to query | “eth” | “eth” |
evm_api.block.get_date_to_block()
Get the closest block given the date.
from moralis import evm_api
api_key = "YOUR_API_KEY"
params = {
"date": "",
"chain": "eth",
}
result = evm_api.block.get_date_to_block(
api_key=api_key,
params=params,
)
print(result)
Name | Type | Description | Required | Default | Example |
---|---|---|---|---|---|
date | str | Unix date in milliseconds or a datestring (any format that is accepted by momentjs) | Yes | ”” | |
chain | enum[str]: - “eth” - “0x1” - “goerli” - “0x5” - “sepolia” - “0xaa36a7” - “polygon” - “0x89” - “mumbai” - “0x13881” - “bsc” - “0x38” - “bsc testnet” - “0x61” - “avalanche” - “0xa86a” - “fantom” - “0xfa” - “palm” - “0x2a15c308d” - “cronos” - “0x19” - “arbitrum” - “0xa4b1” - “chiliz” - “0x15b38” - “chiliz testnet” - “0x15b32” - “gnosis” - “0x64” - “gnosis testnet” - “0x27d8” - “base” - “0x2105” - “base testnet” - “0x14a33” - “optimism” - “0xa” |
The chain to query | “eth” | “eth” |