SlideShare a Scribd company logo
Verifying offchain
computations using TrueBit
Sami Mäkelä
Onchain computation
● To execute smart contracts, we have to have a way to perform trusted
computations
● Blocks include transactions
● Every full node executes all transactions
● So miners will have to be honest, or their blocks are rejected
Problems with increasing the limit
● Currently 6Mgas available for each block
● For example too little to be able to compute scrypt hash
● If the computations are too long, nobody will have time to check them
● Other problem is that if the computations become costly, perhaps eventually
the miners will try to save by making incorrect computations
● There are over 20000 nodes, so when you make a transaction, you are
buying a lot of computation power
● Longer computations in current Ethereum blockchain could be very expensive
TrueBit
● Computations can be done offchain
● But they can still guaranteed to be correct
● Examples of verifying offchain computations
● Square root
● Ordered list
● Any computation
Square root
● For some reason our smart contract has to know square root of variable N
● Instead computing it, calculate it offchain, and verify it in the smart contract
● √N*√N<= N && N < (1+√N)*(1+√N)
Ordered list
● The complexity of maintaining and ordered data structure is O(log(N)) per
operation
● For example a balanced tree might be complex to implement
● Use linked list, calculate offchain to after which cell the new value should be
inserted
Example
12 at
0xf382
34 at
0xa424
132 at
0x1357
64 at
0x627e
Any computation?
● Any computation can for example represented as bytecode or the merkle root
of the byte code
● Then there is the input
● How can we verify that a given output is the result of the computation?
● The bytecode and input are passed to the TrueBit contract
● TrueBit will return verified output
Solvers and verifiers
● There are two kinds of tasks that are needed for the system to operate
● Solving a task: post a solution for the task
● Verifying a task: check if the posted solution is correct
● If the solution is incorrect, verifier can challenge it
● Not all Ethereum nodes have to compute everything, because it can be
assumed that small fraction of nodes will be enough to produce fraud proofs
Basic idea
● Computations can be divided into simple steps or state transitions
● Each state has a deterministic next state
● Only a small amount of data is needed to calculate the next state (Merkle
trees)
● Each transition can be verified onchain
0xacb..23 0xcab..31 0xa2b..f3 0x5cb..62 0x4cb..25
Binary search and judges
● Everybody agrees on the initial state
● Solvers and verifiers can use interactive protocol to find the first state where
they disagree (binary search)
● This state can then be posted to a smart contract that can determine what is
the next state (judges)
Example (binary search)
1 2 3 4 5 6 7 8 9 10
1 2 3 6 7 8 9 10 11 12
13
2
Different results
Judge will check the transition from 3rd
state to 4th state
Example of judging (memory access)
1. Check correctness of machine state wrt. hash
2. Check if the opcode is actually a memory access opcode
3. Check what is the value of the memory cell in the position given by the
address register
4. Write the value to register
5. Calculate new root hash
Machine state (simplified)
Op code: LOAD R1: 3 R2: 0 Mem: 0x234..123 PC: 2
123 234 543 23 45 56 23 554
h(123,234) h(543,23) h(45,56) h(23,554)
Forced errors
● Verifiers can be rewarded from finding errors
● To incentivise the verifiers, there has to be errors that they can find
● If the probability of errors is too low, the expected return for verifiers is
negative
● Some tasks will be randomly selected to have a “forced error”, where the
solver will have to post a wrong solution
● The verifiers that detect this error will get a special reward
● This ensures that it is profitable to run verifiers
Practical details
Show demo concept
WebAssembly
● Basically a generic compilation target like LLVM bitcode
● Can be efficiently ran using JIT compilers
● Intended for web applications, for example games
● For interpreters, there are some challenges
Emscripten and filesystem
● Emscripten is the system that is used to compile from C (or some other
language) to WebAssembly
● Emscripten has runtime written in JavaScript
● So for TrueBit we need our own runtime
● Some kind of access to files etc.
● The file system represents the input and output for the task
TrueBit VM
● Simple to convert from WebAssembly (most instructions are the same)
● Special instructions for handling file system
● Efficient to interpret
● Can output merkle roots (hashes) of intermediate states
● Can generate the proofs needed for judges
What kind of computations can be verified
● Hardest part is getting the programs to compile
● After that, basically any program can be first ran locally, and then it can be
posted into TrueBit for verification
● Nondeterministic system calls like “gettimeofday” can just be recorded and
replayed to make the computation deterministic
Offchain data
● IPFS, Swarm, etc.
● Because of hashes, in principle the programs can safely refer to IPFS
● Data availability problem
Example applications
● DogEth: scrypt for Ethereum
● Other more complicated cryptographic algorithms
● Machine learning
● Data markets
● Solidity compiler
● General scaling
http://truebit.io/

