Вы находитесь на странице: 1из 77

Blockchain Smart Contracts

Niraj Singhal
26 December 2019
Big Picture ☺
Decentralisation of Communications

Centralised Decentralised Distributed

?
Decentralisation of Media

Centralised Decentralised
Decentralisation of Money

Merkezî GayriMerkezî
A Cypherpunk’s Manifesto

"Privacy is necessary for an open society in the electronic


age. Privacy is not secrecy. A private matter is something
one doesn't want the whole world to know, but a secret
matter is something one doesn't want anybody to know.
Privacy is the power to selectively reveal oneself to the
world."
Eric Hughes; A Cypherpunk’s Manifesto,1993.
Satoshi Paper

"The traditional banking model achieves a level of privacy by limiting


access to information to the parties involved and the trusted third party.
The necessity to announce all transactions publicly precludes this method,
but privacy can still be maintained by breaking the flow of information in
another place: by keeping public keys anonymous. The public can see that
someone is sending an amount to someone else, but without information
linking the transaction to anyone. This is similar to the level of information
released by stock exchanges, where the time and size of individual trades,
the 'tape', is made public, but without telling who the parties were."
Satoshi Paper
"The traditional banking model achieves a level of privacy by limiting
access to information to the parties involved and the trusted third party.
The necessity to announce all transactions publicly precludes this
method, but privacy can still be maintained by breaking the flow of
information in another place: by keeping public keys anonymous. The
public can see that someone is sending an amount to someone else, but
without information linking the transaction to anyone. This is similar to the
level of information released by stock exchanges, where the time and
size of individual trades, the 'tape', is made public, but without telling who
the parties were."
10 years of Bitcoin

1 BTC = 1.309 USD


(29.11.2013)

1 USD = 1.309 BTC


(5.10.2009)
The Evoulution of Money
Digital? Crypto?
Electronic
Money
Digital Crypto
Currency Currency

Network Central Decentral


User Open Private
Transaction Private Public
Security Digital Crypto
Bitcoin; Basics
• Decentralised Network (p2p)
• Private User
• Public Ledger
• Crypto Security

Blockchain
Blockchain; Decentralised
• Decentralised Network (p2p)
• Private User
• Public Ledger
• Crypto Security
Blockchain; Private but Public & Crypto
• Decentralised Network (p2p)
• Private User
• Public Ledger
• Crypto Security
Bitcoin
A network protocol
which enables
p2p (decentralised)
user-anonymous but ledger-transparent
and crypto-secure
financial transactions which provide
faster, cheaper and trust-free
monetary systems for all
Digital Finance Protocol
Blockchain is more…
A network protocol
which enables
p2p (decentralised)
user-anonymous but ledger-transparent
and crypto-secure
financial transactions which provide
faster, cheaper and trust-free
monetary systems for all
Digital Trust Protocol
The Industries Blockchain Disrupts
• Finance • Voting
• Cyber Security • Utilities
• Supply Chain Management • Public Charity
• Forecast Systems • Enegry Grids
• Insurance • CopyRight Systems
• Internet of Things • Health Systems
• Pool transportation • Online Retailing
• Cloud Systems • Real Estate
• Charity Systems • Crowd Funding
Pros-Cons

• Fast, cheap, money/info transfer


• Secure & transparent transactions
• Privacy
• Time-space (customs!) free network structure
• Trust and intermediary free operation
• Irrevocability of transactions
• The excessive consumption of energy
Smart Contracts

Digitalisation of traditional social or commercial protocols


into algorithmic codes in order to initialize and manage the
contract period by eliminating the middlemen
Why ”Smart”?

All promises and conditions are run by an


BlockChain based algorithmic protocol
turned into a Smart Contract code
A SC Code Sample (Car Lease)
Examples: Musicoin
Spotify Apple Music

YouTube Deezer
Supply Chain Smart Contracts
SC based Insurance
Decentralised Wikipedia
Wall Street
Goldman Sachs – Circle Coin
Central Bank Digital Currencies
Evolution of Governance
Centralised Decentralised Distributed
Economy & Society Economy & Society Economy & Society

