ethereumjs-monorepo

@ethereumjs/mpt


@ethereumjs/mpt / verifyMerkleProof

Function: verifyMerkleProof()

verifyMerkleProof(key, proof, opts?): Promise<null | Uint8Array<ArrayBufferLike>>

Defined in: packages/mpt/src/proof/proof.ts:17

An (EIP-1186)[https://eips.ethereum.org/EIPS/eip-1186] proof contains the encoded trie nodes from the root node to the leaf node storing state data.

Parameters

key

Uint8Array

Key that is being verified and that the proof is created for

proof

Proof

An (EIP-1186)[https://eips.ethereum.org/EIPS/eip-1186] proof contains the encoded trie nodes from the root node to the leaf node storing state data.

opts?

MPTOpts

optional, the opts may include a custom hashing function to use with the trie for proof verification

Returns

Promise<null | Uint8Array<ArrayBufferLike>>

The value from the key, or null if valid proof of non-existence.

Throws

If proof is found to be invalid.