More Related Content

PDF
FastBFT
YongraeJo
 
PDF
Vft
YongraeJo
 
PDF
Omni ledger
YongraeJo
 
PDF
SCP
YongraeJo
 
PDF
Honeybadger of BFT Protocols
YongraeJo
 
PDF
Ekiden
YongraeJo
 
PDF
Design of a secure "Token Passing" protocol
Augusto Ciuffoletti
 
PPTX
Diagnosing HotSpot JVM Memory Leaks with JFR and JMC
Mushfekur Rahman
 
FastBFT
YongraeJo
 
Omni ledger
YongraeJo
 
Honeybadger of BFT Protocols
YongraeJo
 
Ekiden
YongraeJo
 
Design of a secure "Token Passing" protocol
Augusto Ciuffoletti
 
Diagnosing HotSpot JVM Memory Leaks with JFR and JMC
Mushfekur Rahman
 

What's hot (20)

PPTX
Distributed Transaction Management in Spring & JEE
Mushfekur Rahman
 
PPTX
Building a Unified Logging Layer with Fluentd, Elasticsearch and Kibana
Mushfekur Rahman
 
PPTX
The paxos commit algorithm
ahmed hamza
 
PPT
Os module 2 c
Gichelle Amon
 
PDF
SemFuzz: Semantics-based Automatic Generation of Proof-of-Concept Exploits
星曼 陈
 
PPT
16. Concurrency Control in DBMS
koolkampus
 
PPTX
OmniLedger
SIYIMA4
 
PPTX
Transaction and concurrency control
Anil Shrestha
 
PPTX
Mutual Exclusion using Peterson's Algorithm
Souvik Roy
 
PPTX
Operating system critical section
Harshana Madusanka Jayamaha
 
PPTX
Process synchronization
Ali Ahmad
 
PDF
6 Synchronisation
Dr. Loganathan R
 
DOCX
Critical section operating system
Muhammad Baqar Kazmi
 
PDF
Deep dive into LibraBFT consensus
Phuwanai Thummavet
 
PPT
Peterson Critical Section Problem Solution
Bipul Chandra Kar
 
PPTX
Process synchronization
Syed Hassan Ali
 
PDF
Lecture 5 process synchronization
KlintonChhun
 
PPTX
Concurrency control PPT
ShushrutGupta
 
PPTX
Concurrency control
Soumyajit Dutta
 
PPTX
Concurrency control
Javed Khan
 
Distributed Transaction Management in Spring & JEE
Mushfekur Rahman
 
Building a Unified Logging Layer with Fluentd, Elasticsearch and Kibana
Mushfekur Rahman
 
The paxos commit algorithm
ahmed hamza
 
Os module 2 c
Gichelle Amon
 
SemFuzz: Semantics-based Automatic Generation of Proof-of-Concept Exploits
星曼 陈
 
16. Concurrency Control in DBMS
koolkampus
 
OmniLedger
SIYIMA4
 
Transaction and concurrency control
Anil Shrestha
 
Mutual Exclusion using Peterson's Algorithm
Souvik Roy
 
Operating system critical section
Harshana Madusanka Jayamaha
 
Process synchronization
Ali Ahmad
 
6 Synchronisation
Dr. Loganathan R
 
Critical section operating system
Muhammad Baqar Kazmi
 
Deep dive into LibraBFT consensus
Phuwanai Thummavet
 
Peterson Critical Section Problem Solution
Bipul Chandra Kar
 
Process synchronization
Syed Hassan Ali
 
Lecture 5 process synchronization
KlintonChhun
 
Concurrency control PPT
ShushrutGupta
 
Concurrency control
Soumyajit Dutta
 
