8 releases
new 0.3.0 | Nov 20, 2024 |
---|---|
0.2.4 | Nov 17, 2024 |
0.2.1 | Oct 25, 2024 |
0.1.3 | Oct 23, 2024 |
0.1.2 | Sep 30, 2024 |
#555 in Magic Beans
816 downloads per month
Used in blueprint-test-utils
560KB
11K
SLoC
Tangle CLI
Create and Deploy blueprints on Tangle Network.
Table of Contents
- Overview
- Installation
- Creating a New Blueprint/Gadget
- Deploying the Blueprint to a Local Tangle Node
- Required Environment Variables for Deployment
- Examples
Overview
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.
Installation
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
Creating a New Blueprint/Gadget
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.
Example
cargo tangle blueprint create --name my_blueprint
Build The Blueprint and the Gadget
To build the blueprint and the gadget, 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:
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.
Example
cargo tangle blueprint deploy --rpc-url ws://localhost:9944 --package my_blueprint
Expected output:
Blueprint #0 created successfully by 5F3sa2TJAWMqDhXG6jhV4N8ko9rUjC2q7z6z5V5s5V5s5V5s with extrinsic hash: 0x1234567890abcdef
Required Environment Variables for Deployment
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.
Example of ENV Variables
export SIGNER="//Alice" # Substrate Signer account
export EVM_SIGNER="0xcb6df9de1efca7a3998a8ead4e02159d5fa99c3e0d4fd6432667390bb4726854" # EVM signer account
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.
Dependencies
~187MB
~3.5M SLoC