Skip to content

Proof

The Merkle proof of an account and of some of its storage slots, as eth_getProof returns it (EIP-1186).

import { Effect } from "effect";
import { Address } from "@ethect/core";
import { Eth } from "@ethect/core/rpc";
const slot0 = "0x0000000000000000000000000000000000000000000000000000000000000000";
const ADDRESS = Address.makeUnsafe("0x5FbDB2315678afecb367f032d93F642f64180aa3");
const proven = Effect.gen(function* () {
const proof = yield* Eth.getProof(ADDRESS, [slot0], "latest");
// proof: Proof.Proof
return proof.storageProof.map(({ key, value }) => ({ key, value }));
});
// [{ key: "0x0000…0000", value: 7n }]
Schema Type Describes Returned by
Proof.schema Proof.Proof the proof of an account, with one storage proof per slot asked Eth.getProof
Proof.storageSchema Proof.Storage the proof of one storage slot storageProof of a Proof.Proof

Proof.Proof: the account, and what proves it.

Field Type Notes
address Address the account that was asked
balance bigint in wei
nonce number
codeHash Hash (optional) the hash of the account’s code. Scroll does not send it.
storageHash Hash the root of the account’s storage trie
accountProof ReadonlyArray<Hex> the encoded trie nodes from the state root down to the account
storageProof ReadonlyArray<Proof.Storage> one entry per slot asked, in the order asked

Proof.Storage: one slot, and what proves it.

Field Type Notes
key Hex the slot
value bigint the value of the slot, 0n when it was never written
proof ReadonlyArray<Hex> the encoded trie nodes from the storage root down to the slot
  • A value is a bigint here. Eth.getStorageAt returns the same slot as a 32-byte Hex word. A proof carries it as a quantity.
  • An absent account is proven too. Its balance is 0n and its nonce is 0. The nodes of accountProof then show that no account exists at that address.
  • codeHash can be absent. Scroll names two hashes of its own, keccakCodeHash and poseidonCodeHash, and sends no codeHash: the proof decodes without the key.
  • storageHash is storageRoot elsewhere. The same value is named storageRoot in an Account.
  • Not verified. The proof is what the node sent. Nothing in ethect checks it against a state root yet.