LPsLux Proposals
Precompiles
LP-4330

SHA-256 Hash Precompile (EVM `0x02`)

Draft

Native EVM precompile for the SHA-256 cryptographic hash function (FIPS 180-4), Ethereum precompile address 0x02.

Category
Core
Created
2026-05-18

Abstract

SHA-256 is the 256-bit member of the SHA-2 family (NIST FIPS 180-4, 2002), built on the Merkle-Damgård construction with the SHACAL-2 compression function. Ethereum exposes SHA-256 as the precompile at address 0x02 for Bitcoin-cross-chain interop (Bitcoin block-header verification, Merkle-tree leaf hashing, PoW header chains). This LP pins the Lux network's SHA-256 precompile at 0x02 for full Ethereum tooling parity, gas cost 60 + 12 * ceil(len/32) per the yellow paper, and the application-level SHA-256 API used by Lamport OTS (LP-4570), SLH-DSA (LP-4500) hash backend, and the Bitcoin bridge / wrapped-BTC (cBTC) verification path. For high-throughput non-consensus hashing prefer BLAKE3 (LP-4310); for EVM-default hashing in smart contracts use Keccak-256 (LP-4340).

Reference implementation

  • Primitive: crypto/sha256 (Go stdlib)
  • Precompile address: 0x02
  • Gas cost: 60 + 12 * ceil(input_len_bytes / 32)
  • Standards: FIPS 180-4, RFC 6234

Copyright and related rights waived via CC0.