NodeBuilder is both an executable binary that can be run, and a library that can be used in Rust programs.
Installing the testing-node-builder executable
Assuming you have Rust/Cargo installed , run this command in a terminal:
cargo install node-builder
It will make the testing-node-builder command available in your PATH if you've allowed the PATH to be modified when installing Rust . cargo uninstall node-builder uninstalls.
Adding node_builder library as a dependency
Run this command in a terminal, in your project's directory:
cargo add node-builder
To add it manually, edit your project's Cargo.toml file and add to the [dependencies] section:
node-builder = "0.12.0"
The node_builder library will be automatically available globally.
Read the node_builder library documentation .
Back to the crate overview .
Readme
Miden Node Builder (Testing Only)
A minimal node implementation used exclusively for running integration tests of the Miden client. This crate is NOT intended for production use.
Purpose
This crate provides a simplified node implementation that is used to run integration tests for:
The Miden client library
The Miden web client
Other client-related integration tests
Features
Minimal node implementation with essential components
Configurable block and batch intervals
Support for both local and remote provers
Simple setup for testing scenarios
Usage
use miden_node_builder:: NodeBuilder;
use std:: path:: PathBuf;
use std:: time:: Duration;
# [ tokio ::main ]
async fn main ( ) -> anyhow:: Result < ( ) > {
// Create a new node builder for testing
let builder = NodeBuilder:: new( PathBuf:: from( " ./data" ) )
. with_block_interval ( Duration:: from_millis( 1000 ) )
. with_batch_interval ( Duration:: from_millis( 1000 ) ) ;
// Start the node
let node_handle = builder. start ( ) . await? ;
println! ( " RPC server listening at: {} " , node_handle. rpc_url ( ) ) ;
// ... run tests ...
// Stop the node when done
node_handle. stop ( ) . await? ;
Ok ( ( ) )
}
For a complete working example, see the simple.rs example in the crate's source code.
Components
The builder initializes and manages the following components:
Store : Manages the node's state and data persistence
Block Producer : Handles block production and validation
RPC Server : Provides an interface for interacting with the node
Configuration Options
data_directory : Path to store node data
block_interval : Duration between block production attempts
batch_interval : Duration between batch production attempts
Note
This implementation is intentionally simplified and may not include all features of a production node. It is designed to be:
Easy to maintain
Quick to start up
Sufficient for running integration tests
NOT suitable for production use
License
This project is MIT licensed .