Autocracy Aristocracy Meritocracy


TRANSFORMATION
Critical Issues
• The balance between privacy and security
– Pseudonym
• The resistance from intermediaries
• Lack of literacy on Digital & Blockchain
What Is a Smart Contract?

• Fundamentally, a “smart contract” is a set


of coded computer functions.
• May incorporate the elements of a binding contract (e.g.,
offer, acceptance, and consideration), or may simply
execute certain terms of a contract.
• Allows self-executing computer code to take actions at
specified times and/or based on reference to the
occurrence or non-occurrence of an action or event (e.g.,
delivery of an asset, weather conditions, or change in a
reference rate).

4
Character of Smart Contracts

• “Smart contract” may be an oxymoron!


• A “smart contract” is not necessarily “smart.”
• The operation is only as smart as the information feed it receives and the
machine code that directs it.

• A “smart contract” may not be a legally binding contract.


• It may be a gift or some other non-contractual transfer.
• It may be only part of a broader contract.
• To the extent a smart contract violates the law, it would not be
binding or enforceable.

5
Understanding Smart Contracts
Key attributes of a smart contract include:

Can authenticate (counter-) Can access or refer to outside


Can automate execution
party identities, the ownership information or data to trigger
processes
of assets and claims of right action(s)

Smart contracts use Smart contracts use Self-execution: A


digital signatures – oracles – a mutually smart contract will take
private cryptographic agreed upon, network- actions, e.g., disperse
keys held by each party authenticated reference payments, without
to verify participation data provider (potentially further action by the
and assent to agreed a third-party); this is a counterparties.
terms. source of information to
determine actions and/or
contractual outcomes, for
example, commodity
prices, weather data,
interest rates, or an event
occurrence. 6
Smart Contracts Leverage Blockchain/DLT
• Smart contracts can be stored and executed on a distributed ledger, an electronic record
that is updated in real-time and intended to be maintained on geographically disperse
servers or nodes.

• Through decentralization, evidence of the smart contract is deployed to all nodes on a


network, which effectively prevents modifications not authorized or agreed by the parties.

• Blockchain is a continuously growing database of permanent records, “blocks,” which are


linked and secured using cryptography.‡

Blockchain of Smart Contracts

Block #FCAC Block #51E5 Block #5DDA Block #E9A2


prev #618C prev #FCAC prev #51E5 prev #5DDA
</> contract 2E12… </> contract 0EBF… </> contract F685… </> contract F008…
</> contract FECB… </> contract 7B4E… </> contract AB1E… </> contract 5FF2…
</> contract 21E0… </> contract 3390… </> contract D7C8… </> contract AC5A…
… … … …

‡ Distributed ledgers may be public or private/permissioned. See “A CFTC Primer on Virtual Currencies,” October 17, 2017, https://www.cftc.gov/LabCFTC/Primers/index.htm
7
Smart Contract Origins
The concept of a smart contract is not new. More than 20 years ago, computer scientist Nick
Szabo stated the following:


“A smart contract is a set of promises, specified in digital form, including
protocols within which the parties perform on the other promises…. The basic
idea of smart contracts is that many kinds of contractual clauses (such as liens,
bonding, delineation of property rights, etc.) can be embedded in the hardware
and software we deal with, in such a way as to make breach of contract

expensive (if desired, sometimes prohibitively so) for the breacher.”‡

Nick Szabo,
Computer Scientist
Smart Contracts Building Blocks for Digital Markets 1996

‡ See Nick Szabo, Smart Contracts: Building Blocks for Digital Markets, 1996,
http://www.fon.hum.uva.nl/rob/Courses/InformationInSpeech/CDROM/Literature/LOTwinterschool2006/szabo.best.vwh.net/smart_contracts_2.html