Concurrency control
Javed Khan
 
Ad

Similar to Verifying offchain computations using TrueBit. Sami Makela (20)

PDF
Presentation
Aanchal Batra
 
PPTX
Best practices to build secure smart contracts
Gautam Anand
 
PDF
Stefano Maestri - Why Ethereum and other blockchains are going to Proof of St...
Codemotion
 
PDF
Computer network (8)
NYversity
 
PDF
Blockchain Programming
Rhea Myers
 
PPTX
VXCON 2017
Kelvin Chan
 
ODP
Blockchan For Developers
Alex Chepurnoy
 
PPTX
9-Operating Systems -Synchronization, interprocess communication, deadlock.pptx
sekkiran
 
ODP
Stefano Maestri - Blockchain and smart contracts, what they are and why you s...
Codemotion
 
PDF
Ethereum-Cryptocurrency (All about Ethereum)
عطاءالمنعم اثیل شیخ
 
PPTX
synchronization in operating system structure
gaurav77712
 
PDF
blockchain-and-trusted-computing
YongraeJo
 
PDF
Blockchain and smart contracts, what they are and why you should really care ...
maeste
 
PDF
Higher Level Malware
CTruncer
 
PPTX
Building real time Data Pipeline using Spark Streaming
datamantra
 
PPTX
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...
Alexandre Moneger
 
ODP
Proof-of-Stake & Its Improvements (San Francisco Bitcoin Devs Hackathon)
Alex Chepurnoy
 
PDF
Blockchain For Developers (Talk at Innopolis Blockchain Hackathon 2016)
Alex Chepurnoy
 
PDF
Transactions in Action: the Story of Exactly Once in Apache Kafka
HostedbyConfluent
 
PPTX
Lecture 5- Process Synchronization (1).pptx
Amanuelmergia
 
Presentation
Aanchal Batra
 
Best practices to build secure smart contracts
Gautam Anand
 
Stefano Maestri - Why Ethereum and other blockchains are going to Proof of St...
Codemotion
 
Computer network (8)
NYversity
 
Blockchain Programming
Rhea Myers
 
VXCON 2017
Kelvin Chan
 
Blockchan For Developers
Alex Chepurnoy
 
9-Operating Systems -Synchronization, interprocess communication, deadlock.pptx
sekkiran
 
Stefano Maestri - Blockchain and smart contracts, what they are and why you s...
Codemotion
 
Ethereum-Cryptocurrency (All about Ethereum)
عطاءالمنعم اثیل شیخ
 
synchronization in operating system structure
gaurav77712
 
blockchain-and-trusted-computing
YongraeJo
 
Blockchain and smart contracts, what they are and why you should really care ...
maeste
 
Higher Level Malware
CTruncer
 
Building real time Data Pipeline using Spark Streaming
datamantra
 
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...
Alexandre Moneger
 
Proof-of-Stake & Its Improvements (San Francisco Bitcoin Devs Hackathon)
Alex Chepurnoy
 
Blockchain For Developers (Talk at Innopolis Blockchain Hackathon 2016)
Alex Chepurnoy
 
Transactions in Action: the Story of Exactly Once in Apache Kafka
HostedbyConfluent
 
Lecture 5- Process Synchronization (1).pptx
Amanuelmergia
 
Ad

More from Cyber Fund (20)

PPTX
Разработка на блокчейн Голос | Ерлан Шиндаулетов
Cyber Fund
 
PPTX
Mesh-сети - интернет, который мы заслужили. Матвей Сиворакша
Cyber Fund
 
PPTX
Продукты и сервисы на блокчейне биткоина. Спикер: Алексей Карпов
Cyber Fund
 
PPTX
Blockchain wallet Multy
Cyber Fund
 
PDF
Практические кейсы использования приватных блокчейнов на EXONUM. Спикер: Глеб...
Cyber Fund
 
PDF
Onchain масштабирование блокчейна. Спикер: Дмитрий Мешков
Cyber Fund
 
PDF
Анонимизация и деанонимизация пользователей в блокчейн-сетях. Спикер: Григори...
Cyber Fund
 
PDF
Оракулы для блокчейнов. Обзор платформы Exonum. Спикер: Алексей Сидоров
Cyber Fund
 
