Create and Deploy blueprints on Tangle Network.
- Overview
- Installation
- Creating a New Blueprint/Gadget
- Deploying the Blueprint to a Local Tangle Node
- Required Environment Variables for Deployment
- Examples
The Tangle CLI is a command-line tool that allows you to create and deploy blueprints/gadgets on the Tangle network. It provides a simple and efficient way to manage your blueprints and gadgets, making it easy to get started with Tangle Blueprints.
To install the Tangle CLI, run the following command:
Supported on Linux, MacOS, and Windows (WSL2)
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/tangle-network/gadget/releases/download/cargo-tangle/v0.1.1-beta.7/cargo-tangle-installer.sh | sh
Or, if you prefer to install the CLI from source:
cargo install cargo-tangle --git https://github.com/tangle-network/gadget --force
To create a new blueprint/gadget 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.
cargo tangle blueprint create --name my_blueprint
To build the blueprint and the gadget, you can simply use cargo as you would with any rust project:
cargo build
To run the unit tests, use the following command:
cargo test
To deploy the blueprint to a local Tangle node, use the following command:
export SIGNER="//Alice" # Substrate Signer account
export EVM_SIGNER="0xcb6df9de1efca7a3998a8ead4e02159d5fa99c3e0d4fd6432667390bb4726854" # EVM signer account
cargo tangle blueprint deploy --rpc-url <rpc_url> --package <package_name>
Replace <rpc_url>
with the RPC URL of your local Tangle node and <package_name>
with the name of the package to
deploy.
cargo tangle blueprint deploy --rpc-url ws://localhost:9944 --package my_blueprint
Expected output:
Blueprint #0 created successfully by 5F3sa2TJAWMqDhXG6jhV4N8ko9rUjC2q7z6z5V5s5V5s5V5s with extrinsic hash: 0x1234567890abcdef
The following environment variables are required for deploying the blueprint:
SIGNER
: The SURI of the signer account.EVM_SIGNER
: The SURI of the EVM signer account.
export SIGNER="//Alice" # Substrate Signer account
export EVM_SIGNER="0xcb6df9de1efca7a3998a8ead4e02159d5fa99c3e0d4fd6432667390bb4726854" # EVM signer account
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.
-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.