8
Additional Viewpoints
“A smart contract is a mechanism involving digital assets and two or more parties, where some or all
of the parties put assets in, and assets are automatically redistributed among those parties according
to a formula based on certain data that is not known at the time the contract is initiated.”
Vitalik Buterin, Founder of Ethereum, “DAOs, DACs, DAs and More: An Incomplete Terminology Guide,”
(May 6, 2014), available at https://blog.ethereum.org/2014/05/06/daos-dacs-das-and-more-an-incomplete-
terminology-guide/

“A smart contract is an agreement in digital form that is self-executing and self-enforcing.”


Kevin Werbach, Professor of Legal Studies & Business Ethics,
University of Pennsylvania, Wharton Business School, “The Promise — and Perils — of ‘Smart’ Contracts,”
(May 18, 2017), available at http://knowledge.wharton.upenn.edu/article/what-are-smart-contracts/

“A smart contract is an automatable and enforceable agreement. Automatable by computer, although


some parts may require human input and control. Enforceable either by legal enforcement of rights
and obligations or via tamper-proof execution of computer code.”
ISDA and King and Wood Mallesons, Smart Derivatives Contracts: From Concept to Construction (October 2018),
at 5 (citing Clack, C., Bakshi, V., and Braine, L., “Smart Contract Templates: foundations, design landscape and
research directions” (August 4, 2016, revised March 15, 2017))
9
How contracts are usually enforced
● Ethics

● Social pressure / desire of preserving reputation

● Violence / third party enforcement (e.g. call the cops)


When do we need a smart contract?

When we have a trust problem .


When we do NOT need smart
contracts ?
● When we just want automation

● When we are just looking for distributed


storage/computation

● When you are OK with trusted third parties or you


need them anyway for other aspects of the contract
that the SC cannot cover
Group wallets
E n f o r c i n g t h at at least
t w o o u t of t h re e
m e m b e r s of a g r o u p
h a v e to a g r e e to c r e ate Bob
a valid t ra n s a c t i o n
Alice Carol

Script
BITCOIN
2 <pubKeyAlice> TRANSACTION
<pubKeyBob>
<pubKeyCarol> 3
CHECKMULTISIG

blockchain
Heritage wallets
E n f o r c i n g t h at a
t ra n s a c t i o n m u s t b e
s i g n e d either b y E v e O R
b y A l i ce after w a i t i n g 4 Eve Alice
ye a rs

Script

IF
<pubKeyEve>
BITCOIN
CHECKISIG TRANSACTION
ELSE
<4 y> CLTV DROP
<pubKeyAlice>
CHECKSIG
ENDIF
blockchain
Secure Storage
E n f o r c i n g t h at a t ra n s a c t i o n
m u s t b e s i g n b y either t h ree
d e v i c e s in different
Phone
l ocati ons O R a re c ove r y ke y
d e p o s i te d in t h e b a n k after Home Office
w a i t i n g six m o n t h s Bank

Script
IF
3 <pubKeyHome> BITCOIN
<pubKeyPhone>
TRANSACTION
<pubKeyOffice> OP_3
CHECKMULTISIG
ELSE
<6 m> CLTV DROP
<pubKeyBank>
CHECKSIG blockchain
ENDIF
Smart Contracts in Context
Smart contracts can be viewed as part of an evolution to automate processes with
machines and self-executing code.

Increasing automation has long been a feature of our financial markets including,
for example:
• Stop Loss (Conditional) Orders: “If the price falls below $X, then sell at market.”
• Trading algorithms and smart order routers (machines that direct orders for
execution).

Increasingly automation is a feature of everyday life.


• The ATM
• Automatic bill pay
• Touch-to-pay systems
• Instant money transfer apps 10
Example of Self-Executing Logic:
Vending Machine
The machine offers pre-defined terms
whereby the seller agrees to deliver
immediately to buyer a product upon
payment of stated sum.

Logic code is a simple loop:

If payment (P) received and item (I)


selected is available, then:

➢ If P ≥ Iprice, dispense I
➢ If P > Iprice, dispense change
➢ Else beep and wait.

