Getting Started Guide

Follow our Getting Started guide to install the Truebit CLI and connect to the pre-configured Truebit Developer Node, available for community use. This platform enables developers to simulate the Truebit network’s execution environment, ensuring optimal performance and reliability before deployment in production.

Prerequisites

1. Installing the Truebit CLI

Install the Truebit CLI globally by using the following command:

Then, run:

This command will verify the installation and accept the Terms of Use.

2. Register Into Truebit

Already Have An Account?

If you already registered into Truebit, please follow the instruction below:

Update the secret.json file located in the ~/.truebit directory

Create New Account

To setup a new Truebit account, please run the following command:

You will need to accept the Terms of Use. Once accepted, you will see the following result:

A new secret.json file containing your account information has been created at: /Users/<username>/.truebit/secret.json.

Create An Account

Step 1:

Once you type "Y":

Step 2:

To finally create an account, the system will need the following information:

  • Name: Your full name

  • Verification Email: An email address

  • Company Name: Your company’s name

  • Job Position: Your job position

  • EULA Acceptance: Accept the End User License Agreement (EULA) [ Y|N ]

3. Working With Your First Function Task

Download The Examples

Clone the examples repository to start working with Truebit.

We have created example tasks so you can get familiar with the process of testing and deploying code. You can learn more about creating your own Function and API Tasks.

For now, we will use one of the examples (Fibonacci) to demonstrate how to use the CLI to test and deploy Function Tasks, and the platform's REST API to execute and verify them.

Build

This command will build the Fibonacci task.

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

Testing

This command will run the Fibonacci task and provide the result and total steps executed:

  • [taskId]: Add the taskId generated in the previous step.

Deploy And Register Your Function task.

This command will deploy and register the Fibonacci task.

  • [namespace]: Use your default namespace registered in Step 2 - User Creation

  • [taskname]: Choose a representative name for your task. i.e: fibonacci

  • [taskId]: Add the taskId generated in the previous step

4. Executing Your First Function Task

Execute The Function Task

  1. Access the Task execution Swagger UI here: Swagger UI for Truebit.

  2. Open the /task/function/execute-by-name endpoint and click "Try it Out" to test it.

  3. Update the following parameters in the request body:

    • namespace: Use the namespace from Step 3 – Deploy and register your Function Task

    • taskname: Use the task name from Step 3 – Deploy and register your Function Task

    • async: Set to false

  4. Add your API Key from Step 2 – Register into Truebit in the x-api-key parameter.

If you don’t remember your namespace or API key, please run truebit setup again to retrieve your personal information.

You should receive the following answer

Get The Transcript

  • Access the Transcript swagger UI here: Swagger UI for Truebit

  • Use the /task/{executionId}/transcript endpoint, passing the executionId value obtained from the previous execution as a parameter

You should get the transcript associated with the given executionId.

5. Working With Your First API Task

Create-api

This command will create the API task.

Deploy And Register Your API task

This command will deploy and register the Fibonacci task.

  • [namespace]: Use your default namespace registered in Step 2 - User Creation

  • [taskname]: Choose a representative name for your task. i.e: petstore

  • [taskId]: Add the taskId generated in the previous step.

6. Executing Your First API task

Execute The API Task

  1. Access the task execution Swagger UI here: Swagger UI for Truebit.

  2. Open the /task/api/execute-by-name endpoint and click "Try it Out" to test it.

  3. Add your API Key from Step 2 – Register into Truebit in the x-api-key parameter.

  4. Update the following parameters in the request body and click on "Execute":

    • namespace: Use the namespace from Step 6 – Deploy and register your API task

    • taskname: Use the task name from Step 6 – Deploy and register your API task

    • async: Set to false

    • input:

If you don’t remember your namespace or API key, please run truebit setup again to retrieve your personal information.

The following answer should appear:

Get The Transcript

  • Access the Transcript swagger UI here: Swagger UI for Truebit

  • Use the /task/{executionId}/transcript endpoint, passing the executionId value obtained from the previous execution as a parameter

You should get the transcript associated with the given executionId.

7. Explore Truebit in Action

By now, you’ve gone through the full journey: From installing and registering with Truebit to creating your first task locally, deploying it to the Truebit cloud, and obtaining a verifiable transcript. Now, it's time to see everything in action on a website.

To demonstrate this, we’ve built a demo page that executes a verifiable Fibonacci computation. How does it work? The page calls the Truebit execution endpoint and retrieves the corresponding verification transcript.

We run a limited-capacity Stake Sponsorship Program to support selected node operators. If you’d like to be considered for an invitation, please submit your request via http://forms.truebit.io/

Last updated

Was this helpful?