For the complete documentation index, see llms.txt. This page is also available as Markdown.

Workflow Examples

Storage Proof Workflow Examples

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.

Retrieving Account Storage Data within an Ethereum Block

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.

Retrieving Receipts Data within an Ethereum Block

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.

Retrieving Transaction Nonce within an Ethereum Block

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.

Last updated