Money & Payments III - Blockchain & Smart Contracts: Nitin Yadav
Money & Payments III - Blockchain & Smart Contracts: Nitin Yadav
Money & Payments III - Blockchain & Smart Contracts: Nitin Yadav
Nitin Yadav
Semester 2, 2019
Quiz 2
2
Announcement for tutorials
● Please shutdown your jupyter notebooks when you are not using the system
○ Some students still have multiple week-1 notebooks running on their accounts
● In tutorial 2, please don’t request more than 10,000 Wei (in total)
○ You cannot exchange these coins for fiat currency!
○ Please don’t abuse the system
■ Try as much as you wish, but please return excess coins back to the Faucet
■ Otherwise, we will do it ourselves (Proof-of-Authority!)
3
Today’s lecture
1. Smart contracts
a. Revisiting the idea of blockchain
b. Self-executing contracts
2. Applications
a. E-estonia
b. Trade finance
3. Assignments 1 & 2
4. Guest lecture
4
1. Smart contracts
5
Blockchain
7
Blockchain
1. How to manage the custom data in a blockchain (i.e., inside the system)?
○ Rules for verifying currency transactions in Bitcoin and Ethereum are pre-specified
○ If one owns custom data, how can one define rules for valid transactions?
i. Smart contracts
2. Who provides and checks the correctness of the data (i.e., outside the system)?
○ There was no need for external verification in Bitcoin/Ethereum as there was minimal
interaction with the external world
i. New currency generated within the system
ii. Exchanges involving fiat currency or goods are outside the system
○ What if the custom data requires verification (e.g., trade records, vehicle details, etc)?
i. “Oracles”: You can ask external entity to verify data correctness
Note: Smart contracts provide a richer set of functionality that we will discuss next. 9
Smart contracts
10
Smart contract example from tutorial
If the conditions are met:
● Requested amount less than the limit
● Faucet still has funds
Faucet Then the Faucet promises to transfer the requested
amount of funds.
withdraw(uint amount)
:condition -> amount < limit
Request Ether
transaction
(signed)
Transfer Ether
transaction
User
11
Smart contracts
Faucet Car
0xe09639Bd8DEfd6A8868F84e6010DB9c6cC49Ac74 0xe09123da4….
withdraw(uint amount) getColor()
:condition -> amount < limit
Transfer Ether
transaction Car’s color
Note: We do not endorse or promote any of the mentioned applications. Our purpose is to show potential use cases of the
technologies discussed in lecture 2.
17
E-estonia
“I should have called the Estonians when we were setting up our health care website.”
- Barack Obama in 2014.
● Estonia
○ A northern European country with a population of around 1.3 M
○ Most digitally advanced society (according to “Wired”)
■ 98% of government interactions are online
■ https://www.wired.co.uk/article/digital-estonia
○ First country to hold elections over of the internet
○ First country to provide e-residency
■ Allows non-estonians to access Estonia’s digital services
● Start a company, access banks, lodge tax returns, etc.
18
E-estonia
● Each citizen has a card that contains their private key
○ This establishes a secure digital identity (recall the cryptography slides from week 2)
○ Works across government and private systems
○ Digital signatures saved ~20 minutes per transaction (according to a World Bank report)
○ Used for:
■ Online banking
■ Taxation
■ Health records and drug prescriptions
■ Voting
Sources: http://documents.worldbank.org/curated/en/896971468194972881/pdf/102725-PUB-Replacement-PUBLIC.pdf 19
E-estonia
● X-Road
○ Internet based decentralised system to allow for information sharing
■ Participating entities retain ownership of data
○ Around 900 (as of 2013) participating entities, 70% government and 30% private
○ Around 67% (as of 2013) of queries were automated exchanges between systems
○ Backed by policy: Requesting information already stored via X-Road is prohibited
https://www.pwc.com/gx/en/services/legal/tech/assets/estonia-the-digital-republic-secured-by-blockchain.pdf 20
E-estonia
● Blockchain
○ First country to have a nation-wide blockchain system
○ Hashes are stored in the blockchain
■ Provides scalability and speed
■ Data resides on respective systems
○ Data breaches are detected instantly
○ Provides a consistent view of the data
■ E-health records case notes, doctor visits, test results, drug prescriptions and access log
■ Public safety
● Driving license information recorded against digital id
● Time to access information reduced from 15-20 minutes (using radio) to ~2s (using
blockchain)
■ Many others → https://e-estonia.com/solutions/
Sources: http://documents.worldbank.org/curated/en/896971468194972881/pdf/102725-PUB-Replacement-PUBLIC.pdf, 21
https://www.pwc.com/gx/en/services/legal/tech/assets/estonia-the-digital-republic-secured-by-blockchain.pdf
Trade finance
● Incorporates use of financial products to facilitate international trade
● WTO estimates that around 80 to 90% of world trade depends on trade
finance
● Suppose an Australian importer wants to import an exotic fruit from an
exporter in San Marcos
○ The importer does not trust the exporter, hence, does not want to pre-pay
○ The exporter will not ship the fruit unless she is guaranteed payment
○ The shipping involves multiple ports
● Solution
○ The importer can get a letter of credit from its bank
■ Guarantees release of payment conditional on
shipment
○ The exporter provides bills of lading as proof of
shipment Australian Imports. Source: https://oec.world/en/profile/country/aus/
22
Source: https://www.wto.org/english/thewto_e/coher_e/tr_finance_e.htm
Trade finance
● Blockchain-based solution
○ Generation of letters of credit
■ Time can be reduced from 7 to 10 days to under 4 hours!
○ Automatic verification of shipping information
■ Tracking of goods recorded on blockchain
○ Automatic release of payments
■ Using smart contracts
○ Possible drawback is that all components need to be on blockchain
○ Major Australian banks are trialing blockchain-based solutions
23
Source: https://cib.db.com/insights-and-initiatives/flow/trade_finance_and_the_blockchain_three_essential_case_studies.htm
3. Assignments 1 & 2
24
Assignments 1 & 2
● A second-hand car market on blockchain
○ Underlying problem is information asymmetry
■ Buyer does not know the quality of the car but seller knows if her car is “good” or “bad”
■ Buyer knows the overall proportion of good and bad cars in the economy
○ How can a blockchain help?
■ Stores vehicle’s attributes on blockchain
■ Reduces (aggregate) information asymmetry
■ Allows for smart contracts (conditional offer price)
○ Buyers have incentives to trade in the “blockchain market”
■ Need a BMM Coin (token) to place an offer in the blockchain market
● Why not buy in a traditional market?
○ Think about information asymmetries!
Assignment 1: In a ICO of BMM Coins, how much should a buyer be willing to pay to get access to the
blockchain market? More details in next week’s tutorial...
25
4. Guest lecture
26
Volt Bank
27
Dominic Ng
28
Next week
● Lecture
○ Quiz 3
○ Financial advice
● Tutorials
○ Preparing for the assignment
● Mandatory readings:
○ “IBM's Blockchain Consortium With The Seam Deploys 'Hyperledger' For Cotton Trading” by
Roger Aitken on Forbes.com
https://www.forbes.com/sites/rogeraitken/2017/01/07/ibms-blockchain-consortium-with-the-seam-deploys-hyperledge
r-for-cotton-trading/#481e77797e8a
○ “Trade finance and the blockchain -e fin three essential case studies” by Deutsche Bank
https://cib.db.com/insights-and-initiatives/flow/trade_finance_and_the_blockchain_three_essential_case_studies.htm
29