Smart Contracts
Yanzhen Chen
Department of ISOM, HKUST
Topic Four
Slide 1
Outlines
•
•
•
•
Topic Four
What is a Smart Contract?
Advantage of Smart Contracts
Applications of Smart Contracts
Other Use Cases and Characteristics
Slide 2
What is a Smart Contract?
Wikipedia:
What Nick Szabo proposed in 1994:
A smart contract is a computerized transaction protocol that
executes the terms of a contract.
IBM:
Topic Four
A smart contract is a computer protocol intended to digitally
facilitate, verify, or enforce the negotiation or performance of a
contract.
Smart contracts are lines of code that are stored on a
blockchain and automatically execute when predetermined
terms and conditions are met.
Chaincodes
Slide 3
What is a Smart Contract?
Characteristics of smart contracts
A primitive ancestor of smart contracts
Topic Four
Simply computer programs that acts as agreements where the
terms of the agreement can be programmed with the ability to
self-execute.
Vending machine: Coins in and soda out.
More sophisticated ones
Slide 4
Significance of Smart Contracts on Blockchain
A distributed, append-only ledger of provably signed, sequentially
linked, and cryptographically secured transactions that’s
replicated across a network of computer nodes, with ongoing
updates determined by a software-driven consensus.
Smart contract on blockchain:
1. Immutability (irreversible)
2. Security
3. Can be more transparent
Topic Four
Slide 5
21 Million Cap!
Topic Four
Slide 6
An Example of a Kind-of-Smart Contract
Topic Four
Slide 7
Advantages of Smart Contract
Characteristics of smart contracts on blockchain:
1. Immutability (irreversible)
2. Security (in the sense that the blockchain does not fail easily)
3. Transparency
• Compared to traditional contracts:
•
•
High certainty of contract terms
Can be more transparent (subject to debate)
• Additional benefits over other digital contracts:
•
•
Topic Four
Contracts can be immutable and irreversible
Can be more transparent
Slide 8
How Do Smart Contracts Work?
• Bitcoin
•
•
Intended to be cryptocurrency
Important to understand that Bitcoin protocol are computer
programs
• Script (stack based: linear structure of instructions)
• Most common: send bitcoin to a public key (bitcoin address)
• A few other features: multisignature, locking …
• Ethereum
•
•
•
•
Topic Four
Focus on computation and smart contracts
Use Solidity (a Turing-complete language)
Ethereum Virtual Machine (EVM)
Executing code is not free, Ether
Slide 9
How Do Smart Contracts Work?
• Ethereum
1. Send the application to the system,
the code and associated data is
replicated around the network.
2. Once stored, the Ethereum
Blockchain assigns a unique address
to reference the uploaded code.
3. Execute the code by calling the
program at that address.
Ethereum has three types of transactions:
a) Transfer of Ether
b) Creating a smart contract
c) Transaction with a smart contract
(activate a smart contract)
Topic Four
Slide 10
Outlines
•
•
•
•
Topic Four
What is a Smart Contract?
Advantage of Smart Contracts
Applications of Smart Contracts
Other Use Cases and Characteristics
Slide 11
Use Case of Smart Contracts
• Current use cases
• Banking and financial service contracts
•
Money transfer; flight delay insurance; securities
trading, clearing and settlement
• Prediction markets
• Replacing escrow services
• Token sales: Initial Coin Offering, Securities
Token Offering
Topic Four
Slide 12
Use Case
“Future” use case
•
Transfer of assets
registered on
blockchain
•
Tangible assets (land,
house, vehicles)
Copyrighted contents
(music, etc)
•
Topic Four
Slide 13
Smart Contract: A Case Study
• Remember the scaling issue of Bitcoin?
Topic Four
Slide 14
How Do Smart Contracts Work?
• Ethereum
1. Send the application to the system,
the code and associated data is
replicated around the network.
2. Once stored, the Ethereum
Blockchain assigns a unique address
to reference the uploaded code.
3. Execute the code by calling the
program at that address.
Ethereum has three types of transactions:
a) Transfer of Ether
b) Creating a smart contract
c) Transaction with a smart contract
(activate a smart contract)
Topic Four
Slide 15
Bitcoin’s Scaling problem
• Why are bitcoin transactions so slow?
•
•
•
•
•
Gossip protocol whereby all state modification to the ledger are
broadcast to all participants (consensus)
Visa: 47,000 tps (peak), average hundreds of millions per day
Bitcoin: 7 transactions with 1 megabyte block limit
If assume 300 bytes per transaction, Bitcoin block size would
have to be 8 gigabyte per 10 minutes (block time) to match Visa
Equivalent to 400 terabytes of data per year
• Implication?
•
If Bitcoin were to catch up with Visa by increasing block size,
either its network will collapse, or there will be an extreme
centralization of Bitcoin nodes and miners
• How to enable micropayment on bitcoin network?
Topic Four
Slide 16
How to Accommodate More Transactions?
Have Less Transactions!
“If a tree falls in the forest and no one is around to hear it,
does it make a sound?”
Bartender,
put it on my tab.
Topic Four
Slide 17