Overview
TheLocalNodeManager
is a core utility of the @coinbase/onchaintestkit
package, providing robust, programmatic control over local Ethereum (Anvil) nodes for end-to-end blockchain application testing. It is designed for seamless integration with Playwright and supports advanced scenarios such as parallel test execution, dynamic port allocation, chain state manipulation, and account impersonation.
Why is this important?
Testing blockchain applications often requires fine-grained control over the blockchain state, fast resets, and the ability to run multiple isolated nodes in parallel.LocalNodeManager
abstracts away the complexity of managing Anvil nodes, enabling reliable, reproducible, and scalable test environments for dApps, smart contracts, and wallet integrations.
Architecture
Quick Start
Key Features
Dynamic Port Allocation
Dynamic Port Allocation
Automatically finds available ports for each node instance, enabling parallel test execution without conflicts.
Chain State Management
Chain State Management
Take snapshots, revert to previous states, and manipulate blockchain time for comprehensive testing scenarios.
Account Control
Account Control
Set balances, impersonate accounts, and manage nonces for precise test conditions.
Fork Mode Support
Fork Mode Support
Fork from mainnet or testnet at specific blocks to test against real-world state.
Playwright Integration
Playwright Integration
Built-in fixtures and utilities for seamless integration with Playwright tests.