Presentation is loading. Please wait.

Presentation is loading. Please wait.

Smart Contract.

Similar presentations


Presentation on theme: "Smart Contract."— Presentation transcript:

1 Smart Contract

2 什麼是合約 雙方或多方基於意思表示而成立法律行為 買賣、租賃、保險、投資等 履約方式:主動、被動
以太坊 = 區塊鏈 + 智能合約。 A smart contract is a piece of code which is stored on an blockchain, triggered by blockchain transactions, and which reads and writes data in that blockchain’s database.

3 每個database的內容是根據transactions 來修改, transaction執行時,只有 transactions執行完全成功或完全失敗, 這兩種情況。
For example, in a financial ledger, a payment from Alice to Bob is represented by a transaction that (a) checks if Alice has sufficient funds, (b) deducts a quantity from Alice’s account, and (c) adds the same quantity to Bob’s.

4 “Smart”Contract On Blockchain
由尼克薩博提出的理念,智能合約自己就是一個系統參與者。 它對接收到的信息進行回應,它可以接收和儲存價值,也可以 向外發送信息和價值。 履約方式:自動執行 選擇權:和沒有信任基礎的對象達成共識 資訊來源:不主動抓取外部資訊,須第三方提供 “Smart”Contract On Blockchain 智能合約是 1990s 年代由尼克薩博提出的理念,幾乎與網際網路同年代。 由於缺少可信的執行環境,智能合約並沒有被應用到實際產業中, 自比特幣誕生後,人們認識到比特幣的底層技術區塊鏈天生可以為智能合約提供可信的執行環境, 智能合約程序不只是一個可以自動執行的電腦程式:它自己就是一個系統參與者。 它對接收到的信息進行回應,它可以接收和儲存價值,也可以向外發送信息和價值。 這個程序就像一個可以被信任的人,可以臨時保管資產,總是按照事先的規則執行操作。 下面這個示意圖就是一個智能合約模型:一段代碼(智能合約),被部署在分享的、複製的帳本上,它可以維持自己的狀態,控制自己的資產和對接收到的外界信息或者資產進行回應。 從用戶角度來講,智能合约通常被認為是一个自動擔保的帳戶,例如,當特定的條件满足時,程序就會釋放和轉移資金。 從技術角度來講,智能合约被認為是網路服務器,只是這些服務器並不是使用IP地址架設在互聯網上,而是架設在區塊鏈上。 從而可以在其上面運作特定的合约程序。 將合約條款轉成程式邏輯 降低成本 去中心化 如果沒有區塊鏈, 在金流上需要銀行洗衣粉公司貨運公司等 在成本上需要時間與人力的檢查

5 在Bitcoin,對database做更動,叫transaction constraints,評估每筆transaction時,刪除整 個database ,在重建整個database 。
Bitcoin and Ethereum 在Ethereum ,對database做更動,叫smart contracts 每個改變contract的data的requests  (users send),都要能被code執行 (checking for sufficient funds, deducting from one account, and adding to another..)  the smart contract for a financial ledger performs the same three tasks as the administrator of a centralized database:

6 “Smart”Contract On Blockchain
在區塊鏈上放的都是這些smart contract的“值”,不同的邏輯、 狀態,這些值也會有不同的解讀方式。這些值的接口,稱為 ABI (Application Binary Interface)。 “Smart”Contract On Blockchain ABI有一套規則,如果遵循這個規則產生出的object,就能在相對應的系統上正確的運作。

7 Serpent:類似 Python Solidity:類似 JavaScript “Smart”Contract 語言

8 1.寫合約 2.編譯合約,轉成bytecode 3.廣播並等待被放入區塊中 4.執行合約 “Smart”Contract 流程

9 如何引用外部資訊 EX:農業保險,依照天氣,給予保費
But because this source is outside of the blockchain,there is no guarantee that every node will receive the same answer 解決方法1: an oracle(one or more trusted parties) pushes the data onto the blockchain rather than a smart contract pulling it in.  解決方法2:we use a trusted service which monitors the blockchain’s state and performs certain actions in response 如何引用外部資訊 For example, a bank could proactively watch a blockchain, and perform money transfers which mirror the on-chain transactions.

10 自動販賣機 U-bike 線上投注 金融應用 “Smart”Contract 應用


Download ppt "Smart Contract."

Similar presentations


Ads by Google