Testing with Tangle
How to test your blueprint with Tangle
This guide walks through the local testing flow used by the Blueprint SDK. It spins up a seeded Anvil network with the
Tangle v2 contracts from tnt-core, so you can test Blueprint Manager flows without running legacy infrastructure.
Prerequisites
- Rust toolchain (
rustup) - Foundry (
anvil) - Docker (required for the Anvil test harness)
Generate a local operator key
cargo tangle key --algo ecdsa --keystore ./local-operator-keys --name anvil-operator
export BLUEPRINT_KEYSTORE_URI="$(pwd)/local-operator-keys"The BLUEPRINT_KEYSTORE_URI value can be reused by the Blueprint Manager and TangleEvmClient.
Start a seeded Anvil network
The Blueprint SDK ships a harness that boots Anvil with the pre-seeded Tangle v2 contracts:
use blueprint_anvil_testing_utils::harness_builder_from_env;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let harness = harness_builder_from_env()
.include_anvil_logs(true)
.spawn()
.await?;
println!("HTTP RPC: {}", harness.http_endpoint());
println!("WS RPC: {}", harness.ws_endpoint());
tokio::signal::ctrl_c().await?;
Ok(())
}The harness loads the localtestnet-state.json snapshot shipped in the Blueprint SDK. When the snapshot is missing or
invalid, it replays the Foundry broadcast used by tnt-core fixtures.
Run your blueprint against local Tangle v2
Point the Blueprint Manager at the harness RPC endpoints and your service settings:
cargo tangle blueprint run \
--protocol tangle-evm \
--http-rpc-url http://127.0.0.1:8545 \
--ws-rpc-url ws://127.0.0.1:8546 \
--keystore-path ./local-operator-keys \
--settings-file ./settings.envFor the latest harness details and fixtures, see the Blueprint SDK runbook:
https://github.com/tangle-network/blueprint/blob/v2/docs/operators/anvil.md.