Truebit CLI reference

This guide provides a practical overview of the Truebit CLI, a command-line tool for developers to interact with the Truebit network. It explains how to submit and run computation tasks, manage wallets, monitor task execution, and integrate results into your workflows. Each command comes with detailed help options, making it easy to discover functionality and incorporate the CLI into scripts, automation pipelines, or custom developer tooling.

Installing the Truebit CLI

The Truebit CLI is supported on recent versions of Linux, Windows, and MacOS.

See the Truebit CLI Guide for detailed installation instructions.

Usage: truebit [options] [command]

  _____                _     _ _    __     __        _  __       
 |_   _| __ _   _  ___| |__ (_) |_  \ \   / /__ _ __(_)/ _|_   _ 
   | || '__| | | |/ _ \ '_ \| | __|  \ \ / / _ \ '__| | |_| | | |
   | || |  | |_| |  __/ |_) | | |_    \ V /  __/ |  | |  _| |_| |
   |_||_|   \__,_|\___|_.__/|_|\__|    \_/ \___|_|  |_|_|  \__, |
   ____ _     ___                                          |___/ 
  / ___| |   |_ _|                                               
 | |   | |    | |                                                
 | |___| |___ | |                                                
  \____|_____|___|                                               
                                                                 
A CLI to interact with Truebit Verify node
By accessing and using the Protocol, you hereby agree to our Terms of Use and
our Privacy Policy. Patents pending.
Terms of Use: https://www.truebit.io/terms
Privacy Policy: https://www.truebit.io/privacy-policy

Options:
  -V, --version                                                     output the version number
  -h, --help                                                        Display help for command

Commands:
  setup                                                             Initialize user profile configuration
  start [options] <taskId> <input>                                  Run a Truebit Task
  deploy [options] <namespace> <taskName>                           Deploy and register a new Truebit Task
  build [options] <sourceCodePath>                                  Create a Function Task
  create-api <manifestPath>                                         Create an API Task
  start-api <manifestPath> <input> [authType] [authString]          Run an API Task
  status <executionId>                                              Get execution status
  api-auth <namespace> <taskname> <taskId> <authType> <authString>  Set API Task authentication
  namespace                                                         Manage Namespace operations
  task                                                              Manage Task operations
  auth                                                              Manage authorization operations
  help [command]                                                    display help for command

setup

Developing Function Tasks

Use the build and start commands to test your function tasks before deploying them to the Coordination Hub.

build

Output

As a result of running the build command, you will receive a TaskId, which serves as the unique identifier for your task.

-l, --lang Options

Language
Value

Rust

rs (default value)

Javascript

js

Python

py

C

c

C++

c++

Example

Source Code Structure

In order to compile your source code, make sure you have the following file structure within the <sourceCodePath> folder that will be built:

  • πŸ“ src

    • πŸ“„ main.rs

  • πŸ“ target

  • πŸ“„ Cargo.toml

  • πŸ“„ Cargo.lock

Running the truebit-cli "build" command automatically generates the target folder and Cargo.lock file.

start

Output

Resources

Name
Description

Gas

Maximum amount of task execution steps

Call

Amount of nested calls during the task execution

Frame

Stack memory allocated for the Calls

Memory

Amount of memory used by the task execution

Metering

Name Name
Description

Limits

Maximum amount of resources assigned to task execution. See determinism.

Peak

Peak resource usage collected during task execution.

Last

The amount of resources in use when the task finished execution. If it ran successfully, the final values for "Call" and "Frame" should be 0.

Capacity

Resources allocated in excess. If the "Limit" value shows a 4000x number, it means that the required resources exceed the actual needs by that amount.

Remember: resource usage might vary on the same Truebit task depending on the input data.

For more information about the use of the Resources, please check the Instrumentation page

Developing API Tasks

Use the start-api, create-api commands to test your API tasks before deploying them to the Coordination Hub:

start-api

Output

Name
Description

path

API endpoint path

method

["GET", "POST", "DELETE", "PUT", "PATCH"]

body

API input parameters

params

API input parameters

Base URL

API Base URL

OpenAPI Manifest check

Manifest check. OK: Manifest is well written and executed FAIL: There are errors on the manifest schema.

API Task response

API endpoint output

create-api

Output

Check this example to get more details about the Truebit API Task Manifest.

Deploying Truebit Tasks

Use the deploy command to deploy your Truebit Task to the Coordination Hub. If API task authentication is required, use the api-auth command.

deploy

Output

api-auth

Output

Managing Truebit Tasks

Use the namespace and task commands to manage access to your Truebit Tasks within your development team. To grant execution access for a deployed task, use the auth command.

namespace

namespace register

Output

namespace transfer

AVAX funds are required to execute this command.

Output

namespace grant

AVAX funds are required to execute this command.

Output

namespace revoke

AVAX funds are required to execute this command.

Output

task

task label

AVAX funds are required to execute this command.

Output

task disable

AVAX funds are required to execute this command.

Output

task enable

AVAX funds are required to execute this command.

Output

task get-task

Output

auth

auth grant

AVAX funds are required to execute this command.

Output

auth revoke

AVAX funds are required to execute this command.

Output

auth register

AVAX funds are required to execute this command.

Output

auth deregister

AVAX funds are required to execute this command.

Output

auth check-authorization

Output

auth get-payer

Output

auth new-apikey

Output

secret.json

The secret.json file is generated when you accept the Terms and Conditions for the first time. It stores essential user information, including your wallet and private key. Keep this file secure, as it contains your credentials for accessing Truebit Verify.

Parameter
Description

privateKey

Your private key

address

Your wallet address

eula

Eula acceptance timestamp

RPC_URL

Last updated

Was this helpful?