SlideShare une entreprise Scribd logo
1  sur  24
Intro to TrueBit
yaohsin
https://medium.com/@yaohsin
2017-12-19
TrueBit的定位
Web 2.0 Web3 (dApps)
File storage Amazon S3 IPFS/Filecoin
External data 3rd party API Oracles
Payments Credit Card, Paypal Raiden
Network Performance bandwidth, SDN Sharding, Plasma
Computation Amazon EC2 TrueBit
Ethereum is a Turing-Complete
World Computer
• 充滿無限想像的Smart contracts.
• Big data
• AI
• Deep learning
• Solidity source code verification
• 唯一的限制是你的想像力.
• CryptoKitties
But, 現實是殘酷的
• Ethereum有gasLimit限制
• gasLimit為每個區塊可容納gas數量的最大值
• 目前大約8M gas per block
• 不過依然不足以執行複雜的運算
• 如何改善?
idea#1 取消gasLimit限制
• 沒有gasLimit的新世界,使用者可以發出大交易
大交易
$$$$?
有很多的手續費
驗證者的困境
• The Verifier‘s Dilemma
• 理性的礦工看到大交易,會有兩種思考層次
1. 驗證大交易太耗時,不利於挖礦競爭  不驗證
2. 若其他人都驗證大交易,我就挖錯鏈了  驗證
• 礦工不知所措!!
idea#2 將運算放到鏈下(off-
chain)
• task-giver發出一個運算任務
• 多個worker在鏈下算出答案以獲取報酬
• 以多數人的結果為最佳解
Task-giver
Contract
T
S
S
S
SSS
S
S
S
S
T
S
我們可以做得更好嗎?
T
T
T
TT
TrueBit – the verification game
目標
• 任何人都可以提出一個運算任務,並提供報酬
• 任何人都可以送出運算結果,來換取報酬
• 任何人指的是合約或使用者
• TrueBit保證結果的正確性!!
系統假設
• smart contract永遠不會出錯
• 參與者都是理性的(追求最大利益)
TrueBit 特色
• 運算結果可以被挑戰進入verification game
• 誠實的人總是可以贏得挑戰
• 網路中只要有一個誠實的人就可確保運算結果是
正確的(99% attack)
• 達到一致性的共識
TrueBit 角色
• Task-giver – 發起運算任務,附上獎勵
• Solver – 執行運算任務,並提交結果
• Verifier – 挑戰Solver運算結果的正確性
• Judges – 有限運算能力的仲裁者,確認最終運算結果
computation result You’re wrong
Let’s play the verification gameSolver Verifier
Judges
*找出分歧點
• 運算可以拆分成一系列的步驟及狀態轉換
• 雙方運算出每一個步驟的merkle tree,並且提交
給某些root給Judges
• 使用binary search  O(logN)
step 1 2 3 4 5 6 7 8 9 10
solver input 0x1234 0xac12 0x57ab 0x4395 0x6646 0x8561 0xc477 0x9837 0x3e45
verifier input 0x1234 0xac12 0x7591 0x9746 0x8332 0xa758 0xd854 0x1288 0x86ae
1
2
3
Judge只需要重複step3  step4的運算
TrueBit
Contract
T S
T
T
T
T
T
S
T
T
S
S
step 1 1,000,000
Judge判決log(1,000,000) ~= 20
輸家會被處罰
• 產生task
• solver執行
• 回報結果
• verifier檢查結果
• 進行game
• Judge判決
S
S S
S
• 隨機挑選solver
S
• 結論
預期結果
• 若系統一定存在verifier  solver不敢囂張,乖乖
給出正確答案
• 長久下來,甚至可以完全不需要進行 interactive
verification game
問題:Verifier’s Dilemma
• 雖然系統只需要一個verifier,但要如何確保他一
定會存在
• Verifier找到bug  獲得獎勵
• Solver給出錯誤答案  被懲罰
• 時間一久  Solver都給正確答案  Verifier無利
可圖  系統崩潰
解法:Forced Errors
• 隨機插入forced errors
• 系統付錢給solver隨機產生forced errors
• verifier發現forced errors  獲得報酬
• 出現forced errors  solver不會被懲罰
TrueBit
Contract
T
T
T
T
T
T
S
T
T
E
S
step 1 1,000,000
Judge判決
若沒進入verification game  verifier會被懲罰
• 產生task
• solver執行
• 回報結果
• Judge判決
S E
S E S EE
S
• forced error?
verifier & solver都有獎勵
• verifier檢查結果
• 進行game
forced error?
• 隨機挑選solver
• 正反兩種答案
S
• 結論
如何決定forced errors
• 由random bits決定
• 系統需確保下列特性,以達到不可預測
• Task giver在產生task時,不知道random bits
• Solver不知道random bits,直到他送出solution
• Verifiers不知道random bits,直到他決定發起挑戰
• random bits由下列兩項來源計算得來
• Solver選擇一個private random bits
• Solver送出solution之後的下一個block header
block 0x1234
Solver
h(private
randombit)
private random bits
block 0xabcd
error
solution
Task Giver
task
task
block 0x4534
h(error)
h(solution)
block 0x9fe3
block header
random bits = h( , )private-bit block header
依據random bits,選擇要公開哪個答案
timeout  公開 private random bits
challenge  公開private random bits & correct solution
Verifier
TrueBit系統架構
TrueBit Virtual Machine (TVM)
Security Defenses
• Pairwise sybil attacks
• The trifecta
• Collusion pools
• On low-hanging fruit
• A cash equivalence problem
各式應用
Livepeer
將TrueBit當成可以外包computation的Oracle
且保證結果一定正確
https://truebit.io/

