Skip to content

A powerful toolkit for building distributed systems and infrastructure as code.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

tangle-network/blueprint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

998 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Tangle Network Banner

Blueprint SDK

A comprehensive toolkit for building, deploying, and managing blueprints on the Tangle Network.

Build Status Latest Release License Discord Telegram

Overview

The Blueprint SDK is a modular Rust toolkit for building decentralized servicesโ€”called Blueprintsโ€”that run across networks like Tangle, EigenLayer, and standard EVM chains.

Blueprints turn complex on-chain and off-chain infrastructure into reproducible, deployable units of logicโ€”think Infrastructure-as-Code for crypto systems. With one SDK, you can design anything from oracles and MPC networks to agent-based AI services or zk-proof markets, and deploy them seamlessly.

The SDK unifies:

  • Job orchestration and routing across async, event-driven systems
  • P2P networking with secure message handling and round-based protocol support
  • Cryptographic primitives and keystore management for signing, verification, and MPC
  • EVM and EigenLayer extensions for direct smart contract and restaking integrations
  • Testing and benchmarking utilities for reproducible environments and performance tuning

In short, Blueprints let developers move from concept to distributed protocol with minimal friction.

We also have a documentation site on all things Tangle to help you get started.

SDK Components

The following components make up the SDK, providing everything from job creation and routing utilities to specialized tools for networking and testing.

๐Ÿš€ Getting Started

๐Ÿ“‹ Prerequisites

Ensure you have the following installed:

  • Rust
  • OpenSSL Development Packages

For Ubuntu/Debian:

sudo apt update && sudo apt install build-essential cmake libssl-dev pkg-config

For macOS:

brew install openssl cmake

๐Ÿ”ง CLI Installation

You can install the Tangle CLI in two ways:

๐Ÿšฉ Option 1: Install Script (recommended)

Install the latest stable version of cargo-tangle using the installation script:

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/tangle-network/blueprint/releases/download/cargo-tangle/v0.1.1-beta.7/cargo-tangle-installer.sh | sh

๐Ÿšฉ Option 2: Install from source

Install the latest git version of cargo-tangle using the following command:

cargo install cargo-tangle --git https://github.com/tangle-network/blueprint --force

โœจ Creating Your First Blueprint

After installation, you can create, build, register, and run your first blueprint against the Tangle EVM:

# Create a new blueprint named "my_blueprint"
cargo tangle blueprint create --name my_blueprint

# Navigate into the blueprint directory and build
cd my_blueprint
cargo build

# Deploy your blueprint to the Tangle Network
# Write the contract coordinates used by your service
cat > settings.env <<'EOF'
BLUEPRINT_ID=0
SERVICE_ID=0
TANGLE_CONTRACT=0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9
RESTAKING_CONTRACT=0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
STATUS_REGISTRY_CONTRACT=0xdC64a140Aa3E981100a9BecA4E685f962f0CF6C9
EOF

# Register the operator with the on-chain contracts (optional)
cargo tangle blueprint register-tangle \
  --http-rpc-url https://rpc.tangle.tools \
  --ws-rpc-url wss://rpc.tangle.tools \
  --keystore-path ./keystore \
  --tangle-contract 0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9 \
  --restaking-contract 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512 \
  --status-registry-contract 0xdC64a140Aa3E981100a9BecA4E685f962f0CF6C9 \
  --blueprint-id 0

# Capture the preregistration payload (TLV file written to ./data by default)
cargo tangle blueprint preregister \
  --http-rpc-url http://127.0.0.1:8545 \
  --ws-rpc-url ws://127.0.0.1:8546 \
  --keystore-path ./keystore \
  --settings-file ./settings.env

# Run the blueprint manager against local Anvil (or a real RPC)
cargo tangle blueprint run \
  --protocol tangle \
  --http-rpc-url http://127.0.0.1:8545 \
  --ws-rpc-url ws://127.0.0.1:8546 \
  --keystore-path ./keystore \
  --settings-file ./settings.env

The preregistration flow mirrors the production pipeline: the CLI boots the manager in REGISTRATION_MODE_ON, launches the blueprint with REGISTRATION_CAPTURE_ONLY=1, and waits for it to emit registration_inputs.bin under ./data/blueprint-<id>-*/. Each blueprint can use the helper blueprint_sdk::registration::write_registration_inputs to persist its TLV payload when BlueprintEnvironment::registration_mode() returns true.

Runtime Preferences

cargo tangle blueprint run and cargo tangle blueprint preregister accept --preferred-source (native, container, or wasm) plus --vm/--no-vm so you can control how the manager fetches and executes artifacts. Pass --save-runtime-prefs to write those choices back to settings.env (PREFERRED_SOURCE / USE_VM) so future commands inherit the same behavior.

Every CLI action that submits a transaction now reports tx_submitted / tx_confirmed lines (or JSON objects when --json is used), making it easy to track hashes and block confirmations in logs or CI pipelines.

And your blueprint is ready to go!

Deploying to Testnet/Mainnet

When targeting real Tangle networks, provide a blueprint definition manifest that mirrors the on-chain schema. The file can be JSON, YAML, or TOML and must describe the blueprint metadata, jobs, and artifact sources (container images or native binaries). Once authored, pass it via --definition:

cargo tangle blueprint deploy tangle \
  --network testnet \
  --definition ./definition.json

At minimum the manifest requires metadata_uri, manager, at least one job, and one source. Fields such as schemas or blueprint-specific config are optional and default to empty values. See MIGRATION_EVM_ONLY.md for a detailed example.

๐Ÿงช Testing Locally

The blueprint-anvil-testing-utils crate exposes harness_builder_from_env for TangleHarness, which replays the LocalTestnet.s.sol broadcast so every integration test runs against deterministic contract state. Useful commands:

# Client integration tests (Anvil-backed)
cargo test -p blueprint-client-tangle --test anvil

# Pricing engine QoS listener
cargo test -p blueprint-pricing-engine --test evm_listener

# Blueprint runner end-to-end harness
cargo test -p blueprint-manager --test tangle_runner

# Example blueprint harness (router + runner wired together)
cargo test -p hello-tangle-blueprint --test anvil

Each suite boots its own Anvil container via testcontainers, so Docker is required when running locally or in CI.

Note: The harness loads crates/chain-setup/anvil/snapshots/localtestnet-state.json and falls back to the bundled localtestnet-broadcast.json if the snapshot is missing or fails validation. Refresh fixtures with scripts/fetch-localtestnet-fixtures.sh, and set RUN_TNT_E2E=1 to opt into the longer suites.

For a keystore-to-runner walkthrough (keys, env vars, harness commands, and manual TangleClient snippets) see docs/operators/anvil.md.

For additional commands, advanced configurations, and complete CLI usage, see the official CLI reference.

๐Ÿ“ฎ Support

For support or inquiries:

  • Issues: Report bugs or request features via GitHub Issues.
  • Discussions: Engage with the community in GitHub Discussions.
  • For real-time assistance and announcements:

๐Ÿ“œ License

Licensed under either of

at your option.

๐Ÿ“ฌ Feedback and Contributions

We welcome feedback and contributions to improve this blueprint. Please open an issue or submit a pull request on our GitHub repository. Please let us know if you fork this blueprint and extend it too!

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

A powerful toolkit for building distributed systems and infrastructure as code.

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 16

Languages