SlideShare uma empresa Scribd logo
1 de 34
SMART
CONTRACT
林修平
CONTRACT
• What’s a contract?
• voluntary arrangement between two or more parties
• legally binding agreement
• buying, selling, renting, leasing, insurance, investment, etc.
• actively or inactively perform
“SMART” CONTRACT
• How to perform : self-enforcing , self executing
• preliminary: terms matched
• “SMART”? How?
• Smart Contract in real-life:
• vending machine
• U-bike, on-line gambling
• what’s the difference between smart contract and automated
service?
“SMART” CONTRACT
smart contract on blockchain
• What differences does it make?
• value of Blockchain
• whom to trust?
• a person?
• a company?
https://en.wikipedia.org/wiki/Financial_crisis_of_2007–08
• government?
https://en.wikipedia.org/wiki/Watergate_scandal
• or program and mathematics?
• its totally up to you
• reach an agreement with untrustful party
smart contract on blockchain
• https://www.thenewslens.com/article/11796
• a washing machine that can buy detergent itself if needed
• without blockchain
• cash flow :
• online payment -> companies that sells detergent -> transportation companies
• what’s the cost?
• time, efforts on checking status and verify
• what if something went wrong?
• how long does it take to find out the problem?
• who will find out the problem?
• how long do I have to wait?
smart contract on blockchain
• https://www.thenewslens.com/article/11796
• a washing machine that can buy detergent itself if needed
• with blockchain
• cash flow :
• online payment -> companies that sells detergent -> transportation companies
• what’s the cost?
• transaction fee
• what if something went wrong?
• how long does it take to find out the problem?
• who will find out the problem?
• how long do I have to wait?
smart contract on blockchain
BLOCKCHAIN + IOT
• IOT
• a device connecting to Internet?
• machine to machine
• how does it make sure it is not talking to a malicious node?
• can try
• how to make sure what it says is true?
• share same information
• distributed?
• can an IOT device provide such capability in its storage unit?
• decentralized?
BLOCKCHAIN + IOT?
• main problems in IOT
• Security
• hardware resource
BLOCKCHAIN + IOT?
CHALLENGE
CHALLENGE
• External Information
• Liquidity
• has no control beyond ledgers
• say you start a bet on tomorrow’s game score…
• how do you provide the score to smart contract?
• fetch the source from outside?
• which source to trust?
• can everyone fetch from the same source?
• will it expire? disappear? change from time to time?
• for now, smart contracts on blockchain can not fetch external information itself
• provided by third party
CHALLENGE
• External Information
• Liquidity
• has no control beyond ledgers
• suppose you start an insurance contract with insurance
company, is the money you pay monthly going to stay in there
indefinitely?
• no, like deposit in a bank, the company will make the best
out of the money which means the money will only be
there when something happened…
• then, how can the terms in smart contract be enforced?
CHALLENGE
• External Information
• Liquidity
• has no control beyond ledgers
• How do you enforce in the real world? probably by litigation
• but how is smart contract different from legacy contract?
Ethereum smart contract
Ethereum smart contract
• Turing Complete
• conditional branching
• loop
• ability to change arbitrary amount of memory
Ethereum smart contract
• Bitcoin
• Turing incompleteness
• OP_IF, OP_NOTIF, OP_ELSE, OP_ENDIF
• stateless
• stack-based language
• no loop
• made purposely
• prevent costly and infinite computation
Ethereum smart contract
• Turing Complete
• conditional branching
• loop
• ability to change arbitrary amount of memory
• powerful
• how to deal with malicious code, e.g. infinite loop?
• gas
• each operation has a price(gas)
• pay for gas where user decides how much to pay per unit gas
• pay with ether
Ethereum smart contract
• How does it work?
• 1. write your contract
Ethereum smart contract
• How does it work?
• 1. write your contract
• 2. compile it to byte code
Ethereum smart contract
• How does it work?
• 1. write your contract
• 2. compile it to byte
code
• 3. broadcasted and
mined
Ethereum smart contract
• How does it work?
• 1. write your contract
• 2. compile it to byte
code
• 3. broadcasted and
mined
• 4. invoke transaction
Ethereum smart contract
• contract language
• Serpent
• python-like
• Solidity
• javascript-like
Ethereum smart contract
• How does it work?
• 1. write your contract
• 2. compile it to byte code
• 3. broadcasted and mined
• 4. invoke transaction
https://ethereum.github.io/browser-solidity/
https://github.com/ethereum/go-
ethereum/wiki/Building-Ethereum
https://github.com/ethereum/mist/releases
living example : DAO
living example : DAO
• Decentralized Autonomous Organization
• by slock.it
• crowdfunding
• vote by your share
• profit by your share
• child DAO
• to prevent abuse of majority voting
living example : DAO
• Recursive calling vulnerability
• propose a split -> execute the split -> withdraw
• propose a split -> execute the split -> propose a split ->
execute the split -> withdraw
living example : DAO
• function splitDAO
problem1
problem2
living example : DAO
• function withdrawRewardFor
problem1
living example : DAO
• function payOut
problem1
• address.call.value(amount)
• supply with enough gas
• if address refers to a contract, it triggers fallback function
• do what whatever you want as long as enough gas remaining
• call to splitDAO again in fallback function
living example : DAO
• function splitDAO
problem2
• cleans up his/her balance after sending the money
living example : DAO
• counter measure :
• use address.send(amount)
• 2300 gas
• don’t execute address.call.value(amount) to untrusted code
• limit gas in address.call.value(amount)
• address.call.gas(gas_amount).value(amount)
• cleans up the balance before sending money
• then check if sending succed, if not ,rollback
living example : DAO
• what happens after?
• votes for hard fork
• choose to stay, becomes ETC
• choose to fork, becomes ETH
• Ethereum foundation, token holders, immutability believers
• too much money to fail? lawsuits?
• what do you believe?

