Golden Recursion Inc. logoGolden Recursion Inc. logo
Advanced Search
Truebit(TRU)

Truebit(TRU)

Truebit Protocol is an advanced blockchain that allows smart contracts to securely perform complex calculations in standard programming languages at a lower gas cost.

Truebit Protocol (TRU) - Scalable Trustless Computing

Smart contracts consume network computation and storage resources as they update the system’s global state. Some operations may demand more resources, or gas, than the blockchain network’s modest, per-block limit permits. Truebit offers secure computation for smart contracts beyond this native capacity.

Truebit combines with bulletproofs to achieve compact, zero-knowledge proofs without trusted setup. Smart contracts can leverage Truebit to execute complex operations such as bilinear maps, ring signatures, homomorphic encryption, or secure code validation.

The Problem: Decentralized Computing

Write code in Solidity, compile it to EVM (Ethereum Virtual Machine) bytecode, and send it to the blockchain. From now on, the code is executed every time a transaction is sent to the address. The blockchain consensus mechanism is redundant by design: all miners perform calculations and come to an agreement on the results.

Calculations are measured, so the amount of the fee depends on the complexity of the code. Each operation in the instruction set of the blockchain virtual machine is assigned a cost (called “gas”). Thus, the sender of the transaction pays for the executed instruction.

Anything beyond simple business logic comes at a high cost.

Moreover, network computing is limited by the block gas limit. This is an upper bound on the total amount of gas consumed by all transactions in a block. Unfortunately, one cannot simply increase the gas limit due to the verifier's dilemma; miners who receive a newly formed block must first check its validity before starting to search for the next block; but they don't get commission for such verification. Their incentives pull them in two opposite directions: to check or skip the check. This is exacerbated by the increased blocking gas limit.

Thus, the computations are expensive and limited.

Truebit solves this problem.

It does this by moving computing offline; and checking its correctness using an interactive cryptoeconomic protocol.

Solution: off-grid verifiable computation

A decentralized application (dapp) wants to perform calculations that would be expensive or would exceed the gas limit.

Instead of running it directly on Ethereum, it hands it over to the Truebit protocol.

Truebit Contracts

The API for interacting with the Truebit protocol is simple: a single function in the Truebit smart contract called createTask.

Dapp calls the createTask function, passing in the following:

program: program code. Truebit uses the WebAssembly virtual machine; dapp can pass the bytecode directly - or, more likely, include an IPFS hash or other address location for the code.

inputs: inputs to the program. The application can provide them directly or specify their address location.

reward: a reward paid to whoever runs this program.

For clarity, consider two case studies.

Livepeer, a decentralized computing platform, wants to verify that the transcoder is working correctly. They call Truebit's createTask function, passing FFmpeg as the program and a video clip as input.

Aragon, a platform for autonomous organizations, wants to count the votes. Enumeration of a large array of votes in the chain is expensive, and with too many elements it is impossible due to the limitation of the amount of gas. They call Truebit's createTask function, passing the count function as the program and an array of votes as input.

This function creates a new task in the Truebit contract.

Truebit network

Truebit is a computing platform.

Anyone can install the Truebit client, join the network with free entry, and earn rewards for completing tasks.

The client installed by the Truebit miner monitors events in the Truebit contract.

After creating a new task, a Truebit miner can download the code, run it locally through their Truebit WebAssembly virtual machine with the provided inputs, and submit the solution to the contract.

The solver also includes a deposit that ensures they have the skin in the game.

The timer starts. During this challengeTimeout, any Truebit Verifier can submit a challenge to the proposed solution along with their own deposit.

Case #1: no problem.

This is the expected case. The solver ran the program correctly. The solution remains unchanged during the ChallengeTimeout and is therefore considered correct.

The Truebit contract executes the application callback with the solution.

Case number 2: an application has been submitted.

The verifier sends the challenge along with the deposit. Now the dispute.

The contract has an initial payment provided by TaskGiver, a deposit from Solver, and a deposit from Challenger.

An interactive test game between the Solver and the Challenger begins.

test game

Note that a Truebit task is a WebAssembly program, a set of instructions that are executed one after the other.

The challenger starts the game.

Both the Solver and the Challenger had the same starting point - in state 0 they loaded an empty virtual machine, had the same program and the same input data (as dictated by the task description in the chain). In state 0, they agreed.

At the end of the program, let's say it has 14 instructions, they got different results. So in state 14 they disagreed.

The challenger uses this knowledge and asks the Solver for their state halfway through the program execution, i.e. after 7 instructions.

Using the Truebit WebAssembly virtual machine, Solver computes a hash of their state. This is a merkle root derived from the stacks, memory, and entire state of the WebAssembly Solver virtual machine. The solver sends this root to the contract in the response message.

The Challenger now computes its own Merkle Root state locally and compares to the value provided by the Solver.

If the two values ​​match, they conclude that the discrepancy occurred in the second half of the calculation. If the two values ​​differ, they conclude that the disagreement arose in the first half.

To illustrate, let's imagine that the two state roots are the same.

The challenger now sends a request message requesting the solver's state root in the middle of the second half of the computation, i.e. afte

The applicant asks for the next middle.

The solver answers.

The challenger now sends a request message requesting the solver's state root in the middle of the second half of the computation, i.e. after instruction 10.

The applicant asks for the next middle.

The solver answers.

The challenger notices that they have the same root in state 10. They then ask for the right midpoint; those. for state 12.

The interactive game continues.

The challenger pushes the Solver to the first point of contention using a binary search. The game takes O(log(n)) steps, where n is the total number of instructions in the program.

The contention eventually boils down to a single instruction, with the solver passing the root of the state before and after.

At this point, the computation is small enough for the Truebit contract to initialize the virtual machine with the prestate and run the contested instruction on the chain.

The Merkle root of the state is calculated, and if it differs from the one provided by the Solver, their deposit is reduced.

That's all!

We take all calculations offline and use Ethereum to execute a single instruction in the event of a dispute.

We reach consensus on the result, but it is a kind of consensus that is stronger than Nakamoto's consensus requirement for a fair majority or BFT's two-thirds requirement for fairness. We have a "unanimous consensus": security is guaranteed as long as there is one honest verifier.

Modular architecture:

Truebit is a modular system that can be divided into three levels:

Compute layer: This is the WebAssembly virtual machine (or a more limited state machine, such as in our interactive Doge-Etheruem bridge script construct). This requires off-chain and on-chain implementation. The Truebit WebAssembly interpreter is deterministic, measurable, and has the ability to create Merkle trees of its internal state.

Dispute Resolution Level: This is an interactive game between two parties; a verification game involving multiple request-response calls between the Solver and the Verifier.

Reward Layer: This includes rewards, deposits, solver and challenger selection, and token mechanics.

The layers will interact through well-defined interfaces.

Timeline

Patents

Further reading

Title
Author
Link
Type
Date

Series;Verified brings you a one-on-one with Davide Costa, co-founder of Foodchain S.p.A., who is leading the revolutionary combination of blockchain with supply chain

Truebit Protocol

Web

November 29, 2021

Documentaries, videos and podcasts

Title
Date
Link

Layer 2 Meetup in New York, Panel #1 (May 15, 2019)

May 22, 2019

References

Golden logo
By using this site, you agree to our Terms & Conditions.