State API
Serves consensus state derived from finalized blocks
All state derived from block data is represented in the form of Merkle trees or Merkle tries, so this API is able to provide select segments of the state with a proof that will convince the client that the returned segment is accurate, as long as they know the corresponding state commitment (part of each block header).
Endpoints
GET /fee-state
/fee-stateGet a Merkle proof proving the balance of a certain fee account in a given snapshot of the state. The element in the returned Merkle proof contains the balance of the requested account, or null if the account has no balance.
Paths
/fee-state/:height/:account/fee-state/commit/:commit/:account
Parameters
height
integer
Block height of the state snapshot to read from
commit
tagged<MERKLE_COMM>
Commitment of the state snapshot to read from
account
hex
Fee account to look up
Returns MerkleProof
MerkleProofGET /fee-state/block-height
/fee-state/block-heightThe latest block height for which fee state is available.
Note that this may be less than the block height indicated by other APIs, such as status or node, since the fee state storage is updated asynchronously.
Returns integer
integerGET /fee-state/fee-balance/latest/:account
/fee-state/fee-balance/latest/:accountConvenience endpoint to get the current balance of an account from a trusted node.
account
hex
Fee account to look up
Returns the balance as a plain integer, without proof.
GET /block-state
/block-stateGet a Merkle proof proving the inclusion of a certain block at a position in the history. The element in the returned Merkle proof contains the commitment of the block at the requested position in history.
Paths
/block-state/:height/:index/block-state/commit/:commit/:index
Parameters
height
integer
Block height of the state snapshot to read from
commit
tagged<MERKLE_COMM>
Commitment of the state snapshot to read from
index
integer
Height of the block to look up
Returns MerkleProof
MerkleProofGET /block-state/block-height
/block-state/block-heightThe latest block height for which block state is available.
Note that this may be less than the block height indicated by other APIs, such as status or node, since the block state storage is updated asynchronously.
Returns integer
integerReward State
The reward state API has two versions:
Protocol V3: Uses reward state v1 with SHA3 hashing (
RewardMerkleTreeV1)Protocol V4+: Uses reward state v2 with Keccak256 hashing (
RewardMerkleTreeV2)
GET /reward-state
/reward-stateGet a Merkle proof proving the balance of a certain reward account in a given snapshot of the state. The element in the returned Merkle proof contains the balance of the requested account, or null if the account has no balance.
This endpoint returns a V1 Merkle tree proof.
Paths
/reward-state/:height/:account/reward-state/commit/:commit/:account
Parameters
height
integer
Block height of the state snapshot to read from
commit
tagged<MERKLE_COMM>
Commitment of the state snapshot to read from
account
hex
Reward account to look up
Returns MerkleProof
MerkleProofGET /reward-state/block-height
/reward-state/block-heightThe latest block height for which reward state is available.
Note that this may be less than the block height indicated by other APIs, such as status or node, since the reward state storage is updated asynchronously.
Returns integer
integerGET /reward-state/proof/:height/:address
/reward-state/proof/:height/:addressGet the Merkle proof for a reward account at a given block height. Returns a RewardAccountQueryDataV1 type, containing the balance and a RewardAccountProofV1. This proof is based on RewardMerkleTreeV1, which uses the SHA3 hashing algorithm.
Parameters
height
integer
Block height to get proof for
address
hex
Account address to get proof for
Returns RewardAccountQueryDataV1
RewardAccountQueryDataV1{
"balance": "0x...",
"proof": {
"account": "0x...",
"proof": { /* merkle proof */ }
}
}RewardAccountQueryDataV1 fields:
balance
U256
The reward account balance
proof
RewardAccountProofV1
Merkle proof for the account
RewardAccountProofV1 fields:
account
Address
The reward account address
proof
RewardMerkleProofV1
Merkle proof using SHA3 hashing
Reward State V2
Reward state v2 is used by consensus protocol V4 and above which uses Keccak256 based Merkle proofs for improved compatibility with Ethereum smart contracts.
GET /reward-state-v2
/reward-state-v2Get a Merkle proof proving the balance of a certain reward account in a given snapshot of the state. The element in the returned Merkle proof contains the balance of the requested account, or null if the account has no balance.
Paths
/reward-state-v2/:height/:account/reward-state-v2/commit/:commit/:account
Parameters
height
integer
Block height of the state snapshot to read from
commit
tagged<MERKLE_COMM>
Commitment of the state snapshot to read from
account
hex
Reward account to look up
Returns MerkleProof
MerkleProofGET /reward-state-v2/block-height
/reward-state-v2/block-heightThe latest block height for which reward state v2 is available.
Note that this may be less than the block height indicated by other APIs, such as status or node, since the reward state storage is updated asynchronously.
Returns integer
integerGET /reward-state-v2/reward-balance/latest/:address
/reward-state-v2/reward-balance/latest/:addressGet current balance in reward state.
Parameters
address
hex
Ethereum address in hex format
Returns
The current reward balance as an integer.
GET /reward-state-v2/reward-balance/:height/:address
/reward-state-v2/reward-balance/:height/:addressGet balance in reward state at a specific height.
Parameters
height
integer
Block height to query
address
hex
Ethereum address in hex format
Returns
The reward balance at the specified height as an integer.
GET /reward-state-v2/proof/:height/:address
/reward-state-v2/proof/:height/:addressGet the Merkle proof for a reward account at a given block height. Returns a RewardAccountQueryDataV2 type, containing the balance and a RewardAccountProofV2. This proof is based on RewardMerkleTreeV2, which uses the Keccak256 hashing algorithm.
Parameters
height
integer
Block height of proof for
address
hex
Account address to get proof for
Returns RewardAccountQueryDataV2
RewardAccountQueryDataV2{
"balance": "0x...",
"proof": {
"account": "0x...",
"proof": {
"Presence": { /* membership proof */ }
}
}
}RewardAccountQueryDataV2 fields:
balance
U256
The reward account balance
proof
RewardAccountProofV2
Merkle proof for the account
RewardAccountProofV2 fields:
account
Address
The reward account address
proof
RewardMerkleProofV2
Merkle proof
RewardMerkleProofV2 is an enum with two variants:
Presence: Merkle proof demonstrating account membership in the treeAbsence: Merkle proof demonstrating account non-membership in the tree
GET /reward-state-v2/reward-claim-input/:height/:address
/reward-state-v2/reward-claim-input/:height/:addressGet the reward claim input data formatted for use with Solidity reward claim contracts. This endpoint is only available for consensus protocol V4+.
Parameters
height
integer
Espresso block height (must match Light Client finalized height)
address
hex
Account address to generate claim input for
Returns RewardClaimInput
RewardClaimInput{
"lifetime_rewards": "0x...",
"auth_data": {
// Authentication data including Merkle proof
}
}lifetime_rewards
U256
Total lifetime rewards for the account
auth_data
RewardAuthData
Merkle proof and authentication data for on-chain verification
The
heightparameter must match the finalized block height in the Light Client contractReturns error if the account has zero rewards
The returned data is formatted to be passed directly to reward claim contract functions
Error
ZeroRewardError: Account has no rewards to claimConversion Error: Failed to convert proof to claim input format
Last updated

