Query snapshot of merklized state.
The state API provides an interface for serving queries against arbitrarily old snapshots of the state. This allows a full Merkle tree to be reconstructed from storage. However, if any parent state is missing then the partial snapshot can not be queried.
/hotshot-state//:height/:key
/hotshot-state/commit/:commit/:key
| key | Literal |
| commit | TaggedBase64 |
| height | Integer |
The endpoint offers two methods to query: by block height or by the tree’s commitment.
GET /:height/:key Retrieves the Merkle Path for the membership proof of a leaf based on the block height and entry index. Parameters: :height : The block height of the snapshot. :key : The index of the entry in the Merkle tree.
GET /commit/:commit/:key Retrieves the Merkle Path for the membership proof of a leaf based on the Merkle tree commitment. Parameters: :commit : The merkle tree commitment :key : The index of the entry in the Merkle tree.
/hotshot-state//block-height
The latest block height for which the merklized state is available.
Note that this may be less than the block height indicated by other APIs, such as status or node, since the merklized state storage is updated asynchronously.
/hotshot-state/proof/:height/:address
| address | Literal |
| height | Integer |
The endpoint returns the Merkle proof for a reward account at a given block height, where :address is the account address and :height is the block height. For protocol versions up to and including V3, the response is a RewardAccountQueryDataV1 type, which contains the account balance and a RewardAccountProofV1. This proof is derived from RewardMerkleTreeV1, which uses the SHA3 hashing algorithm. Starting from protocol version V4 and above, the endpoint returns a RewardAccountQueryDataV2 type, containing the balance and a RewardAccountProofV2. This proof is based on RewardMerkleTreeV2, which uses the Keccak256 hashing algorithm.
/hotshot-state/reward-claim-input/:height/:address
| height | Integer |
| address | Literal |
The endpoint returns all the function inputs required for a reward claim contract call, where :address is the account address and :height is the Espresso block height finalized in the Light Client contract. The response is a RewardClaimInput type with three fields: the lifetime rewards amount, the Merkle proof for the account, and the auth root inputs needed for the claimRewards function.
The Espresso block height must be the same value that is currently finalized in the Light Client contract on Ethereum. Clients should query the Light Client contracts finalizedState.blockHeight to obtain the :height value for this query.
/hotshot-state/reward-balance/:height/:address
| height | Integer |
| address | Literal |
Get balance in reward state at a specific height. Expected parameters are height which is an integer and an Ethereum address in hex format
/hotshot-state/reward-balance/latest/:address
| address | Literal |
Get current balance in reward state. Expected parameter is an Ethereum address in hex format.
Copyright © 2022 Espresso Systems. All rights reserved.