Auto EVMFarmerless Dev Node

Subspace Farmerless Dev Node

Developer utility binary that boots a local Subspace consensus node (mocked farmerless setup) and, optionally, an EVM domain node for integration testing and manual experimentation. It wraps helpers from subspace-test-service and domain-test-service so that devs can exercise cross-domain flows without spinning up a full farmer.

Prerequisites

  • Cloned Subspace Repository
  • Rust toolchain with cargo
  • Workspace dependencies built once (cargo build -p subspace-farmerless-dev-node)

Usage

From the workspace root:

cargo run -p subspace-farmerless-dev-node -- [FLAGS/OPTIONS]

Common Flags

  • --finalize-depth <K>: Enforce finalization depth; omit to disable.
  • --domain: Start the EVM domain node alongside consensus.
  • --base-path <PATH>: Persist data instead of using a temp dir.
  • --rpc-host <IP> / --rpc-port <PORT>: Consensus RPC interface (defaults 127.0.0.1:9944).
  • --domain-rpc-host <IP> / --domain-rpc-port <PORT>: Domain RPC interface (defaults 127.0.0.1:9945).
  • --block-interval-ms <MS>: Slot and block production cadence (default 6000; use 0 to disable auto-production).

To inspect the full CLI help, run:

cargo run -p subspace-farmerless-dev-node -- --help

Typical Scenarios

Quick Smoke Test

Produces consensus blocks every 6s using temp storage:

cargo run -p subspace-farmerless-dev-node

Run with Domain Node

Start both consensus and EVM domain nodes:

cargo run -p subspace-farmerless-dev-node -- --domain

Fast Integration Testing

Faster block production for quick testing:

cargo run -p subspace-farmerless-dev-node -- --block-interval-ms 500 --domain

Manual Block Production

Disable auto-production and trigger blocks manually via RPC:

cargo run -p subspace-farmerless-dev-node -- --block-interval-ms 0 --domain

Manual Block Production RPCs

When --block-interval-ms 0 is set, the node exposes JSON-RPC endpoints for manual block production:

dev_produceBlock

Produce a single consensus block.

Parameters:

  • wait_for_bundle (optional, boolean): If true, wait for domain bundle submission before producing the block. Defaults to false.

Example:

curl -H "Content-Type: application/json" \
     --data '{"jsonrpc":"2.0","id":1,"method":"dev_produceBlock","params":[true]}' \
     http://127.0.0.1:9944

dev_produceBlocks

Produce multiple consensus blocks.

Parameters:

  • count (required, number): Number of blocks to produce.
  • wait_for_bundle (optional, boolean): If true, wait for domain bundle submission before each block. Defaults to false.

Examples:

# Produce 5 blocks without waiting for bundles
curl -H "Content-Type: application/json" \
     --data '{"jsonrpc":"2.0","id":1,"method":"dev_produceBlocks","params":[5]}' \
     http://127.0.0.1:9944
 
# Produce 5 blocks, waiting for bundles
curl -H "Content-Type: application/json" \
     --data '{"jsonrpc":"2.0","id":1,"method":"dev_produceBlocks","params":[5,true]}' \
     http://127.0.0.1:9944

Note: When wait_for_bundle is true, the domain node must be running (--domain flag) or the RPC call will timeout waiting for bundle submission.

Docker Setup

For easy setup using Docker, you can use the provided farmerless-dev-node.yml file. This setup automatically builds and runs the farmerless dev node with the EVM domain enabled.

Prerequisites

  • Docker and Docker Compose installed

Quick Start with Docker

  1. Ensure you’re in the workspace root directory (where farmerless-dev-node.yml is located).

  2. Start the farmerless dev node:

docker-compose up

This will:

  • Build the subspace-farmerless-dev-node binary
  • Start the node with the --domain flag enabled
  • Expose ports:
    • 9944: Consensus RPC
    • 9945: Domain RPC
    • 8545: EVM RPC
  1. Access the RPC endpoints:
    • Consensus RPC: http://localhost:9944
    • Domain RPC: http://localhost:9945
    • EVM RPC: http://localhost:8545

Customizing Docker Setup

You can modify the docker-compose.yml file to customize the setup:

  • Change block interval: Modify the command to include --block-interval-ms <MS>
  • Persist data: Add --base-path /workspace/data to the command
  • Change ports: Update the port mappings in the ports section

Example: Fast Block Production

To run with faster block production (500ms intervals), modify the command in docker-compose.yml:

command: >
  bash -c "
    cargo build -p subspace-farmerless-dev-node --release &&
    cargo run -p subspace-farmerless-dev-node --release -- --domain --block-interval-ms 500 --rpc-host 0.0.0.0 --domain-rpc-host 0.0.0.0
  "

Stopping the Container

To stop the farmerless dev node:

docker-compose down

To stop and remove volumes (clearing cached build artifacts):

docker-compose down -v