Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

@tevm/txpool

Transaction pool facade backed by @evmts/zevm/txpool. Adds Tevm-specific fee classification for fee-market-shaped transactions, including EIP-7702 and impersonated transactions.

Normally managed by TevmNode, MemoryClient, and the JSON-RPC layer. Use directly when building custom VM tooling or low-level pending-tx control.

Installation

npm install @tevm/txpool

API

TxPool

TxPool extends the ZEVM txpool.

import { TxPool, type TxPoolOptions } from '@tevm/txpool'
 
const txPool = new TxPool({
  vm,
  maxSize: 5000,
  maxPerSender: 100,
} satisfies TxPoolOptions)

Options

type TxPoolOptions = {
  vm: TxPoolVm
  maxSize?: number
  maxPerSender?: number
}
  • vm - VM facade with blockchain, stateManager, and deepCopy().
  • maxSize - max transactions in the pool.
  • maxPerSender - max transactions per sender.

Methods

  • open() / close() - open or clear the pool.
  • start() / stop() - background cleanup.
  • add(tx, requireSignature?, skipBalance?) - validate and add.
  • addUnverified(tx) - add without validation.
  • getByHash(hashOrHashes) - look up by hex hash, or many by byte hashes.
  • removeByHash(hash) - remove from all indexes.
  • txsByPriceAndNonce({ baseFee, allowedBlobs }) - ordered for block building.
  • cleanup() - drop stale txs and sync indexes.
  • deepCopy(options) - copy with another VM/options.

JSON-RPC

Exposed via:

  • txpool_content
  • txpool_contentFrom
  • txpool_inspect
  • txpool_status

Dev methods (anvil_impersonateAccount, tevm_impersonateAccount, evm_mine) interact with the same pending state.

Transaction Support

Legacy, EIP-2930, EIP-1559, EIP-4844, EIP-7702, and Tevm impersonated EIP-1559-shaped transactions.

Related Packages