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 }]Schemas
Section titled “Schemas”| 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 |
Fields
Section titled “Fields”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 |
Storage proof fields
Section titled “Storage proof fields”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 |
Behavior
Section titled “Behavior”- A value is a
biginthere.Eth.getStorageAtreturns the same slot as a 32-byteHexword. A proof carries it as a quantity. - An absent account is proven too. Its
balanceis0nand itsnonceis0. The nodes ofaccountProofthen show that no account exists at that address. codeHashcan be absent. Scroll names two hashes of its own,keccakCodeHashandposeidonCodeHash, and sends nocodeHash: the proof decodes without the key.storageHashisstorageRootelsewhere. The same value is namedstorageRootin anAccount.- Not verified. The proof is what the node sent. Nothing in ethect checks it against a state root yet.