12
Example Use Case I: Self-Executing Insurance
PineSafe Patti and
The smart
Patti buys a Patti worries offers PineSafe
contract is
pineapple weather could insurance agree to terms
stored and
grove in jeopardize through a and digitally
operates on
Hawaii business self-executing sign a smart
Blockchain
smart contract contract

Smart Contract Running

Automates monthly
payments from PineSafe
Patti to PineSafe

Patti
Automates daily checks U.S. Weather
Service
for freeze event
This third party
(Payout if freeze) authority is known as
an oracle.
13
Example Use Case II: Transportation Rental

The smart The smart


Upon deposit,
contract Jane returns contract
Jane uses a the smart
monitors bike to a transfers funds
smart contract contract
speed and different rental to RentCo and
to rent a ride. unlocks bike
distance with point. relocks the
for use.
ride tracking. bike.

Smart
RentCo

RTS

Smart Contract Running


Tracks and transfers fees, fines, payments and refunds. Alerts RentCo if Jane Ride Tracking
strays outside of service area. Locks/unlocks ride. Service
Jane Oracle tracks location,
speed, and accidents.
Jane can see records
of her rides on the
Smart Contract
Blockchain.
14
Example Use Case III: Credit Default Swap
To cover the default risk of its customers, a bank enters into a credit default swap (CDS) contract
with a swap dealer.
• New Quarter? The smart contract calculates and transfers premium from bank to swap dealer.
• Borrower Defaults? Check party-agreed authority (i.e., oracle) for default event. If the borrower
defaults, the smart contract calculates and transfers payout from swap dealer to bank.

Smart Contract Running

Automates quarterly
$ payments from Buyer $
Swap
(Bank) to Swap Dealer Dealer

$$$ $$$
Automates daily checks Financial
Party agreed
for Default Event Info oracle.
Service
(Payout if default)

15
Aspects of two blockchain types, with hybrids emerging
Attributes of blockchain for business
Blockchain for Business – Design Principles
TenneT is unlocking distributed energy
resources flexibility via IBM Blockchain
The need:
▪ The electricity grid is becoming more volatile due to
the growing share of renewable electricity
generation in the overall supply
▪ TenneT is working to find new ways of
maintaining the security of supply
Solution:
▪ TenneT is exploring the use of a permissioned
blockchain network that will use Hyperledger
Fabric to integrate flexible battery storage
capacity into the electrical grid “These pilot projects are part of TenneT’s broader
▪ Blockchain enables owners of electric vehicles and strategy of preparing the electricity system to
residential solar batteries to indicate the available accommodate the growing volume of renewable
capacity of their batteries available to energy.” Mel Kroon CEO, TenneT
help TenneT balance grid supply and demand | IB M
C O N F ID E N T IA L
Different ancillary energy products
Blockchain Based Energy Balancing
Current Guarantees of Origin processes
Guarantees of Origin processes using blockchain
Veridium “Verde” Carbon Offset Token
Final thought – Verifying authenticity of assets at source
Case Studies
Supply Chain

IBM / Walmart – Monitor food products from pork and mango


suppliers up to the stores’ shelves

• Conducted early trials of the project in US and China

• Vital data points to possibly reveal food safety issues


• Batch numbers
• farm origination
• factory and processing data
• expiration dates
Utilities

Grid+ – Reduce cost of buying wholesale energy reselling it to


customers

• Gateway embedded with Ethereum

• Eventually allowing peer-to-peer energy trading

• Automated purchase and sell based on current price


Healthcare

Patientory – Easy way to securely store and manage health


information in real time

• Achieved HIPAA compliance

• Allow for data to be securely shared with trusted network

• Reduce time to diagnoses with previous history


Document Management

Attores – Digital certificate specialists

• Ngee Ann Polytechnic – 1st educational institute to deliver


blockchain diplomas

• Immediate validation for employment etc.

• Savings to the institute of at least 75%


Identity

Indorse – A reward based decentralized professional social


network

• You own and control your data

• Rewards for claims being endorsed

• Earn tokens to be traded for other services


Questions ?

Вам также может понравиться