Herodotus Docs
Home
  • Introduction
  • FAQ
  • developers
    • Storage Proofs
      • Workflow
      • Workflow Examples
      • Accessing Block Hash
    • Storage Proof API
      • Interactive Docs
      • Step by step example
    • Turbo
      • Supported Networks
      • Turbo zksync demo
    • Data Processor
      • Why use HDP?
      • Getting Started
      • HDP Jargon
        • What is a Data Lake?
        • What is a Module?
        • Cairo1/Cairo0 Interoperability
      • Architecture
      • Additional Resources
    • Data Processor API
      • Program Registry API
      • Interactive Docs
    • Data Structure Indexer API
      • Interactive Docs
    • Supported Networks
    • Contract Addresses
    • API Status
  • Scaling Solutions
    • Integrity Verifier
  • Protocol Design
    • Architecture
      • Smart Contracts
      • OP Stack
    • Historical Block Hash Accumulator
      • Merkle Mountain Ranges
      • Initial Accumulation Event
    • Timestamp to Block Mapper
      • Edge Cases
  • Security
    • Audits
  • GitHub
  • Twitter
  • LinkedIn
  • Telegram
  • Media Kit
Powered by GitBook
On this page
  1. developers
  2. Storage Proofs

Workflow Examples

Storage Proof Workflow Examples

PreviousWorkflowNextAccessing Block Hash

Last updated 1 year ago

The Storage Proof Workflow will vary slightly depending on the data being proven and how a blockchain stores its data.

Below are simplified workflows for three scenarios: checking a transaction's nonce, finding out a user's token balance, and looking at receipt data.

Note: These workflows are simplified and based on the Ethereum blockchain. Other blockchains may have variations in their structure and requirements.

Additionally, these workflow examples focus on a single blockchain. When using proofs for cross-chain data access, or relevant root of the data origin chain is needed.

Step 1: Access the block hash.

  • Identify the block at which you want to confirm the user's token balance.

Step 2: Access the block header.

  • Retrieve the block header associated with the identified block hash to ensure its genuineness.

Step 3: Determine the Desired Root.

  • Extract the stateRoot from the block header. This represents the entire state of the blockchain at the time of that block.

Step 4: Verify the Token Contract Address Exists.

  • Utilize inclusion proofs to confirm the token contract's existence given the stateRoot.

Token Contract Address Verification: Before retrieving information from a token contract (e.g., ERC-20, ERC-721), it's essential to confirm that the contract address exists in the stateRoot. It ensures that you are looking at a genuine contract and not a fictitious or erroneous one.

Step 5: Determine the Storage Root.

  • From the verified token contract account, extract the storageRoot. This represents the storage of the contract's account at the time of that block.

Step 6: Verify the User's Address Exists.

  • Utilize inclusion proofs to confirm the user's address exists within the storageRoot.

User Address Verification within the Contract's Storage: Once you've verified the existence of the contract and moved on to the contract's storage (storageRoot), you need to ensure that the user address exists within that contract's storage. Especially in the case of token balances, this step is critical. If a user has never interacted with a token contract, their address might not exist in that contract's storage. Verifying the user address's presence ensures that the subsequent data retrieval (e.g., token balance) is accurate and relevant to the user in question.

Step 7: Verify the Token Balance Against the Storage Root.

  • Confirm the user’s token balance within the account storage trie.

Step 1: Access the block hash.

  • Identify the block associated with the receipt data you're trying to prove.

Step 2: Access the block header.

  • Retrieve the block header associated with the identified block hash to ensure its genuineness.

Step 3: Determine the Desired Root.

  • From the block header, extract the receiptsRoot. This represents a summary of all transaction outcomes (receipts) in the block.

Step 4: Verify the Receipt Data Against the Chosen Root.

  • Utilize inclusion proofs to validate the specific receipt data's presence within the receiptsRoot.

Step 1: Access the block hash.

  • Identify the block in which the transaction supposedly exists.

Step 2: Access the block header.

  • Retrieve the block header associated with the identified block hash to ensure its authenticity.

Step 3: Determine the Desired Root.

  • From the block header, extract the transactionsRoot. This represents a cryptographic summary of all transactions in the block.

Step 4: Prove the Transaction's Existence.

  • Utilize inclusion proofs to validate that the specific transaction exists within the transactionsRoot.

Step 5: Extract the Nonce from the Transaction.

  • Once the transaction's existence is proven, directly access and retrieve the nonce associated with that transaction.

access to a block hash
block hash accumulator
Retrieving Account Storage Data within an Ethereum Block
Retrieving Receipts Data within an Ethereum Block
Retrieving Transaction Nonce within an Ethereum Block