Mais conteúdo relacionado

Mais procurados

Blockchain basics
Blockchain basicsBlockchain basics
Blockchain basicsRomit Bose
 
Introduction to Blockchain and Smart Contracts
Introduction to Blockchain and Smart ContractsIntroduction to Blockchain and Smart Contracts
Introduction to Blockchain and Smart ContractsTechracers
 
Blockchain Technology Fundamentals
Blockchain Technology FundamentalsBlockchain Technology Fundamentals
Blockchain Technology FundamentalsExperfy
 
Introduction to Blockchain
Introduction to BlockchainIntroduction to Blockchain
Introduction to BlockchainMalak Abu Hammad
 
Overview of Blockchain Consensus Mechanisms
Overview of Blockchain Consensus MechanismsOverview of Blockchain Consensus Mechanisms
Overview of Blockchain Consensus MechanismsJohannes Ahlmann
 
An introduction to blockchain and hyperledger v ru
An introduction to blockchain and hyperledger v ruAn introduction to blockchain and hyperledger v ru
An introduction to blockchain and hyperledger v ruLennartF
 
que es la blockchain y como funciona
que es la blockchain y como funcionaque es la blockchain y como funciona
que es la blockchain y como funcionaVic Perez
 
Types of Blockchains
Types of BlockchainsTypes of Blockchains
Types of BlockchainsVikram Khanna
 
Ethereum Blockchain with Smart contract and ERC20
Ethereum Blockchain with Smart contract and ERC20Ethereum Blockchain with Smart contract and ERC20
Ethereum Blockchain with Smart contract and ERC20Truong Nguyen
 
BLOCKCHAIN TECHNOLOGY.ppt
BLOCKCHAIN TECHNOLOGY.pptBLOCKCHAIN TECHNOLOGY.ppt
BLOCKCHAIN TECHNOLOGY.pptjishnub8
 
Blockchain: The New Technology of Trust
Blockchain: The New Technology of TrustBlockchain: The New Technology of Trust
Blockchain: The New Technology of TrustMacha Pujitha
 
Bitcoin, Ethereum, Smart Contract & Blockchain
Bitcoin, Ethereum, Smart Contract & BlockchainBitcoin, Ethereum, Smart Contract & Blockchain
Bitcoin, Ethereum, Smart Contract & BlockchainJitendra Chittoda
 
