Smart Contract BC

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 12

Chapter 5

SMART CONTRACTS

Blockchain Technology
Smart Contracts

 The term smart contract dates to 1994, defined by Nick Szabo as “a


computerized transaction protocol that executes the terms of a contract.
 The general objectives of smart contract design are to satisfy common
contractual conditions (such as payment terms, liens, confidentiality, and even
enforcement), minimize exceptions both malicious and accidental, and minimize
the need for trusted intermediaries.”
 Smart contracts extend and leverage blockchain technology.
 A smart contract is a collection of code and data (sometimes referred to as
functions and state) that is deployed using cryptographically signed
transactions on the blockchain network (e.g., Ethereum’s smart contracts,
Hyperledger Fabric’s chaincode).
 The smart contract is executed by nodes within the blockchain network; all
nodes that execute the smart contract must derive the same results from the
execution, and the results of execution are recorded on the blockchain.
Blockchain Technology 2
 Blockchain network users can create transactions which send data to public
functions offered by a smart contract.
 The smart contract executes the appropriate method with the user provided
data to perform a service.
 The code, being on the blockchain, is also tamper evident and tamper resistant
and therefore can be used (among other purposes) as a trusted third party.
 A smart contract can perform calculations, store information, expose properties
to reflect a publicly exposed state and, if appropriate, automatically send funds
to other accounts.
 It does not necessarily even have to perform a financial function. For example,
the authors of this document have created an Ethereum smart contract that
publicly generate trustworthy random numbers .
 It is important to note that not every blockchain can run smart contracts.

Blockchain Technology 3
 The smart contract code can represent a multi-party transaction, typically in the
context of a business process.
 In a multi-party scenario, the benefit is that this can provide attestable data and
transparency that can foster trust, provide insight that can enable better business
decisions, reduce costs from reconciliation that exists in traditional business to
business applications, and reduce the time to complete a transaction.
 Smart contracts must be deterministic, in that given an input they will always
produce the same output based on that input.
 Additionally, all the nodes executing the smart contract must agree on the new state
that is obtained after the execution.
 To achieve this, smart contracts cannot operate on data outside of what is directly
passed into it (e.g., smart contracts cannot obtain web services data from within the
smart contract – it would need to be passed in as a parameter).
 Any smart contract which uses data from outside the context of its own system is
said to use an ‘Oracle’
Blockchain Technology 4
 For smart contract enabled permissionless blockchain networks (such
as Ethereum) the user issuing a transaction to a smart contract will
have to pay for the cost of the code execution. There is a limit on how
much execution time can be consumed by a call to a smart contract,
based on the complexity of the code.
 If this limit is exceeded, execution stops,and the transaction is
discarded. This mechanism not only rewards the publishers for
executing the smart contract code, but also prevents malicious users
from deploying and then accessing smart contracts that will perform
a denial of service on the publishing nodes by consuming all
resources (e.g., using infinite loops)

Blockchain Technology 5
Smart Contract Concept

Blockchain Technology 6
Types of Smart Contracts

Decentralized
Smart Legal Autonomous
Contracts Organizations
(DAO)

(Smart contracts (Multiple smart


with legal contracts
contract combined with
templates) governance
mechanisms)

Distributed Smart
Applications Contracting
(DApps)
Devices

(Combination of
smart contract (Combined
codes) with IoT)
Blockchain Technology 7
DApp
DApp web DApp web
browser browser

HTML/ CSS/ HTML/ CSS/


JavaScript JavaScript
RPC RPC

EVM Ethereum Virtual EVM Ethereum Virtual


Machine Machine

Block 1 Block 2 Block 3 Block 1 Block 2 Block 3

BLOCKCHAIN BLOCKCHAIN

Ethereum DApp Instance Ethereum DApp Instance


1 2

Replaces the database / cache and


server code
Blockchain Technology 8
Smart Contract Value Chain

1 2 3 4 a)
On-chain
Asset
(Digital)
Pre-defined Execute and
Events Settlement
contract value transfer
Off-chain
asset
b) (Digital)
Terms are estimated  a) For digital asset
by all counterparties, on the chain, such
such as o Event triggers  Event triggers as a cryptocurrency,
contract execution contract and  accounts are
 Variable interest dictates automatically
rate (e.g., UBOR) o Event can refer to movement of settled
 Currency of value based on  b) For assets
payments  Transaction conditions met. represented off the
 Currency rate initiated chain such as stock
 Information and fiat, changes to
Conditions rate at received accounts on the
given value
Blockchain for
Technology ledger will match
9
execution (e.g., time off-chain settlement
and date, LIBOR ) instructions
Software Oracle and Hardware
Oracle

Blockchain Technology 10
Consensus
Oracle

Blockchain Technology 11
Characteristics of Autonomous
DAO

Blockchain Technology 12

You might also like