Contenu connexe

Similaire à Intro to TrueBit

持續交付高品質程式碼 公開版
持續交付高品質程式碼 公開版持續交付高品質程式碼 公開版
持續交付高品質程式碼 公開版Kirk Chen
 
功能性测试何时应该被自动化(by刘龙军)
功能性测试何时应该被自动化(by刘龙军)功能性测试何时应该被自动化(by刘龙军)
功能性测试何时应该被自动化(by刘龙军)gigix1980
 
在 Kotlin/Android 使用 Ethereum Smart Contract
在 Kotlin/Android 使用 Ethereum Smart Contract在 Kotlin/Android 使用 Ethereum Smart Contract
在 Kotlin/Android 使用 Ethereum Smart ContractYenwen Feng
 
[科科營]電腦概述
[科科營]電腦概述[科科營]電腦概述
[科科營]電腦概述nctutlc2013
 
SACC2015 ”互联网+“任重而道远-白金&高春辉
SACC2015 ”互联网+“任重而道远-白金&高春辉SACC2015 ”互联网+“任重而道远-白金&高春辉
SACC2015 ”互联网+“任重而道远-白金&高春辉ptcracker
 
实时Web的前世今生未来
实时Web的前世今生未来实时Web的前世今生未来
实时Web的前世今生未来RolfZhang
 
Blockchain 2.0 : Smart Contract 的美麗與哀愁
Blockchain 2.0 : Smart Contract 的美麗與哀愁Blockchain 2.0 : Smart Contract 的美麗與哀愁
Blockchain 2.0 : Smart Contract 的美麗與哀愁Tom Yang
 
构建ActionScript游戏服务器,支持超过15000并发连接
构建ActionScript游戏服务器,支持超过15000并发连接 构建ActionScript游戏服务器,支持超过15000并发连接
构建ActionScript游戏服务器,支持超过15000并发连接 Renaun Erickson
 
Chasingice
ChasingiceChasingice
Chasingice冰 白
 
MongoDB at Qihoo 360
MongoDB at Qihoo 360MongoDB at Qihoo 360
MongoDB at Qihoo 360MongoDB
 
COSCUP 2016 - LLVM 由淺入淺
COSCUP 2016 - LLVM 由淺入淺COSCUP 2016 - LLVM 由淺入淺
COSCUP 2016 - LLVM 由淺入淺宗凡 楊
 