Blockchain: The New Technology and Its Applications for Libraries
Blockchain: The New Technology and Its Applications for LibrariesBlockchain: The New Technology and Its Applications for Libraries
Blockchain: The New Technology and Its Applications for LibrariesBohyun Kim
 
Blockchain - HyperLedger Fabric
Blockchain - HyperLedger FabricBlockchain - HyperLedger Fabric
Blockchain - HyperLedger FabricAraf Karsh Hamid
 

Mais procurados (20)

Blockchain basics
Blockchain basicsBlockchain basics
Blockchain basics
 
Blockchain
BlockchainBlockchain
Blockchain
 
Introduction to Blockchain and Smart Contracts
Introduction to Blockchain and Smart ContractsIntroduction to Blockchain and Smart Contracts
Introduction to Blockchain and Smart Contracts
 
Blockchain Technology Fundamentals
Blockchain Technology FundamentalsBlockchain Technology Fundamentals
Blockchain Technology Fundamentals
 
Introduction to Blockchain
Introduction to BlockchainIntroduction to Blockchain
Introduction to Blockchain
 
Overview of Blockchain Consensus Mechanisms
Overview of Blockchain Consensus MechanismsOverview of Blockchain Consensus Mechanisms
Overview of Blockchain Consensus Mechanisms
 
Ethereum 2.0
Ethereum 2.0Ethereum 2.0
Ethereum 2.0
 
An introduction to blockchain and hyperledger v ru
An introduction to blockchain and hyperledger v ruAn introduction to blockchain and hyperledger v ru
An introduction to blockchain and hyperledger v ru
 
Blockchain concepts
Blockchain conceptsBlockchain concepts
Blockchain concepts
 
que es la blockchain y como funciona
que es la blockchain y como funcionaque es la blockchain y como funciona
que es la blockchain y como funciona
 
Types of Blockchains
Types of BlockchainsTypes of Blockchains
Types of Blockchains
 
Blockchain
Blockchain Blockchain
Blockchain
 
Ethereum Blockchain with Smart contract and ERC20
Ethereum Blockchain with Smart contract and ERC20Ethereum Blockchain with Smart contract and ERC20
Ethereum Blockchain with Smart contract and ERC20
 
Blockchain ppt
Blockchain pptBlockchain ppt
Blockchain ppt
 
BLOCKCHAIN TECHNOLOGY.ppt
BLOCKCHAIN TECHNOLOGY.pptBLOCKCHAIN TECHNOLOGY.ppt
BLOCKCHAIN TECHNOLOGY.ppt
 
Blockchain: The New Technology of Trust
Blockchain: The New Technology of TrustBlockchain: The New Technology of Trust
Blockchain: The New Technology of Trust
 
Unlocking Blockchain’s Potential
Unlocking Blockchain’s PotentialUnlocking Blockchain’s Potential
Unlocking Blockchain’s Potential
 
Bitcoin, Ethereum, Smart Contract & Blockchain
Bitcoin, Ethereum, Smart Contract & BlockchainBitcoin, Ethereum, Smart Contract & Blockchain
Bitcoin, Ethereum, Smart Contract & Blockchain
 
Blockchain: The New Technology and Its Applications for Libraries
Blockchain: The New Technology and Its Applications for LibrariesBlockchain: The New Technology and Its Applications for Libraries
Blockchain: The New Technology and Its Applications for Libraries
 
Blockchain - HyperLedger Fabric
Blockchain - HyperLedger FabricBlockchain - HyperLedger Fabric
Blockchain - HyperLedger Fabric
 

Destaque

部署並執行以太坊智能合約
部署並執行以太坊智能合約部署並執行以太坊智能合約
部署並執行以太坊智能合約Nicholas Lin
 
以太坊智能合約撰寫簡單教學
以太坊智能合約撰寫簡單教學以太坊智能合約撰寫簡單教學
以太坊智能合約撰寫簡單教學Nicholas Lin
 
智能合約結合區塊鏈簡介
智能合約結合區塊鏈簡介智能合約結合區塊鏈簡介
智能合約結合區塊鏈簡介Nicholas Lin
 
