TrueBit Code Review: Scalable Blockchain Verification

I love this. Love it. Go to the website and you’ll see why, it’s like looking at 1993 and I swear they had to get their background colour matched at a hospital. Love it.

Well looks aren’t everything so I’ll put my affection to one side and focus on the TrueBit code review. They’ve been working on this a while and it shows. “Panopticomputers”, only verifying blockchains when something goes wrong or when highly complex, so that every transaction is not clogging up the network, “outsourcing” computations to a “trustless consensus computer”.

So the very purpose of distributed ledger technology is to maintain a perfect record of the past so that there can be no dispute over the ledger entries. And Ethereum blockchain nodes therefore contain all transactions ever recorded (not getting into arguments about Eth Classic here).

TrueBit is a smart contract that sends ‘client’ computations outside of the Ethereum network when they reach a certain complexity (rational miner paradox), verifying them through a trustless economic mechanism (see whitepaper) if there is a dispute or simply returning the clean transaction to the chain, once verified, if there is no dispute.

Either way the verifier is rewarded appropriately, creating incentives for the client and the computational service provider. This provides..

“A scalable verification solution for blockchains”

“Secure, scalable, decentralized computation” and

“TrueBit gives Ethereum smart contracts a computational boost.”

 

 

Very active repo.

We start with wasm-computation-layer. This for now is mostly emsdk (emscripten). It is interacting with ocaml-offchain somehow, busy trying to figure this part out.

Ok, so emscripten is linked with empscripten-module-wrapper. This allows the system to record data for verified computations.

READ  The $1 Billion Tezos Blockchain Is Officially Launching Monday

 

1*2zn0N1EUW2ffpjJ5HODizg TrueBit Code Review: Scalable Blockchain Verification

 

We start at main.js

Lot’s of pre-definitions for different environments (running in web/on node/etc)

So much happening in main.js

 

1*15H5A9n6BRDS7knTyMUyQA TrueBit Code Review: Scalable Blockchain Verification

 

Great documentation. A lot of this is emscripten boiler plate though, so it’s a bit difficult to differentiate.

Need to dig in more here.

I need to start from another angle, let’s start with Truebit OS

 

1*tYbaQrF7hUguf02ON6o9iQ TrueBit Code Review: Scalable Blockchain Verification

 

1*O_C0lSoPY7JTVlLTxOhlKQ TrueBit Code Review: Scalable Blockchain Verification

 

1*5QBHS8JDyZoVFfNf-rOoOA TrueBit Code Review: Scalable Blockchain Verification

 

deploy-wasm goes to ./wasm-client/deploy.sh
truebit goes to node ./cli/index.js

Let’s have a look at deploy.sh first

 

1*b2o8CaH9n4CZqKp_xY1wLw TrueBit Code Review: Scalable Blockchain Verification

 

We have ocaml-offchain again, webasm-solidity, and then the js files, let’s dig into them.

 

1*74_hxOLDZ0ly2gVfclNM1A TrueBit Code Review: Scalable Blockchain Verification

 

Deploy does a npm run deploy on webasm-solidity, we will head over there just now.

 

1*FW1L-8Eyha7TKSaG4ICf1g TrueBit Code Review: Scalable Blockchain Verification

 

Interesting, merkleComputer = webasm-solidity/merkle-computer and ocaml-offchain interpreter.

I always wondered why most of their work was in javascript, but it’s heavily integrated with web3.js, so it makes sense.

 

1*To2YeEQfvwZ2kvwKsxBpDA TrueBit Code Review: Scalable Blockchain Verification

 

Gets the task posted event as soon as someone registers an execution task with the ethereum smart contract (although it could also just be run locally off-chain or in a truebit os).

Can grab code locally, on-chain, or from IPFS, then setupVM. VM executes the WASM task in a merkleComputer (webasm-solidity above, we will get into it shortly)

Specific steps in the VM are selected for dispute resolution (all execution doesn’t occur)

This is good.

Still a lot I have to go through here, but I will conclude this for now.


TrueBit Code Review Conclusion:

Really great code. Great solution. Will allow for decentralized computing that can scale with node participation. Really fantastic idea, concept, and implementation. The solution doesn’t need its own token, ETH is good enough for it, but other than that, this is fantastic.

READ  Despite Hype, Blockchain Is Not A 'Utopian' Product, Says Author Paul Vigna | CNBC

Really great code. I will still need to go through this quite a bit, the skill caliber is very high.

 

You can chat about TrueBit in our Telegram group.

Disclaimer: Crypto Briefing code reviews are performed by auditing what is on display in the master branch of the repo’s made available. This was performed as an educational review and any comments in the article are the opinion of the writer. It is normal for code to change rapidly, hence we timestamp our code reviews so that they present a snapshot at a moment in time. Information contained herein should not be used as any comment or advice on the project as a whole.

TrueBit Code Review Timestamp: August 25th 2018

 



Source link

pinit_fg_en_rect_red_28 TrueBit Code Review: Scalable Blockchain Verification

Spread the love
  • pinit_fg_en_rect_gray_20 TrueBit Code Review: Scalable Blockchain Verification

Related posts

Leave a Comment