• How to perform : self-enforcing , self executing• Smart Contract in real-life: service?. smart contract on blockchain... • its totally up to you • reach an agreement with untrustful pa
Trang 1SMART CONTRACT
林修平
Trang 2• buying, selling, renting, leasing, insurance, investment, etc
• actively or inactively perform
Trang 3“SMART” CONTRACT
Trang 4• How to perform : self-enforcing , self executing
• Smart Contract in real-life:
service?
“SMART” CONTRACT
Trang 5smart contract on blockchain
Trang 6• What differences does it make?
• or program and mathematics?
• its totally up to you
• reach an agreement with untrustful party
smart contract on blockchain
Trang 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
Trang 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
Trang 9BLOCKCHAIN + IOT
Trang 10• 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?
Trang 11• main problems in IOT
BLOCKCHAIN + IOT?
Trang 12CHALLENGE
Trang 13• 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
Trang 14company, is the money you pay monthly going to stay in there indefinitely?
out of the money which means the money will only be
Trang 15• Liquidity
Trang 16Ethereum smart contract
Trang 18Ethereum smart contract
Trang 19Ethereum smart contract
• each operation has a price(gas)
• pay for gas where user decides how much to pay per unit gas
• pay with ether
Trang 20Ethereum smart contract
• 1 write your contract
Trang 21Ethereum smart contract
• 1 write your contract
• 2 compile it to byte code
Trang 22Ethereum smart contract
• 1 write your contract
• 2 compile it to byte
code
mined
Trang 23Ethereum smart contract
• 1 write your contract
Trang 24Ethereum smart contract
Trang 25Ethereum smart contract
• 1 write your contract
• 2 compile it to byte code
https://ethereum.github.io/browser-solidity/
ethereum/wiki/Building-Ethereum
https://github.com/ethereum/go-https://github.com/ethereum/mist/releases
Trang 26living example : DAO
Trang 27• Decentralized Autonomous Organization
• by slock.it
Trang 28living example : DAO
• Recursive calling vulnerability
• propose a split -> execute the split -> withdraw
• propose a split -> execute the split -> propose a split ->
Trang 29living example : DAO
problem1
problem2
Trang 30living example : DAO
problem1
Trang 31living example : DAO
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
Trang 32living example : DAO
problem2
Trang 33living example : DAO
Trang 34living example : DAO
• votes for hard fork