PDF
CyberSearch: The Blockchain Browser. Valery Litvin
Cyber Fund
 
PDF
The Melon security approach. Reto Trinkler
Cyber Fund
 
PDF
The censorship resistance. Andrey Sobol
Cyber Fund
 
PDF
End-to-end encryption for Dapps with NuCypher KMS. Sergey Zotov, software dev...
Cyber Fund
 
PDF
Creating CI/ CD infrastructure for open source projects. Denis Soldatov, dev-...
Cyber Fund
 
PDF
Rust & Web Assembly
Cyber Fund
 
PDF
Будущее блокчейн. Спикер: Владимир Попов
Cyber Fund
 
PDF
Почему децентрализованные биржи ближе чем нам кажется. Андрей Соболь
Cyber Fund
 
PDF
Новеллы в законодательстве. Спикер: Алексей Воробей
Cyber Fund
 
PDF
Перспективы технологии и философии. Спикер: Владимир Попов
Cyber Fund
 
PDF
Использование открытых данных блокчейн . Спикер: Александр Давыдов.pptx
Cyber Fund
 
PDF
Lightning — текущий статус разработок. Спикер: Панков Александр.odp
Cyber Fund
 
Разработка на блокчейн Голос | Ерлан Шиндаулетов
Cyber Fund
 
Mesh-сети - интернет, который мы заслужили. Матвей Сиворакша
Cyber Fund
 
Продукты и сервисы на блокчейне биткоина. Спикер: Алексей Карпов
Cyber Fund
 
Blockchain wallet Multy
Cyber Fund
 
Практические кейсы использования приватных блокчейнов на EXONUM. Спикер: Глеб...
Cyber Fund
 
Onchain масштабирование блокчейна. Спикер: Дмитрий Мешков
Cyber Fund
 
Анонимизация и деанонимизация пользователей в блокчейн-сетях. Спикер: Григори...
Cyber Fund
 
Оракулы для блокчейнов. Обзор платформы Exonum. Спикер: Алексей Сидоров
Cyber Fund
 
CyberSearch: The Blockchain Browser. Valery Litvin
Cyber Fund
 
The Melon security approach. Reto Trinkler
Cyber Fund
 
The censorship resistance. Andrey Sobol
Cyber Fund
 
End-to-end encryption for Dapps with NuCypher KMS. Sergey Zotov, software dev...
Cyber Fund
 
Creating CI/ CD infrastructure for open source projects. Denis Soldatov, dev-...
Cyber Fund
 
Rust & Web Assembly
Cyber Fund
 
Будущее блокчейн. Спикер: Владимир Попов
Cyber Fund
 
Почему децентрализованные биржи ближе чем нам кажется. Андрей Соболь
Cyber Fund
 
Новеллы в законодательстве. Спикер: Алексей Воробей
Cyber Fund
 
Перспективы технологии и философии. Спикер: Владимир Попов
Cyber Fund
 
Использование открытых данных блокчейн . Спикер: Александр Давыдов.pptx
Cyber Fund
 
Lightning — текущий статус разработок. Спикер: Панков Александр.odp
Cyber Fund
 

Recently uploaded (20)

PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PDF
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
REPORT: Heating appliances market in Poland 2024
SPIUG
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
PDF
A Day in the Life of Location Data - Turning Where into How.pdf
Precisely
 
PDF
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
REPORT: Heating appliances market in Poland 2024
SPIUG
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
A Day in the Life of Location Data - Turning Where into How.pdf
Precisely
 
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
The Future of Artificial Intelligence (AI)
Mukul
 
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 

