Skip to content

perf: Ethereum/EVM validation is ~20× slower than other chains (BigInt Keccak) #1

Closed

Description

@Dhananjay-alt

src/utils/keccak256.ts runs Keccak-f[1600] on BigInt lanes. Every EVM validation hashes the address, even when it's all lowercase, to fill in details.checksum. So EVM chains are the slowest family, and detectBlockchain slows down with them.

npm run benchmark on Node 24:

before after
ethereum 3,903 /s ~42,000 /s
EVM detection 3,193 /s ~13,800 /s

Proposed fix (PR to follow): store each 64-bit lane as two 32-bit halves in a Uint32Array and precompute the rho/pi index table. The output matches @noble/hashes for 9,795 differential cases, plus new block-boundary tests at 135, 136, 137, 271, 272, 273 and 500 bytes. Cost: +139 B gzip on the ethereum chunk.

Activity

  1. Dhananjay-alt commented on Nov 21, 2026

    @Dhananjay-alt
    ContributorAuthor

    Fixed in #10.

    Keccak-256 now runs on 32-bit lane halves instead of BigInt (commit f0962c9). Checksummed EVM validation goes from ~4.3k to ~49k ops/s; output still matches @noble/hashes across all differential cases.

  2. Samarth208P commented on Nov 21, 2026

    @Samarth208P
    Owner

    I could reproduce the throughput gap on main (e15d788). On Node 22.16, the repository benchmark measured about 5,600 checksummed Ethereum validations/s and 218,000 Bitcoin validations/s on the same machine. This is worth addressing for batch users.

    A focused Keccak change would be welcome on its own. Keeping valid and details.checksum identical gives us a clean way to evaluate it. Please include before/after numbers on the same host, the gzip delta, and differential checks against @noble/hashes around the 136-byte block boundary. #10 closed without merging, so its speedup is still a proposed improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions