Truebit Toolchain & Transmute

Orie Steele
Truebit
Published in
6 min readOct 26, 2018
Transmute is a decentralized app engine for enterprise development teams

Transmute has been actively helping develop the Truebit Toolchain. We are proud to contribute to one of the core scaling solutions for blockchain: secure off-chain computation.

If you are not familiar with Truebit, this medium post does a great job of introducing the concept, start here.

The following details what Transmute is doing to extend support for Truebit and how Transmute is different from Truebit (hint: Truebit is a dependency for Transmute).

The truth is we’ve got a lot in common. Both Transmute and Truebit are still under development. We share a vision for making decentralized application development easier and extending the support for languages that can be used for trustless computation, where economic incentives prevent parties from grieving or cheating when performing work for each other. Transmute focuses on development environment and integration with modern cloud architectures, including on prem, local and public clouds, for example supporting decentralized identity standards that bridge DLT and decentralized identity with traditional centralized enterprise directories. Another example is support for leveraging trusted centralized authorities off chain data storage, while support the Truebit computation verification game. In short Transmute is building a bridge between scalable centralized cloud computing model, and the secure decentralized computing environment that DLT is enabling. Meanwhile, Truebit focuses on leveraging the Ethereum blockchain to provide a marketplace for verifiable computation.

One of our favorite parts of Truebit is that it’s a solution for scaling any Turing complete smart contract enabled blockchain.

Usability is widely accepted as a major challenge in the security and cryptography space; Truebit is getting easier to use every day. Transmute’s contributions to the Truebit Toolchain include a docker image that helps prepare C code for verifiable computation, and Truebit OS, the Command Line Interface (CLI) tool for managing work and interacting with the protocol.

As both companies continue to grow, we aim to support distributions of Truebit that are compatible with the Transmute Platform and public cloud providers that leverage Kubernetes, which is a leading container orchestration solution for enterprises. For those not familiar, kubernetes enables the deployment of microservices and other networked applications easy, by leveraging docker and an infrastructure as code approach to deployment. You can learn more about kubernetes here.

Cloud functions are an increasingly popular alternative to the traditional web server model. There are a number of benefits including compatibility with event sourced systems including public cloud provider triggers, webhooks and normal HTTP requests.

In the Transmute white paper, we talk a lot about verifiable cloud functions, leveraging Truebit to support a familiar interface for developers who are used to developing with cloud functions. We plan to support Truebit by providing developers with easy on-ramps for creating verifiable work that are compatible with cloud functions and decentralized storage.

Transmute is still researching the design of a filesystem for decentralized verifiable computation. Truebit requires the program, input, and proofs of execution to be available. Currently there is support for an on chain file system and IPFS. Each has its own set of challenges, and Transmute is developing support for a storage layer. To aid this effort, we’re currently evaluating the range of emerging approaches to this problem, including Swarm, Sia, Maidsafe, and Storj.

Transmute is committed to optimizing developer tooling and experience, so naturally we wish to support Truebit developers and consumers with tooling and infrastructure to enable the next generation of decentralized applications. Transmute believes the key to commercial adoption of decentralized tech is support for legacy systems and common languages, so we’re excited to help Truebit grow and provide better support for developers who want to get started building DApps that leverage Layer 2 scaling solutions.

With that, let’s dive into the details of how the Truebit Toolchain works and how Transmute plans to leverage it:

https://github.com/TrueBitFoundation/truebit-toolchain

Truebit’s Toolchain provides a docker image which bundles everything you need to turn C code into Wasm that is ready for verifiable computation. The first step is to build or pull the docker image:

docker build . -t truebit-toolchain:latest

The image uses a workspace directory to manage preparing of code across the host-docker boundary. Here we compile a simple C program to Wasm in that workspace:

docker run — rm \
-v $(pwd)/workspace:/workspace \
truebit-toolchain:latest \
emcc -s WASM=1 /workspace/src/reverse_alphabet.c -o /workspace/src/reverse_alphabet.js

The final step is to instrument the WASM so it can generate proofs of execution.

docker run — rm \
-v $(pwd)/workspace:/workspace \
truebit-toolchain:latest \
node /truebit-toolchain/modules/emscripten-module-wrapper/prepare.js \
/workspace/src/reverse_alphabet.js \
— file /workspace/src/alphabet.txt \
— file /workspace/src/reverse_alphabet.txt \
— asmjs \
— out /workspace/dist

Now that the Wasm code has been properly prepared, it can be executed, and a proof can be generated for use in the interaction proof of computation by smart contracts running on the Ethereum blockchain!

Warning: asm.js initialization is very dependant on the filesystem.wasm
Warning, cannot find global variable TOTAL_MEMORY. Use emscripten-module-wrapper to run files that were generated by emscripten
STUB env . ___syscall5
STUB env . ___syscall54
STUB env . ___lock
STUB env . ___unlock
STUB env . ___lock
STUB env . ___unlock
STUB env . nullFunc_iiii
STUB env . ___syscall6
STUB env . ___syscall5
STUB env . ___syscall54
STUB env . ___lock
STUB env . ___unlock
STUB env . nullFunc_iiii
STUB env . ___lock
STUB env . ___unlock
STUB env . nullFunc_iiii
STUB env . ___syscall6
{
“vm”: {
“code”: “0x8e891415c9620009e061e8f4a1bd6308c5b7c41cb65fbf4a697bbd675c145e3b”,
“stack”: “0x2d52148999d6995f2d73f8676d9a0ca3ca07d5311c2b13400e762b2f232e7f50”,
“memory”: “0xc93409e80b43d215e501e25b2b424acfd177f07dbb8e64296fe5a713c5c09c5a”,
“input_size”: “0x593e5b969fbeac1646d534f40aeeb6d440f1b60353267ff7a67bb53a3a8f1125”,
“input_name”: “0x9f4c2f7983a269a754906b124d17afdbdde81523d88233071058882c1fe72c0b”,
“input_data”: “0x066ccee69369f2589250d208feef82cd3e06356124c01b9e9e8d56c9393e0e85”,
“call_stack”: “0x817d9ede28dcb78bae11b94eb0965876da3e57f2f079fbd2f42a199b855d824e”,
“globals”: “0x7d13b6d2d20d9a562a4d6286c9846b566ede5305ebd6da78c1bfc857696569ba”,
“calltable”: “0xe712a0b2433b450758076aa5a00603d8080363fa1a34126455c15072305d993d”,
“calltypes”: “0x87c337054355411efa7f7195bb1afd7078b79c10ce5abfb9e85ab5e36649a9ff”,
“pc”: 1099511627775,
“stack_ptr”: 20,
“call_ptr”: 0,
“memsize”: 100000000
},
“hash”: “0x84713b9950ce35a131222d0d54d0476406524cc28be1db0329e62e2d414c5d71”,
“steps”: 27541,
“files”: [
“./workspace/src/alphabet.txt.out”,
“./workspace/src/reverse_alphabet.txt.out”
]
}

This execution output allows for computation, originally written in C to be effectively verified on chain.

There are many applications of this kind of Layer 2 scaling solution, including support for the Doge Ethereum Bridge.

Transmute Platform

Transmute’s progress on its platform smart contracts can be found here:

https://github.com/transmute-industries/network-contracts

What’s Done?

At the time of posting, we finished the Delegated Proof Of Stake consensus layer. Here are the primary components that have been implemented and tested:

What’s Next?

The next step, currently in the pipeline is the Job layer. It defines all interactions between:

  • Producers: The DApp developers who will produce Minerals
  • Consumers: The users of the Dapps who will submit Jobs to access those Minerals
  • Providers: Who will perform those Jobs. For that part we will rely on Truebit

In order to choose which Provider will do the Job, we have come up with our own implementation of a Pseudo Random Number Generator on the Ethereum blockchain: https://github.com/transmute-industries/network-contracts/blob/master/contracts/PseudoRandomNumberGenerator.sol

The idea is to get as much entropy as possible by xoring User provided input with Miner provided input. This approach is still vulnerable to collusion between the calling User and the Miner. We may support a random beacon approach or entropy oracle in the future, but this approach has been chosen for now so we can continue to develop the system integration.

We’re still designing and developing this layer, and evaluating hybrid solutions with leverage trusted hardware alongside Truebit. We’re also revising our token economics model to support learnings from the last year regarding single token systems. In particular the challenges around decentralized token incentivized work systems that combine store of value and medium of exchange. We hope to share more about this in the future.

Collaboration with Livepeer

To reduce the risk involved in creating a new platform on Ethereum, we use publicly audited libraries from the OpenZepplin project, and inspiration from tried and tested platforms like Livepeer, which has successfully been running on the Main net since early 2018.

The rich documentation of the Livepeer ecosystem as well as the availability of the Livepeer dev team to answer technical questions has helped Transmute tremendously throughout the past months.

Given our similar use of the Truebit Toolchain, we are looking forward to growing our relationship with Livepeer, and the continued collaboration to help Truebit make its components more general and reusable for a variety of use cases.

--

--