18 unstable releases (3 breaking)

Uses new Rust 2024

new 0.4.0-alpha.7 Apr 18, 2025
0.4.0-alpha.6 Apr 16, 2025
0.3.3 Dec 12, 2024
0.3.0 Nov 20, 2024
0.1.2 Sep 30, 2024

#467 in Magic Beans

Download history 13/week @ 2025-02-02 1/week @ 2025-02-09 35/week @ 2025-02-16 16/week @ 2025-02-23 18/week @ 2025-03-02 13/week @ 2025-03-09 11/week @ 2025-03-16 3/week @ 2025-03-23 5/week @ 2025-03-30 134/week @ 2025-04-06 576/week @ 2025-04-13

718 downloads per month
Used in blueprint-test-utils

MIT/Apache and GPL-3.0-only

5MB
47K SLoC

Tangle CLI

Create and Deploy blueprints on Tangle Network.

Table of Contents

Overview

The Tangle CLI is a command-line tool that allows you to create and deploy blueprints on the Tangle network. It provides a simple and efficient way to manage your blueprints, making it easy to get started with Tangle Blueprints.

Installation

To install the Tangle CLI, run the following command:

Supported on Linux, MacOS, and Windows (WSL2)

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

Creating a New Tangle Blueprint

To create a new blueprint using the Tangle CLI, use the following command:

cargo tangle blueprint create --name <blueprint_name>

Replace <blueprint_name> with the desired name for your blueprint.

Example

cargo tangle blueprint create --name my_blueprint

Build The Blueprint

To build the blueprint, you can simply use cargo as you would with any rust project:

cargo build

Unit Testing

To run the unit tests, use the following command:

cargo test

Deploying the Blueprint to a Local Tangle Node

To deploy the blueprint to a local Tangle node, use the following command:

cargo tangle blueprint deploy tangle --devnet --package <package_name>

Replace <package_name> with the name of the package to deploy, or it can be omitted if the workspace has only one package. Using the devnet flag automatically starts a local Tangle testnet and creates a keystore for you. The deployment keystore is generated at ./deploy-keystore with Bob's account keys. Additionally, it generates a second keystore for testing purposes at ./test-keystore with Alice's account keys.

Example

cargo tangle blueprint deploy tangle --ws-rpc-url ws://localhost:9944 --keystore-path ./my-keystore --package my_blueprint

Expected output:

Blueprint #0 created successfully by 5F3sa2TJAWMqDhXG6jhV4N8ko9rUjC2q7z6z5V5s5V5s5V5s with extrinsic hash: 0x1234567890abcdef

Optional Environment Variables for Deployment

The following environment variables are optional for deploying the blueprint:

  • SIGNER: The SURI of the signer account.
  • EVM_SIGNER: The SURI of the EVM signer account.

These environment variables can be specified instead of supplying a keystore when deploying a blueprint. It should be noted that these environment variables are not prioritized over a supplied keystore.

Example of ENV Variables

export SIGNER="//Alice" # Substrate Signer account
export EVM_SIGNER="0xcb6df9de1efca7a3998a8ead4e02159d5fa99c3e0d4fd6432667390bb4726854" # EVM signer account

Interacting with a deployed Blueprint

Once the blueprint is deployed, it can now be used on-chain. We have a collection of CLI commands that are useful for interacting with Blueprints, including the ones covered above:

  • Create: cargo tangle blueprint create
  • Deploy: cargo tangle blueprint deploy
  • List Service Requests: cargo tangle blueprint list-requests
  • List Blueprints: cargo tangle blueprint list-blueprints
  • Register: cargo tangle blueprint register
  • Request Service: cargo tangle blueprint request-service
  • Accept Service Request: cargo tangle blueprint accept
  • Reject Service Request: cargo tangle blueprint reject
  • Run Blueprint: cargo tangle blueprint run
  • Submit Job: cargo tangle blueprint submit

Further details on each command, as well as a full demo, can be found on our Tangle CLI docs page.

Generating Keys from the Command Line

The following command will generate a keypair for a given key type:

cargo tangle blueprint generate-keys -k <KEY_TYPE> -p <PATH> -s <SURI/SEED> --show-secret

where it is optional to include the path, seed, or the show-secret flags.

Flags

  • -k or --key-type: Required flag. The key type to generate (sr25519, ecdsa, bls_bn254, ed25519, bls381).
  • -p or --path: The path to write the generated keypair to. If not provided, the keypair will be written solely to stdout.
  • -s or --seed: The suri/seed to generate the keypair from. If not provided, a random keypair will be generated.
  • --show-secret: Denotes that the Private Key should also be printed to stdout. If not provided, only the public key will be printed.

For all of our features for created and using keys, see the key management section of our CLI docs.

Dependencies

~266MB
~4.5M SLoC