Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values...
Transcript of Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values...
![Page 1: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/1.jpg)
Move
![Page 2: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/2.jpg)
What is MoveProgramming language for implementing work in Libra
◦ Issuing cryptocurrencies, tokens, and digital assets
◦ Facilitating smooth and secure blockchain transactions
◦ Secure management of validators
![Page 3: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/3.jpg)
Feature of MoveStatic Type System
◦ Find error in compile, not in execution
First-class Resources
◦ A resource type can only be created or destroyed by the module that defines the type
◦ Prevent some logic error in smart contact
◦ Ex:
module DToken {
// A resource representing the DToken
resource T {
// The value of the coin. May be zero
value: u64,
}
}
![Page 4: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/4.jpg)
Managing Digital Assets on a Blockchain
![Page 5: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/5.jpg)
• An Abstract View of a Blockchain
• Encoding Digital Assets in an Open System
• Existing Blockchain Languages
![Page 6: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/6.jpg)
An Abstract View of a Blockchain
• blockchain is a replicated state machine
![Page 7: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/7.jpg)
• Replicators in the system are known as validators
• Users of the system send transactions to validators
• Each validator understands how to execute a transaction to transition its internal state machine from the current state to a new state
• Following consensus protocol
![Page 8: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/8.jpg)
Encoding Digital Assets in an Open System
• encode the owners of digital assets at a given point in time
• Libra Blockchain is an open system
![Page 9: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/9.jpg)
Scarcity
• The supply of assets in the system should be controlled
• Duplicating existing assets should be prohibited
• creating new assets should be a privileged operation
![Page 10: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/10.jpg)
Access control
• A participant in the system should be able to protect her assets with access control policies.
![Page 11: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/11.jpg)
Existing Blockchain Languages
• Bitcoin Script / Ethereum Virtual Machine bytecode
• Indirect representation of assets
• Scarcity is not extensible
• Access control is not flexible
![Page 12: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/12.jpg)
Move Design Goals
![Page 13: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/13.jpg)
• First-Class Resources
• Flexibility
• Safety
• Verifiability
![Page 14: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/14.jpg)
First-Class Resources
• with semantics inspired by linear logic
• ordinary program values
• to implement safe digital assets
• write correct business logic for wrapping assets and enforcing access control policies
![Page 15: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/15.jpg)
Flexibility
• includes a transaction script that is effectively the main procedure of the transaction
• invoke multiple procedures of modules published in the blockchain
• perform local computation on the results
![Page 16: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/16.jpg)
Safety
• resource safety / type safety / memory safety
• use a high-level programming language with a compiler that checks these properties
• use low-level untyped assembly and perform these safety checks at runtime
![Page 17: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/17.jpg)
Verifiability
• No dynamic dispatch
• Limited mutability
• Modularity
![Page 18: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/18.jpg)
Move 概論
![Page 19: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/19.jpg)
Peer-to-Peer Payment Transaction Script
◆1.發送方從存儲在 0x0.Currency 的module 中,調用名為withdraw_from_sender的 procedure。
◆2.發送者通過將貨幣的資源值移動到 0x0.Currency module 的存款這動作,將資金轉移到收款人。
![Page 20: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/20.jpg)
Can not……
◆1. 將move(coin)改為 copy(coin)來複製貨幣金額,資源值無法複製
◆2. 透過兩次move(coin) 來重新使用貨幣
EX: 0x0.Currency.deposit (copy(some_other_payee),move(coin))
◆3. 透過刪除move(coin) 丟失貨幣
![Page 21: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/21.jpg)
Currency Module & resource: ◆帳戶最多只能包含一個給定類型的資源值,和一個具有給定名稱的模組(在地址 0x0 的帳戶不允許包含其他的類型為 0x0.Currency.Coin 的資源)
◆ 0x0.Currency.Coin 和 0x1.Currency.Coin 算是不能互換使用的不同類型
![Page 22: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/22.jpg)
Declaring the Coin resource
1) Coin 是一種結構類型,其單個字段(field)值類型為 u64(64 位無符號整數)
2) 只有 Currency module(模組)的procedure(程序)才能創建或銷毀 Coin 類型的值
3) 其他module(模組)和 transaction script(交易腳本)只能透過模組公開的 procedure(程序)寫入或引用值的字段
![Page 23: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/23.jpg)
Implementing deposit
1) 銷毀輸入 Coin 並記錄其值。
2) 獲取對存儲在收款人帳戶下的獨一的 Coin 資源的引用。
3) 通過將 Coin 的值傳遞給 procedure(程序),來增加收款人 Coin 的值。
![Page 24: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/24.jpg)
Implementing withdraw_from_sender
1) 獲取對在發件人帳戶下發布的 Coin 類型的唯一資源的引用。2) 透過輸入量來減少引用的 Coin 的值。3) 創建並返回值為金額的新 Coin。
![Page 25: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/25.jpg)
THE MOVE LANGUAGE
![Page 26: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/26.jpg)
CONTENTS
Global State Modules Types ValuesProcedures and
transaction scripts
![Page 27: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/27.jpg)
GLOBAL STATE
![Page 28: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/28.jpg)
MODULES
![Page 29: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/29.jpg)
TYPES
![Page 30: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/30.jpg)
VALUES
![Page 31: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/31.jpg)
PROCEDURES AND TRANSACTION SCRIPTS
![Page 32: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/32.jpg)
BYTECODE OPERATIONS
Bytecode Interpreter
Bytecode Verifier
Linking with global state
![Page 33: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/33.jpg)
BYTECODE INTERPRETER
![Page 34: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/34.jpg)
BYTECODE VERIFIER
![Page 35: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/35.jpg)
LINKING WITH GLOBAL STATE
![Page 36: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/36.jpg)
Virtual MachineExecute a block 𝐵 of transactions from a global state Σ and produce a transaction effect 𝐸 representing modifications to the global state
![Page 37: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/37.jpg)
Virtual Machine(example)
![Page 38: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/38.jpg)
Next for MoveImplementing core Libra Blockchain functionality
New language feature
Improved developer experience
Support third-party Move modules
![Page 39: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/39.jpg)
REFERENCE
• https://developers.libra.org/docs/assets/papers/libra-move-a-language-with-programmable-resources.pdf
![Page 40: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/40.jpg)
聖人大盜觀看心得 何明翰
• 我覺得聖人大盜不單單是一部講述區塊鍊的影片也很多地方可以去探討,我們知道區塊鍊就是為了去中心化,而電影中為了達成這目標必須就是把中心給去除掉,藉由揭露這些表面的聖人把原本掌控著大量財富的體制給破除,或許區塊鍊在這部片只是一個出發點但是我覺得卻也深深帶給我們很多想法,也就是如果真正要做到會遭遇的許多困境。
![Page 41: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/41.jpg)
聖人大盜心得(李睿)看完這部電影以後,我覺得我對區塊鏈有了不一樣的認識,而其中電影裡有句話也讓我印象深刻,「錢是往上流的」,我覺得這句話挺合理的,有錢的人,你可以做許多大額的投資,,因此獲得不斐的利息,而一般人,做的投資都是小額的,利息也相對有限,久而久之一般人與有錢人的差距就會越來越大,這部電影,我覺得整體來說還不錯看,值得推薦
![Page 42: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/42.jpg)
聖人大盜心得(謝明翰)聖人大盜心得這部電影主要以區塊鍊的技術為背景,講述創業家與大資本家的攻防戰。雖然裡面提及區塊鍊的部分,僅限於表面的建議介紹,並沒有更多應用的呈現。但是電影的主軸始終離不開所謂「去中心化」的區塊鍊核心理念。電影想要表現的事區塊鍊發展到最後,人人都可以做自己資本的掌握者,不再受到銀行或是大資本家剝削或是欺騙,內容發人深思。
![Page 43: Move - blog.pufsecurity.com...•with semantics inspired by linear logic •ordinary program values •to implement safe digital assets ... Flexibility •includes a transaction script](https://reader035.fdocuments.us/reader035/viewer/2022071214/60424c20858f074c55451bd6/html5/thumbnails/43.jpg)
聖人大盜心得 劉安得
• 電影裡有句台詞:「現在什麼東西冠上區塊鏈都會方便很多」。聖人大盜這部電影也是。如果把電影裡的”區塊鏈”這三個字換成任何一個現在最先進的技術,例如人工智慧、大數據,或者換成任何一家新創公司,我想對整部劇情幾乎完全沒有影響。區塊鏈到底是擊垮資本怪獸的解藥,還是其實只不過是另一個資本家賺錢的手段,值得令人省思。