Solidity Simple Tutorial EN
Solidity Simple Tutorial ENSolidity Simple Tutorial EN
Solidity Simple Tutorial ENNicholas Lin
 
Blockchain Smart Contracts - getting from hype to reality
Blockchain Smart Contracts - getting from hype to reality Blockchain Smart Contracts - getting from hype to reality
Blockchain Smart Contracts - getting from hype to reality Capgemini
 
區塊鏈智能合約應用於點數平台之架構
區塊鏈智能合約應用於點數平台之架構區塊鏈智能合約應用於點數平台之架構
區塊鏈智能合約應用於點數平台之架構Nicholas Lin
 
CopyRightContractDemo
CopyRightContractDemoCopyRightContractDemo
CopyRightContractDemoNicholas Lin
 
Defining Smart Contracts
Defining Smart ContractsDefining Smart Contracts
Defining Smart ContractsTim Swanson
 
以比特幣為例的區塊鏈技術介紹 ( Intro to Blockchain using Bitcoin as an example)
以比特幣為例的區塊鏈技術介紹 ( Intro to Blockchain using Bitcoin as an example)以比特幣為例的區塊鏈技術介紹 ( Intro to Blockchain using Bitcoin as an example)
以比特幣為例的區塊鏈技術介紹 ( Intro to Blockchain using Bitcoin as an example)Nicholas Lin
 
Blockchain, smart contracts - introduction
Blockchain, smart contracts - introductionBlockchain, smart contracts - introduction
Blockchain, smart contracts - introductionLukasz Jarmulowicz
 
Introduction to blockchain and smart contracts
Introduction to blockchain and smart contractsIntroduction to blockchain and smart contracts
Introduction to blockchain and smart contractsValidity Labs
 
從開發人員角度十分鐘理解區塊鏈技術
從開發人員角度十分鐘理解區塊鏈技術從開發人員角度十分鐘理解區塊鏈技術
從開發人員角度十分鐘理解區塊鏈技術Will Huang
 
Blockchain and Smart Contract Long Term Security (updated)
Blockchain and Smart Contract Long Term Security (updated)Blockchain and Smart Contract Long Term Security (updated)
Blockchain and Smart Contract Long Term Security (updated)Peter Robinson
 
區塊鏈科技趨勢與應用
區塊鏈科技趨勢與應用區塊鏈科技趨勢與應用
區塊鏈科技趨勢與應用Jacob Lee
 
State Of Smart Contract Platforms from Smart Contract JP
State Of Smart Contract Platforms from Smart Contract JP State Of Smart Contract Platforms from Smart Contract JP
State Of Smart Contract Platforms from Smart Contract JP Tomoaki Sato
 
BlockChain, Bitcoin and Smart Contracts - Oleg Kudrenko
BlockChain, Bitcoin and Smart Contracts - Oleg KudrenkoBlockChain, Bitcoin and Smart Contracts - Oleg Kudrenko
BlockChain, Bitcoin and Smart Contracts - Oleg KudrenkoOleg Kudrenko
 
Hacking Finance: Crypto & Math based Currencies, Smart contracts and Blockch...
Hacking Finance: Crypto & Math based Currencies, Smart contracts  and Blockch...Hacking Finance: Crypto & Math based Currencies, Smart contracts  and Blockch...
Hacking Finance: Crypto & Math based Currencies, Smart contracts and Blockch...Raffaele Mauro
 
Effacts Academy - Smart Contract Management
Effacts Academy - Smart Contract ManagementEffacts Academy - Smart Contract Management
Effacts Academy - Smart Contract ManagementLegal Manager
 

Destaque (20)

部署並執行以太坊智能合約
部署並執行以太坊智能合約部署並執行以太坊智能合約
部署並執行以太坊智能合約
 
以太坊智能合約撰寫簡單教學
以太坊智能合約撰寫簡單教學以太坊智能合約撰寫簡單教學
以太坊智能合約撰寫簡單教學
 
智能合約結合區塊鏈簡介
智能合約結合區塊鏈簡介智能合約結合區塊鏈簡介
智能合約結合區塊鏈簡介
 
Solidity Simple Tutorial EN
Solidity Simple Tutorial ENSolidity Simple Tutorial EN
Solidity Simple Tutorial EN
 