Verifying offchain computations using TrueBit. Sami Makela

  • 2. Onchain computation ● To execute smart contracts, we have to have a way to perform trusted computations ● Blocks include transactions ● Every full node executes all transactions ● So miners will have to be honest, or their blocks are rejected
  • 3. Problems with increasing the limit ● Currently 6Mgas available for each block ● For example too little to be able to compute scrypt hash ● If the computations are too long, nobody will have time to check them ● Other problem is that if the computations become costly, perhaps eventually the miners will try to save by making incorrect computations ● There are over 20000 nodes, so when you make a transaction, you are buying a lot of computation power ● Longer computations in current Ethereum blockchain could be very expensive
  • 4. TrueBit ● Computations can be done offchain ● But they can still guaranteed to be correct ● Examples of verifying offchain computations ● Square root ● Ordered list ● Any computation
  • 5. Square root ● For some reason our smart contract has to know square root of variable N ● Instead computing it, calculate it offchain, and verify it in the smart contract ● √N*√N<= N && N < (1+√N)*(1+√N)
  • 6. Ordered list ● The complexity of maintaining and ordered data structure is O(log(N)) per operation ● For example a balanced tree might be complex to implement ● Use linked list, calculate offchain to after which cell the new value should be inserted
  • 7. Example 12 at 0xf382 34 at 0xa424 132 at 0x1357 64 at 0x627e
  • 8. Any computation? ● Any computation can for example represented as bytecode or the merkle root of the byte code ● Then there is the input ● How can we verify that a given output is the result of the computation? ● The bytecode and input are passed to the TrueBit contract ● TrueBit will return verified output
  • 9. Solvers and verifiers ● There are two kinds of tasks that are needed for the system to operate ● Solving a task: post a solution for the task ● Verifying a task: check if the posted solution is correct ● If the solution is incorrect, verifier can challenge it ● Not all Ethereum nodes have to compute everything, because it can be assumed that small fraction of nodes will be enough to produce fraud proofs
  • 10. Basic idea ● Computations can be divided into simple steps or state transitions ● Each state has a deterministic next state ● Only a small amount of data is needed to calculate the next state (Merkle trees) ● Each transition can be verified onchain 0xacb..23 0xcab..31 0xa2b..f3 0x5cb..62 0x4cb..25
  • 11. Binary search and judges ● Everybody agrees on the initial state ● Solvers and verifiers can use interactive protocol to find the first state where they disagree (binary search) ● This state can then be posted to a smart contract that can determine what is the next state (judges)
  • 12. Example (binary search) 1 2 3 4 5 6 7 8 9 10 1 2 3 6 7 8 9 10 11 12 13 2 Different results Judge will check the transition from 3rd state to 4th state
  • 13. Example of judging (memory access) 1. Check correctness of machine state wrt. hash 2. Check if the opcode is actually a memory access opcode 3. Check what is the value of the memory cell in the position given by the address register 4. Write the value to register 5. Calculate new root hash
  • 14. Machine state (simplified) Op code: LOAD R1: 3 R2: 0 Mem: 0x234..123 PC: 2 123 234 543 23 45 56 23 554 h(123,234) h(543,23) h(45,56) h(23,554)
  • 15. Forced errors ● Verifiers can be rewarded from finding errors ● To incentivise the verifiers, there has to be errors that they can find ● If the probability of errors is too low, the expected return for verifiers is negative ● Some tasks will be randomly selected to have a “forced error”, where the solver will have to post a wrong solution ● The verifiers that detect this error will get a special reward ● This ensures that it is profitable to run verifiers
  • 18. WebAssembly ● Basically a generic compilation target like LLVM bitcode ● Can be efficiently ran using JIT compilers ● Intended for web applications, for example games ● For interpreters, there are some challenges
  • 19. Emscripten and filesystem ● Emscripten is the system that is used to compile from C (or some other language) to WebAssembly ● Emscripten has runtime written in JavaScript ● So for TrueBit we need our own runtime ● Some kind of access to files etc. ● The file system represents the input and output for the task
  • 20. TrueBit VM ● Simple to convert from WebAssembly (most instructions are the same) ● Special instructions for handling file system ● Efficient to interpret ● Can output merkle roots (hashes) of intermediate states ● Can generate the proofs needed for judges
  • 21. What kind of computations can be verified ● Hardest part is getting the programs to compile ● After that, basically any program can be first ran locally, and then it can be posted into TrueBit for verification ● Nondeterministic system calls like “gettimeofday” can just be recorded and replayed to make the computation deterministic
  • 22. Offchain data ● IPFS, Swarm, etc. ● Because of hashes, in principle the programs can safely refer to IPFS ● Data availability problem
  • 23. Example applications ● DogEth: scrypt for Ethereum ● Other more complicated cryptographic algorithms ● Machine learning ● Data markets ● Solidity compiler ● General scaling