@vocdoni/storage-proofs-eth
TypeScript icon, indicating that this package has built-in type declarations

0.4.1 • Public • Published

Storage Proofs

Javascript/Typescript library to generate storage proofs for ERC token contracts.

The library is heavily inspired on the prior work of @izqui on evm-storage-proofs.

Usage

Instal with NPM:

npm install @vocdoni/storage-proofs-eth
const tokenAddress = "0x1234..."
const holderAddress = "0x2345..."
const balancePositionIdx = 1

const balanceSlot = ERC20Proof.getHolderBalanceSlot(holderAddress, balancePositionIdx)

const result = await ERC20Proof.get(tokenAddress, [balanceSlot], blockNumber, jsonRpcUri)

const { proof, block, blockHeaderRLP, accountProofRLP, storageProofsRLP } = result

// Throws if not valid
await ERC20Proof.verify(block.stateRoot, tokenAddress, proof)

// ...

/@vocdoni/storage-proofs-eth/

    Package Sidebar

    Install

    npm i @vocdoni/storage-proofs-eth

    Weekly Downloads

    0

    Version

    0.4.1

    License

    GPL-3.0-or-later

    Unpacked Size

    217 kB

    Total Files

    40

    Last publish

    Collaborators

    • jordipainan
    • elboletaire
    • emmdim
    • marcvelmer