Blockchain Smart Contracts - getting from hype to reality
Blockchain Smart Contracts - getting from hype to reality Blockchain Smart Contracts - getting from hype to reality
Blockchain Smart Contracts - getting from hype to reality
 
區塊鏈智能合約應用於點數平台之架構
區塊鏈智能合約應用於點數平台之架構區塊鏈智能合約應用於點數平台之架構
區塊鏈智能合約應用於點數平台之架構
 
CopyRightContractDemo
CopyRightContractDemoCopyRightContractDemo
CopyRightContractDemo
 
Defining Smart Contracts
Defining Smart ContractsDefining Smart Contracts
Defining Smart Contracts
 
以比特幣為例的區塊鏈技術介紹 ( Intro to Blockchain using Bitcoin as an example)
以比特幣為例的區塊鏈技術介紹 ( Intro to Blockchain using Bitcoin as an example)以比特幣為例的區塊鏈技術介紹 ( Intro to Blockchain using Bitcoin as an example)
以比特幣為例的區塊鏈技術介紹 ( Intro to Blockchain using Bitcoin as an example)
 
Blockchain, smart contracts - introduction
Blockchain, smart contracts - introductionBlockchain, smart contracts - introduction
Blockchain, smart contracts - introduction
 
Introduction to blockchain and smart contracts
Introduction to blockchain and smart contractsIntroduction to blockchain and smart contracts
Introduction to blockchain and smart contracts
 
從開發人員角度十分鐘理解區塊鏈技術
從開發人員角度十分鐘理解區塊鏈技術從開發人員角度十分鐘理解區塊鏈技術
從開發人員角度十分鐘理解區塊鏈技術
 
Blockchain and Smart Contract Long Term Security (updated)
Blockchain and Smart Contract Long Term Security (updated)Blockchain and Smart Contract Long Term Security (updated)
Blockchain and Smart Contract Long Term Security (updated)
 
區塊鏈科技趨勢與應用
區塊鏈科技趨勢與應用區塊鏈科技趨勢與應用
區塊鏈科技趨勢與應用
 
Smart contracts
Smart contractsSmart contracts
Smart contracts
 
State Of Smart Contract Platforms from Smart Contract JP
State Of Smart Contract Platforms from Smart Contract JP State Of Smart Contract Platforms from Smart Contract JP
State Of Smart Contract Platforms from Smart Contract JP
 
Writing smart contracts
Writing smart contractsWriting smart contracts
Writing smart contracts
 
BlockChain, Bitcoin and Smart Contracts - Oleg Kudrenko
BlockChain, Bitcoin and Smart Contracts - Oleg KudrenkoBlockChain, Bitcoin and Smart Contracts - Oleg Kudrenko
BlockChain, Bitcoin and Smart Contracts - Oleg Kudrenko
 
Hacking Finance: Crypto & Math based Currencies, Smart contracts and Blockch...
Hacking Finance: Crypto & Math based Currencies, Smart contracts  and Blockch...Hacking Finance: Crypto & Math based Currencies, Smart contracts  and Blockch...
Hacking Finance: Crypto & Math based Currencies, Smart contracts and Blockch...
 
Effacts Academy - Smart Contract Management
Effacts Academy - Smart Contract ManagementEffacts Academy - Smart Contract Management
Effacts Academy - Smart Contract Management
 

Semelhante a SMART CONTRACTS: BLOCKCHAIN TECHNOLOGY AND ETHEREUM SMART CONTRACTS EXPLAINED

Smart contractjp smartcontract_about
Smart contractjp smartcontract_aboutSmart contractjp smartcontract_about
Smart contractjp smartcontract_aboutTomoaki Sato
 
Privacy Preserving Paradigms of Blockchain Technology
Privacy Preserving Paradigms of Blockchain TechnologyPrivacy Preserving Paradigms of Blockchain Technology
Privacy Preserving Paradigms of Blockchain TechnologyGokul Alex
 
Blockchain tutorial for MBA
Blockchain tutorial for MBABlockchain tutorial for MBA
Blockchain tutorial for MBABlokcert
 
