Skip to main content
HDP exposes four capability groups in your Cairo module:
  • hdp.evm for EVM data
  • hdp.starknet for Starknet data
  • hdp.injected_state for injected trie state
  • hdp.unconstrained helpers for unconstrained reads
It also exposes execute_eth_call for provable EVM contract calls at a chosen historical block.

HDP object in your module

pub struct HDP {
    pub evm: EvmMemorizer,
    pub starknet: StarknetMemorizer,
    pub injected_state: InjectedStateMemorizer,
    pub unconstrained: UnconstrainedMemorizer,
}

1) hdp.evm (EVM memorizer)

Reads verified EVM data for a specific (chain_id, block_number, ...) key. Chain constants:
  • ETHEREUM_MAINNET_CHAIN_ID
  • ETHEREUM_TESTNET_CHAIN_ID
  • OPTIMISM_MAINNET_CHAIN_ID
  • OPTIMISM_TESTNET_CHAIN_ID

Header fields

Input key for all methods below: HeaderKey { chain_id, block_number }
APIOutputWhat it gives you
header_get_parentu256Parent block hash of the block header
header_get_uncleu256Uncle/ommer hash field from the header
header_get_coinbaseu256Block proposer (beneficiary) address
header_get_state_rootu256Global EVM state root for that block
header_get_transaction_rootu256Transaction trie root for that block
header_get_receipt_rootu256Receipt trie root for that block
header_get_bloomByteArrayHeader bloom filter for event prefiltering
header_get_difficultyu256Block difficulty field
header_get_numberu256Block number from the header
header_get_gas_limitu256Block gas limit
header_get_gas_usedu256Total gas used in that block
header_get_timestampu256Block timestamp
header_get_mix_hashu256Header mix hash field
header_get_nonceu256Header nonce field
header_get_base_fee_per_gasu256EIP-1559 base fee for the block
header_get_blob_gas_usedu256Blob gas used (EIP-4844 field)
header_get_excess_blob_gasu256Excess blob gas (EIP-4844 field)
header_get_requests_hashu256Requests hash field from the header

Account fields

Input key for all methods below: AccountKey { chain_id, block_number, address }
APIOutputWhat it gives you
account_get_nonceu256Account nonce at the selected block
account_get_balanceu256Account ETH balance at the selected block
account_get_state_rootu256Account storage root
account_get_code_hashu256Account bytecode hash

Storage

APIInputOutputWhat it gives you
storage_get_slotStorageKey { chain_id, block_number, address, storage_slot }u256Value of a specific storage slot for a contract at that block

Block transactions

Input key for all methods below: BlockTxKey { chain_id, block_number, transaction_index }
APIOutputWhat it gives you
block_tx_get_nonceu256Nonce of a transaction by block/index
block_tx_get_gas_priceu256Legacy gas price of the transaction
block_tx_get_gas_limitu256Gas limit set on the transaction
block_tx_get_receiveru256Recipient address (to)
block_tx_get_valueu256Native token value transferred
block_tx_get_vu256Signature v component
block_tx_get_ru256Signature r component
block_tx_get_su256Signature s component
block_tx_get_chain_idu256Transaction chain id
block_tx_get_max_fee_per_gasu256EIP-1559 max fee per gas
block_tx_get_max_priority_fee_per_gasu256EIP-1559 priority fee
block_tx_get_max_fee_per_blob_gasu256EIP-4844 max fee per blob gas
block_tx_get_tx_typeu256Transaction type
block_tx_get_senderu256Sender address (from)
block_tx_get_hashu256Transaction hash

Block receipts

Input key for all methods below: BlockReceiptKey { chain_id, block_number, transaction_index }
APIOutputWhat it gives you
block_receipt_get_statusu256Execution status of a transaction receipt
block_receipt_get_cumulative_gas_usedu256Cumulative gas used at this receipt index
block_receipt_get_bloomByteArrayReceipt bloom for event filtering

Logs

Input key for all methods below: LogKey { chain_id, block_number, transaction_index, log_index }
APIOutputWhat it gives you
log_get_addressu256Contract address that emitted the log
log_get_topic0u256First topic (usually event signature hash)
log_get_topic1u256Second indexed topic
log_get_topic2u256Third indexed topic
log_get_topic3u256Fourth indexed topic
log_get_topic4u256Fifth topic when present
log_get_dataArray<u128>Unindexed event data payload

2) hdp.starknet (Starknet memorizer)

Reads verified Starknet data for a specific (chain_id, block_number, ...) key. Chain constants:
  • STARKNET_MAINNET_CHAIN_ID
  • STARKNET_TESTNET_CHAIN_ID

Header fields

Input key for all methods below: HeaderKey { chain_id, block_number }
APIOutputWhat it gives you
header_get_block_numberfelt252Starknet block number
header_get_state_rootfelt252Global Starknet state root
header_get_sequencer_addressfelt252Sequencer address for that block
header_get_block_timestampfelt252Block timestamp
header_get_transaction_countfelt252Number of transactions in the block
header_get_transaction_commitmentfelt252Transaction commitment value
header_get_event_countfelt252Number of events in the block
header_get_event_commitmentfelt252Event commitment value
header_get_parent_block_hashfelt252Parent block hash
header_get_state_diff_commitmentfelt252State diff commitment
header_get_state_diff_lengthfelt252State diff length
header_get_l1_gas_price_in_weifelt252L1 gas price (wei unit field)
header_get_l1_gas_price_in_frifelt252L1 gas price (fri unit field)
header_get_l1_data_gas_price_in_weifelt252L1 data gas price (wei unit field)
header_get_l1_data_gas_price_in_frifelt252L1 data gas price (fri unit field)
header_get_receipts_commitmentfelt252Receipts commitment value
header_get_l1_data_modefelt252L1 data availability mode field
header_get_protocol_versionfelt252Protocol version field

Storage

APIInputOutputWhat it gives you
storage_get_slotStorageKey { chain_id, block_number, address, storage_slot }felt252Value of a specific Starknet storage slot at that block

3) hdp.injected_state (InjectedState memorizer)

Works with labeled trie-like injected state you provide for a run.
APIInputOutputWhat it gives you
read_injected_state_trie_root(label)label: felt252Option<felt252>Current root for the labeled injected trie
read_key(label, key)label: felt252, key: felt252Option<felt252>Value for a key in the labeled injected trie
write_key(label, key, value)label: felt252, key: felt252, value: felt252felt252Writes a value and returns the updated trie root

4) hdp.unconstrained / unconstrained helpers

APIInputOutputWhat it gives you
evm_account_get_bytecode(key)AccountKey { chain_id, block_number, address }ByteCodeContract bytecode for an EVM account at a chosen block

5) execute_eth_call (provable EVM call)

execute_eth_call lets you perform a provable EVM contract call at a chosen historical block.
ItemWhat it means
Input HDPAccess to HDP-backed verified chain state
Input TimeAndSpace { chain_id, block_number }Selects which chain and historical block to execute against
Input senderCaller address context for the call
Input targetContract being called
Input calldataABI-encoded function selector + arguments
Output successWhether the call execution succeeded
Output return_dataRaw return bytes from the contract
Output gas_usedGas consumed by the call execution
Output statePost-call execution state object
See the dedicated page for details and patterns: