Skip to main content

Try it Live

Run Bytecode examples in the interactive playground

Bytecode.hash(code): Hash

Compute keccak256 hash of bytecode (with auto-injected crypto).Parameters:
  • code: BrandedBytecode - Bytecode to hash
Returns: HashType - Bytecode hash (32 bytes)Example:
import * as Bytecode from 'tevm/Bytecode'

const code = Bytecode('0x6001')
const hash = Bytecode.hash(code)
// Uint8Array(32) [...]

Performance

Hash computation depends on imported keccak256 implementation. Factory API enables explicit control over crypto bundling.