Practical Challenges for Public Blockchains
Practical Challenges for Public BlockchainsPractical Challenges for Public Blockchains
Practical Challenges for Public BlockchainsJohannes Ahlmann
 
Practical Challenges for Public Blockchains
Practical Challenges for Public BlockchainsPractical Challenges for Public Blockchains
Practical Challenges for Public BlockchainsJohannes Ahlmann
 
blockchain and iot: Opportunities and Challanges
blockchain and iot: Opportunities and Challangesblockchain and iot: Opportunities and Challanges
blockchain and iot: Opportunities and ChallangesChetan Kumar S
 
From 7331 to legal : a selection of blockchain discussion topics
From 7331 to legal : a selection of blockchain discussion topicsFrom 7331 to legal : a selection of blockchain discussion topics
From 7331 to legal : a selection of blockchain discussion topicsKoen Vingerhoets
 
20190316 - CLBFest - 1337 to legal - Koen Vingerhoets
20190316 - CLBFest - 1337 to legal - Koen Vingerhoets20190316 - CLBFest - 1337 to legal - Koen Vingerhoets
20190316 - CLBFest - 1337 to legal - Koen VingerhoetsBrussels Legal Hackers
 
Is Blockchain Right for You? The Million Dollar Question
Is Blockchain Right for You? The Million Dollar QuestionIs Blockchain Right for You? The Million Dollar Question
Is Blockchain Right for You? The Million Dollar QuestionSecurity Innovation
 
Demystifying Smart Contracts
Demystifying Smart ContractsDemystifying Smart Contracts
Demystifying Smart ContractsBernard Peh
 
Blockchain Projects - Core Pillars of Shipping Product, Feb 2018
Blockchain Projects - Core Pillars of Shipping Product, Feb 2018Blockchain Projects - Core Pillars of Shipping Product, Feb 2018
Blockchain Projects - Core Pillars of Shipping Product, Feb 2018🔗Audrey Chaing
 
What is bitcoin?
What is bitcoin?What is bitcoin?
What is bitcoin?Suraj Bora
 
Week 4 - DApps, Smart Contracts, and Decentralized Incentive Systems
Week 4 - DApps, Smart Contracts, and Decentralized Incentive SystemsWeek 4 - DApps, Smart Contracts, and Decentralized Incentive Systems
Week 4 - DApps, Smart Contracts, and Decentralized Incentive SystemsRoger Royse
 
Blockchain in enterprise - Challenges, Considerations and Designs
Blockchain in enterprise - Challenges, Considerations and DesignsBlockchain in enterprise - Challenges, Considerations and Designs
Blockchain in enterprise - Challenges, Considerations and DesignsMichael Chi
 
How to not Destroy Millions in Smart Contracts
How to not Destroy Millions in Smart ContractsHow to not Destroy Millions in Smart Contracts
How to not Destroy Millions in Smart ContractsLeonid Beder
 
Blockchain & crypto
Blockchain & cryptoBlockchain & crypto
Blockchain & cryptoAtul Mangat
 

Semelhante a SMART CONTRACTS: BLOCKCHAIN TECHNOLOGY AND ETHEREUM SMART CONTRACTS EXPLAINED (20)

Smart contractjp smartcontract_about
Smart contractjp smartcontract_aboutSmart contractjp smartcontract_about
Smart contractjp smartcontract_about
 
Privacy Preserving Paradigms of Blockchain Technology
Privacy Preserving Paradigms of Blockchain TechnologyPrivacy Preserving Paradigms of Blockchain Technology
Privacy Preserving Paradigms of Blockchain Technology
 
Blockchain
BlockchainBlockchain
Blockchain
 
Blockchain tutorial for MBA
Blockchain tutorial for MBABlockchain tutorial for MBA
Blockchain tutorial for MBA
 
Practical Challenges for Public Blockchains
Practical Challenges for Public BlockchainsPractical Challenges for Public Blockchains
Practical Challenges for Public Blockchains
 
Practical Challenges for Public Blockchains
Practical Challenges for Public BlockchainsPractical Challenges for Public Blockchains
Practical Challenges for Public Blockchains
 
Blockchain
BlockchainBlockchain
Blockchain
 
