Skip to main content

Overview

The LocalNodeManager 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

Automatically finds available ports for each node instance, enabling parallel test execution without conflicts.
Take snapshots, revert to previous states, and manipulate blockchain time for comprehensive testing scenarios.
Set balances, impersonate accounts, and manage nonces for precise test conditions.
Fork from mainnet or testnet at specific blocks to test against real-world state.
Built-in fixtures and utilities for seamless integration with Playwright tests.

Common Use Cases

Testing Smart Contracts

Testing onchain Interactions

Time-Dependent Testing

Next Steps

Configuration

Learn about all configuration options for LocalNodeManager

API Reference

Explore the complete API with all methods and properties