Espresso Systems Logo

reward-state-v2 API 0.0.1 Reference

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.

GET get_reward_claim_input

Routes

/hotshot-state/reward-claim-input/:height/:address

Parameters

addressLiteral
heightInteger

Description

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.

GET get_reward_balance

Routes

/hotshot-state/reward-balance/:height/:address

Parameters

addressLiteral
heightInteger

Description

Get balance in reward state at a specific height. Expected parameters are height which is an integer and an Ethereum address in hex format

GET get_reward_account_proof

Routes

/hotshot-state/proof/:height/:address

Parameters

heightInteger
addressLiteral

Description

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.

GET get_height

Routes

/hotshot-state//block-height

Parameters

None

Description

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.

GET get_path

Routes

/hotshot-state//:height/:key

/hotshot-state/commit/:commit/:key

Parameters

heightInteger
keyLiteral
commitTaggedBase64

Description

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.

GET get_latest_reward_balance

Routes

/hotshot-state/reward-balance/latest/:address

Parameters

addressLiteral

Description

Get current balance in reward state. Expected parameter is an Ethereum address in hex format.

 

Copyright © 2022 Espresso Systems. All rights reserved.