blockchain and iot: Opportunities and Challanges
blockchain and iot: Opportunities and Challangesblockchain and iot: Opportunities and Challanges
blockchain and iot: Opportunities and Challanges
 
From 7331 to legal : a selection of blockchain discussion topics
From 7331 to legal : a selection of blockchain discussion topicsFrom 7331 to legal : a selection of blockchain discussion topics
From 7331 to legal : a selection of blockchain discussion topics
 
20190316 - CLBFest - 1337 to legal - Koen Vingerhoets
20190316 - CLBFest - 1337 to legal - Koen Vingerhoets20190316 - CLBFest - 1337 to legal - Koen Vingerhoets
20190316 - CLBFest - 1337 to legal - Koen Vingerhoets
 
Is Blockchain Right for You? The Million Dollar Question
Is Blockchain Right for You? The Million Dollar QuestionIs Blockchain Right for You? The Million Dollar Question
Is Blockchain Right for You? The Million Dollar Question
 
Blockchain
Blockchain Blockchain
Blockchain
 
Demystifying Smart Contracts
Demystifying Smart ContractsDemystifying Smart Contracts
Demystifying Smart Contracts
 
Blockchain Projects - Core Pillars of Shipping Product, Feb 2018
Blockchain Projects - Core Pillars of Shipping Product, Feb 2018Blockchain Projects - Core Pillars of Shipping Product, Feb 2018
Blockchain Projects - Core Pillars of Shipping Product, Feb 2018
 
What is bitcoin?
What is bitcoin?What is bitcoin?
What is bitcoin?
 
Week 4 - DApps, Smart Contracts, and Decentralized Incentive Systems
Week 4 - DApps, Smart Contracts, and Decentralized Incentive SystemsWeek 4 - DApps, Smart Contracts, and Decentralized Incentive Systems
Week 4 - DApps, Smart Contracts, and Decentralized Incentive Systems
 
Block chain
Block chainBlock chain
Block chain
 
Blockchain in enterprise - Challenges, Considerations and Designs
Blockchain in enterprise - Challenges, Considerations and DesignsBlockchain in enterprise - Challenges, Considerations and Designs
Blockchain in enterprise - Challenges, Considerations and Designs
 
How to not Destroy Millions in Smart Contracts
How to not Destroy Millions in Smart ContractsHow to not Destroy Millions in Smart Contracts
How to not Destroy Millions in Smart Contracts
 
Blockchain & crypto
Blockchain & cryptoBlockchain & crypto
Blockchain & crypto
 

Último

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 

Último (20)

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 

