blobsToProofs
Compute the proofs for a list of blobs and their commitments.
Import
import { blobsToProofs } from 'viem'
Usage
example.ts
import { blobsToCommitments, blobsToProofs, toBlobs } from 'viem'
import { kzg } from './kzg'
const blobs = toBlobs({ data: '0x...' })
const commitments = blobsToCommitments({ blobs, kzg })
const proofs = blobsToProofs({ blobs, commitments, kzg })
Returns
Hex[] | ByteArray[]
Proofs from the input blobs and commitments.
Parameters
blobs
- Type:
Hex[] | ByteArray[]
Blobs to transform into proofs.
import { blobsToCommitments, blobsToProofs, toBlobs } from 'viem'
import { kzg } from './kzg'
const blobs = toBlobs({ data: '0x...' })
const commitments = blobsToCommitments({ blobs, kzg })
const proofs = blobsToProofs({
blobs,
commitments,
kzg
})
commitments
- Type:
Hex[] | ByteArray[]
Commitments corresponding to the input blobs.
import { blobsToCommitments, blobsToProofs, toBlobs } from 'viem'
import { kzg } from './kzg'
const blobs = toBlobs({ data: '0x...' })
const commitments = blobsToCommitments({ blobs, kzg })
const proofs = blobsToProofs({
blobs,
commitments,
kzg
})
kzg
- Type:
KZG
KZG implementation. See setupKzg
for more information.
import * as kzg from 'c-kzg'
import { blobsToProofs, setupKzg } from 'viem'
import { mainnetTrustedSetupPath } from 'viem/node'
const blobs = toBlobs({ data: '0x...' })
const commitments = blobsToCommitments({ blobs, kzg })
const kzg = setupKzg(cKzg, mainnetTrustedSetupPath)
const proofs = blobsToProofs({
blobs,
commitments,
kzg,
})