viem icon indicating copy to clipboard operation
viem copied to clipboard

feat: add EIP-7594 (PeerDAS) blob support

Open spalladino opened this issue 1 month ago • 5 comments

Implements EIP-7594 blob transaction support alongside existing EIP-4844 blobs.

Fixes #4021

BREAKING CHANGES:

  • blobsToProofs now returns Hex[][] or ByteArray[][] instead of flat arrays
    • EIP-4844: Returns [[proof]] (one proof per blob, wrapped in array)
    • EIP-7594: Returns [[proof1, ...proof128], ...] (128 cell proofs per blob)
  • BlobSidecar.proof type now accepts type | type[] to support both formats

Features:

  • Add optional blobVersion parameter ('4844' | '7594') to blob-related methods
  • Automatic blob version detection based on chain ID (Sepolia uses EIP-7594)
  • Add getBlobVersion helper for chain-based version selection
  • Support for computeCellsAndKzgProofs in KZG interface
  • EIP-7594 uses wrapper version byte 0x01 in transaction serialization
  • Transaction parsing handles both 4-element (EIP-4844) and 5-element (EIP-7594) wrappers

Implementation:

  • blobsToProofs: Returns array of proof arrays, uses computeCellsAndKzgProofs for EIP-7594
  • toBlobSidecars: Handles proof arrays, unwraps single proofs for EIP-4844
  • serializeTransaction: Flattens proof arrays, adds version byte for EIP-7594
  • parseTransaction: Groups proofs by blob dynamically based on count
  • getBlobVersion: Auto-detects version from chain ID with override support

Documentation:

  • Update blob transaction guide with EIP-7594 information
  • Add blobVersion parameter docs to blobsToProofs and toBlobSidecars
  • Document proof structure differences between EIP-4844 and EIP-7594

Dependencies:

  • Update @paulmillr/trusted-setups to 0.3.0 (PeerDAS support)
  • Update micro-eth-signer to 0.17.3 (includes computeCellsAndProofs)

🤖 Generated with Claude Code

spalladino avatar Oct 14 '25 17:10 spalladino

🦋 Changeset detected

Latest commit: 3fd9855532719349d36fd352499427050289ee6f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
viem Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Oct 14 '25 17:10 changeset-bot[bot]

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​paulmillr/​trusted-setups@​0.1.2 ⏵ 0.3.081 -110094 +284 +4100
Updatedmicro-eth-signer@​0.14.0 ⏵ 0.17.3100 +1100100 +1100 +10100

View full report

socket-security[bot] avatar Oct 14 '25 17:10 socket-security[bot]

Open in StackBlitz

npm i https://pkg.pr.new/viem@4022

commit: 371f001

pkg-pr-new[bot] avatar Oct 14 '25 17:10 pkg-pr-new[bot]

I see a bunch of tests are failing, my guess is because the PR does not have access to env vars for executing actual requests? Let me know if there's anything I should adjust to make the CI less angry.

spalladino avatar Oct 14 '25 17:10 spalladino

I've tested this manually using the sendRawTransaction.test.ts test against both Sepolia and Hoodi (since it has not yet activated Fusaka), and both worked fine.

spalladino avatar Oct 14 '25 17:10 spalladino

Hey @jxom, any news on this one? Fusaka is closing in on mainnet, and without this any blob tx will fail (unless it targets an execution client that backfills pre-fusaka blob proofs).

spalladino avatar Nov 25 '25 13:11 spalladino