SMART CONTRACTS: BLOCKCHAIN TECHNOLOGY AND ETHEREUM SMART CONTRACTS EXPLAINED

  • 2. CONTRACT • What’s a contract? • voluntary arrangement between two or more parties • legally binding agreement • buying, selling, renting, leasing, insurance, investment, etc. • actively or inactively perform
  • 4. • How to perform : self-enforcing , self executing • preliminary: terms matched • “SMART”? How? • Smart Contract in real-life: • vending machine • U-bike, on-line gambling • what’s the difference between smart contract and automated service? “SMART” CONTRACT
  • 5. smart contract on blockchain
  • 6. • What differences does it make? • value of Blockchain • whom to trust? • a person? • a company? https://en.wikipedia.org/wiki/Financial_crisis_of_2007–08 • government? https://en.wikipedia.org/wiki/Watergate_scandal • or program and mathematics? • its totally up to you • reach an agreement with untrustful party smart contract on blockchain
  • 7. • https://www.thenewslens.com/article/11796 • a washing machine that can buy detergent itself if needed • without blockchain • cash flow : • online payment -> companies that sells detergent -> transportation companies • what’s the cost? • time, efforts on checking status and verify • what if something went wrong? • how long does it take to find out the problem? • who will find out the problem? • how long do I have to wait? smart contract on blockchain
  • 8. • https://www.thenewslens.com/article/11796 • a washing machine that can buy detergent itself if needed • with blockchain • cash flow : • online payment -> companies that sells detergent -> transportation companies • what’s the cost? • transaction fee • what if something went wrong? • how long does it take to find out the problem? • who will find out the problem? • how long do I have to wait? smart contract on blockchain
  • 10. • IOT • a device connecting to Internet? • machine to machine • how does it make sure it is not talking to a malicious node? • can try • how to make sure what it says is true? • share same information • distributed? • can an IOT device provide such capability in its storage unit? • decentralized? BLOCKCHAIN + IOT?
  • 11. • main problems in IOT • Security • hardware resource BLOCKCHAIN + IOT?
  • 13. CHALLENGE • External Information • Liquidity • has no control beyond ledgers • say you start a bet on tomorrow’s game score… • how do you provide the score to smart contract? • fetch the source from outside? • which source to trust? • can everyone fetch from the same source? • will it expire? disappear? change from time to time? • for now, smart contracts on blockchain can not fetch external information itself • provided by third party
  • 14. CHALLENGE • External Information • Liquidity • has no control beyond ledgers • suppose you start an insurance contract with insurance company, is the money you pay monthly going to stay in there indefinitely? • no, like deposit in a bank, the company will make the best out of the money which means the money will only be there when something happened… • then, how can the terms in smart contract be enforced?
  • 15. CHALLENGE • External Information • Liquidity • has no control beyond ledgers • How do you enforce in the real world? probably by litigation • but how is smart contract different from legacy contract?
  • 17. Ethereum smart contract • Turing Complete • conditional branching • loop • ability to change arbitrary amount of memory
  • 18. Ethereum smart contract • Bitcoin • Turing incompleteness • OP_IF, OP_NOTIF, OP_ELSE, OP_ENDIF • stateless • stack-based language • no loop • made purposely • prevent costly and infinite computation
  • 19. Ethereum smart contract • Turing Complete • conditional branching • loop • ability to change arbitrary amount of memory • powerful • how to deal with malicious code, e.g. infinite loop? • gas • each operation has a price(gas) • pay for gas where user decides how much to pay per unit gas • pay with ether
  • 20. Ethereum smart contract • How does it work? • 1. write your contract
  • 21. Ethereum smart contract • How does it work? • 1. write your contract • 2. compile it to byte code
  • 22. Ethereum smart contract • How does it work? • 1. write your contract • 2. compile it to byte code • 3. broadcasted and mined
  • 23. Ethereum smart contract • How does it work? • 1. write your contract • 2. compile it to byte code • 3. broadcasted and mined • 4. invoke transaction
  • 24. Ethereum smart contract • contract language • Serpent • python-like • Solidity • javascript-like
  • 25. Ethereum smart contract • How does it work? • 1. write your contract • 2. compile it to byte code • 3. broadcasted and mined • 4. invoke transaction https://ethereum.github.io/browser-solidity/ https://github.com/ethereum/go- ethereum/wiki/Building-Ethereum https://github.com/ethereum/mist/releases
  • 27. living example : DAO • Decentralized Autonomous Organization • by slock.it • crowdfunding • vote by your share • profit by your share • child DAO • to prevent abuse of majority voting
  • 28. living example : DAO • Recursive calling vulnerability • propose a split -> execute the split -> withdraw • propose a split -> execute the split -> propose a split -> execute the split -> withdraw
  • 29. living example : DAO • function splitDAO problem1 problem2
  • 30. living example : DAO • function withdrawRewardFor problem1
  • 31. living example : DAO • function payOut problem1 • address.call.value(amount) • supply with enough gas • if address refers to a contract, it triggers fallback function • do what whatever you want as long as enough gas remaining • call to splitDAO again in fallback function
  • 32. living example : DAO • function splitDAO problem2 • cleans up his/her balance after sending the money
  • 33. living example : DAO • counter measure : • use address.send(amount) • 2300 gas • don’t execute address.call.value(amount) to untrusted code • limit gas in address.call.value(amount) • address.call.gas(gas_amount).value(amount) • cleans up the balance before sending money • then check if sending succed, if not ,rollback
  • 34. living example : DAO • what happens after? • votes for hard fork • choose to stay, becomes ETC • choose to fork, becomes ETH • Ethereum foundation, token holders, immutability believers • too much money to fail? lawsuits? • what do you believe?