Skip to main content
Use this guide to install the Thru CLI, configure the RPC endpoint, and verify everything works with a live request.
This install workflow will change frequently until v1.0.0. Check back for updates when upgrading between versions.

Prerequisites

Download the C SDK

Download the C SDK from GitHub:

Download Latest Release

Get the latest Thru Program SDK for C
Download the C SDK from the latest release:
  • thru-program-sdk-c-{version}.tar.gz (or .zip) - C SDK for writing programs
Extract the SDK:
# For tar.gz
tar -xzf thru-program-sdk-c-*.tar.gz

# For zip
unzip thru-program-sdk-c-*.zip

Setup

1

Install the CLI

Install the Thru CLI using cargo:
cargo install thru-cli
Verify the install:
thru-cli --help
2

Make an initial call (expected to fail)

Try a simple command:
thru-cli getversion
This will likely fail on first run. By default, the CLI uses http://localhost:8080/api. The failure confirms the CLI is installed and you now need to configure the RPC endpoint.
3

Configure RPC endpoint

Edit your CLI configuration file at ~/.thru/cli/config.yamlSet the base URL:
rpc_base_url: https://grpc.alphanet.thruput.org
4

Verify with getversion

Run again:
thru-cli --json getversion
If you can see the thru-node version your CLI can reach the alphanet endpoint.
5

Generate a keypair

Generate a keypair to use for your account:
thru-cli keys generate <NAME>
For example, to create a keypair named default:
thru-cli keys generate default
This keypair will be stored locally and used to sign transactions. If you don’t specify a name, it defaults to default.
This command generates a private key. Never share your private key with anyone. It’s stored securely in ~/.thru/cli/config.yaml.
6

Create your first account

Create an account on-chain using your keypair:
thru-cli account create <NAME>
For example, to create an account named default:
thru-cli account create default
You’ll see output similar to this:
Info: Creating account with fee payer proof...
Info: Account public key: tayzC11YgWrPpXBon_hBxI_Szh3eUqsHxEelsHxFroPsAB
Info: Using slot: 776
Info: Calling makeStateProof RPC method...
Success: State proof created successfully
Info: Building transaction with fee payer proof...
Info: Signing transaction...
Info: Submitting transaction...
Account Creation
  Key Name: default
  Public Key: tayzC11YgWrPpXBon_hBxI_Szh3eUqsHxEelsHxFroPsAB
  Signature: tsRIKKU4-Hu9nqzwlaZxcHjv7etbguo6g1AUMt5q9ga96dXxvqnTRTm8w6XH9C6OGSgcPc94TMmKzczNg8qqMTCyXX
  Status: success
Success: Account creation transaction completed. Signature: tsRIKKU4-Hu9nqzwlaZxcHjv7etbguo6g1AUMt5q9ga96dXxvqnTRTm8w6XH9C6OGSgcPc94TMmKzczNg8qqMTCyXX

Updating the CLI

When the CLI changes, update it with:
cargo install thru-cli --force
This replaces the installed binary with the latest version.