COSCUP2016 - LLVM框架、由淺入淺
COSCUP2016 - LLVM框架、由淺入淺COSCUP2016 - LLVM框架、由淺入淺
COSCUP2016 - LLVM框架、由淺入淺hydai
 
Real time web实时信息流推送
Real time web实时信息流推送Real time web实时信息流推送
Real time web实时信息流推送yongboy
 
Real-Time Web实时信息流推送
Real-Time Web实时信息流推送Real-Time Web实时信息流推送
Real-Time Web实时信息流推送yongboy
 
Introduction to Lightning networks
Introduction to Lightning networksIntroduction to Lightning networks
Introduction to Lightning networksChang-Wu Chen
 
OceanBase-破解数据库高可用难题
OceanBase-破解数据库高可用难题OceanBase-破解数据库高可用难题
OceanBase-破解数据库高可用难题everestsun
 

Similaire à Intro to TrueBit (18)

持續交付高品質程式碼 公開版
持續交付高品質程式碼 公開版持續交付高品質程式碼 公開版
持續交付高品質程式碼 公開版
 
功能性测试何时应该被自动化(by刘龙军)
功能性测试何时应该被自动化(by刘龙军)功能性测试何时应该被自动化(by刘龙军)
功能性测试何时应该被自动化(by刘龙军)
 
在 Kotlin/Android 使用 Ethereum Smart Contract
在 Kotlin/Android 使用 Ethereum Smart Contract在 Kotlin/Android 使用 Ethereum Smart Contract
在 Kotlin/Android 使用 Ethereum Smart Contract
 
BDD in .NET
BDD in .NETBDD in .NET
BDD in .NET
 
[科科營]電腦概述
[科科營]電腦概述[科科營]電腦概述
[科科營]電腦概述
 
LinkIt 7697 IoT tutorial
LinkIt 7697 IoT tutorialLinkIt 7697 IoT tutorial
LinkIt 7697 IoT tutorial
 
SACC2015 ”互联网+“任重而道远-白金&高春辉
SACC2015 ”互联网+“任重而道远-白金&高春辉SACC2015 ”互联网+“任重而道远-白金&高春辉
SACC2015 ”互联网+“任重而道远-白金&高春辉
 
实时Web的前世今生未来
实时Web的前世今生未来实时Web的前世今生未来
实时Web的前世今生未来
 
Blockchain 2.0 : Smart Contract 的美麗與哀愁
Blockchain 2.0 : Smart Contract 的美麗與哀愁Blockchain 2.0 : Smart Contract 的美麗與哀愁
Blockchain 2.0 : Smart Contract 的美麗與哀愁
 
构建ActionScript游戏服务器,支持超过15000并发连接
构建ActionScript游戏服务器,支持超过15000并发连接 构建ActionScript游戏服务器,支持超过15000并发连接
构建ActionScript游戏服务器,支持超过15000并发连接
 
Chasingice
ChasingiceChasingice
Chasingice
 
MongoDB at Qihoo 360
MongoDB at Qihoo 360MongoDB at Qihoo 360
MongoDB at Qihoo 360
 
COSCUP 2016 - LLVM 由淺入淺
COSCUP 2016 - LLVM 由淺入淺COSCUP 2016 - LLVM 由淺入淺
COSCUP 2016 - LLVM 由淺入淺
 
COSCUP2016 - LLVM框架、由淺入淺
COSCUP2016 - LLVM框架、由淺入淺COSCUP2016 - LLVM框架、由淺入淺
COSCUP2016 - LLVM框架、由淺入淺
 
Real time web实时信息流推送
Real time web实时信息流推送Real time web实时信息流推送
Real time web实时信息流推送
 
Real-Time Web实时信息流推送
Real-Time Web实时信息流推送Real-Time Web实时信息流推送
Real-Time Web实时信息流推送
 
Introduction to Lightning networks
Introduction to Lightning networksIntroduction to Lightning networks
Introduction to Lightning networks
 
OceanBase-破解数据库高可用难题
OceanBase-破解数据库高可用难题OceanBase-破解数据库高可用难题
OceanBase-破解数据库高可用难题
 

Intro to TrueBit