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.

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, access to a block hash or relevant block hash accumulator 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.

Last updated