@tevm/block
Block, block-header, and RLP/JSON-RPC serialization utilities. Includes Verkle/EIP-6800 payload types only; Tevm does not execute Verkle witnesses.
Full API: packages/block/docs.
Installation
npm install @tevm/blockAPI Reference
Core Classes
Interfaces
Verkle Payload Types
Payload shapes only; Tevm does not execute Verkle/EIP-6800 state-witness blocks.
Block Types
Utility Functions
Usage Examples
import { Block } from '@tevm/block'
import { createCommon } from '@tevm/common'
import { mainnet } from 'viem/chains'
import { EthjsAddress } from '@tevm/utils'
const common = createCommon({ ...mainnet })
const block = new Block({ common })
const fromData = Block.fromBlockData({
header: {
parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
uncleHash: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
coinbase: EthjsAddress.fromString('0x0000000000000000000000000000000000000000'),
stateRoot: '0x0000000000000000000000000000000000000000000000000000000000000000',
transactionsTrie: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
receiptTrie: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
difficulty: 0n,
number: 0n,
gasLimit: 30000000n,
gasUsed: 0n,
timestamp: BigInt(Math.floor(Date.now() / 1000)),
baseFeePerGas: 1000000000n,
},
}, { common })
const hash = block.hash()
const serialized = block.serialize()
const json = block.toJSON()
const fromRlp = Block.fromRLPSerializedBlock(serialized, { common })
const fromValues = Block.fromValuesArray(block.raw(), { common })
