Block header fields

For accessing block header data, Satellite contract has following functions:
  • headerField(uint256 chainId, uint256 blockNumber, BlockHeaderField field) returns (bytes32)
  • headerFieldSafe(uint256 chainId, uint256 blockNumber, BlockHeaderField field) returns (bool, bytes32)
where BlockHeaderField is an enum with following values:
  • PARENT_HASH (0)
  • OMMERS_HASH (1)
  • BENEFICIARY (2)
  • STATE_ROOT (3)
  • TRANSACTIONS_ROOT (4)
  • RECEIPTS_ROOT (5)
  • DIFFICULTY (7)
  • GAS_LIMIT (9)
  • GAS_USED (10)
  • TIMESTAMP (11)
  • EXTRA_DATA (12)
  • MIX_HASH (13)
  • NONCE (14)
LOGS_BLOOM (6) is currently not supported. NUMBER (8) is not stored and cannot be accessed, because all block data is accessed via its number, so there is no need to store or access it.

Account fields

To read account fields, you can use one of the following functions:
  • accountField(uint256 chainId, uint256 blockNumber, address account, AccountField field) returns (bytes32)
  • accountFieldSafe(uint256 chainId, uint256 blockNumber, address account, AccountField field) returns (bool, bytes32)
where AccountField is an enum with following values:
  • NONCE (0)
  • BALANCE (1)
  • STORAGE_ROOT (2)
  • CODE_HASH (3)
There are also additional fields that are ApeChain (or Curtis) specific:
  • APE_FLAGS (4)
  • APE_FIXED (5)
  • APE_SHARES (6)
  • APE_DEBT (7)
  • APE_DELEGATE (8)

Block by timestamp

You can also find closest block given the timestamp. For this, you can use one of the following functions:
  • timestamp(uint256 chainId, uint256 timestamp) returns (uint256)
  • timestampSafe(uint256 chainId, uint256 timestamp) returns (bool, uint256)
They return largest block number that has timestamp less than or equal to the given timestamp. This means that asking for timestamp that is less than timestamp of genesis block is not possible. Also, if you ask for timestamp that doesn’t match any block exactly, it will return block with smaller timestamp from two closest blocks. In case you are using blockchain that can produce more than one block per second and you ask for timestamp that matches multiple blocks, it will return the block with the largest timestamp.

Storage slot values

To read storage slot value, you can use one of the following functions:
  • storageSlotSafe(uint256 chainId, uint256 blockNumber, address account, bytes32 slot) returns (bool, bytes32)
  • storageSlot(uint256 chainId, uint256 blockNumber, address account, bytes32 slot) returns (bytes32)

Read functions

All of functions above are designed in the same way. They read data that was already proven by the API. Functions that end with Safe suffix return (bool, bytes32) tuple, where first value is true if the data was found and false otherwise. Functions that do not end with Safe suffix return bytes32 value and revert if the data was not found.

ApeChain specific functions

On ApeChain (and Curtis) there are also additional functions that calculate Share Price for the given block:
  • getApechainSharePriceSafe(uint256 chainId, uint256 blockNumber) returns (bool, uint256)
  • getApechainSharePrice(uint256 chainId, uint256 blockNumber) returns (uint256)