0% found this document useful (0 votes)
33 views25 pages

Smart Contracts Br

Uploaded by

skpiczonly
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views25 pages

Smart Contracts Br

Uploaded by

skpiczonly
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 25

Smart Contracts

Dr. Bhawana Rudra


NITK
Disclamer: The information and images are
gathered from various sources of web
Why smart contracts and
blockchain?
 The Internet was originally designed as a peer-to-peer
means of sending messages and communicating
information.
 It was not designed as e-commerce platform.
 As it has evolved the Internet has split bet
 As a “marketplace of ideas”, the distribution of
information on the Internet can be relatively untrusted.
 Information is published by anyone and everyone in
theory can judge for themselves.
 But as a marketplace for goods and services - a
marketplace of “value”:
 The Internet has not fundamentally altered the basic
mechanism of how individual and corporate parties
transact their business.
 The form of the transaction may be digital.
 For example, parties may use email to exchange
digital copies of contracts and other documentation,
or electronically transmit funds, or license and
download books or films in digital form in exchange for
credit card charges.
 But no real change from traditional brick and
mortar transactions

 Blockchain technology is not only a string of static


data records stored in blocks.
 It is possible using certain versions of blockchain
software to also store executable computer
programs within the blockchain to perform functions.
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).
History
 Smart contracts were first theorized by Nick Szabo in the late
1990s, but it was almost 20 years before the true potential
and benefits of them were truly appreciated.
 "A smart contract is a computerized transaction protocol that
executes the terms of a contract. The general objectives 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. Related economic goals
include lowering fraud loss, arbitrations and enforcement
costs, and other transaction costs.“
 A legally binding, digitally manifest agreement with the power
to reengineer itself dynamically, depending on the terms and
conditions of the market/commercial context to which it
applies, via the implementation of an implicitly encoded set of
rules
A "smart contract" is computer code:
 embedded in a blockchain or [eventually] other form of
decentralized ledger that incorporates all or part of a written
legal agreement and transfers digital assets or vests rights or
is otherwise triggered when a set of predefined terms and
conditions are satisfied.
 The "smart contract“ once written can be self-executing
and autonomous, without the need for further action by the
parties.
 A form of robotics for commercial contracts.
 Smart contracts do not have to be complex and can be used
to perform a few simple functions repetitively for a large
group of transactions or agreements.
 The key to smart contracts is their ability to obtain and
handle variable data and to automatically process and act on
those variables.
 The Goal of Smart Contract is
 Removal of manual intervention and oversight eg.
from legal counsel
 Reduction in associated legal costs, fees and process
(time)
 speed of contract creation and execution
 Automated transfer of funds via computer
recognizable/definable events
 Flexibility in contract
Smart contracts can automatize execution
of transactions
Smart Contracts: The Pragmatic
Present
 Assets are no longer passive objects but have dynamic
behavior
 Behavior can be fine-grain, associated with each transaction
 Contracts can be digital entities that can send and receive
value
 Contracts can spawn other digital entities and create an
autonomous ecosystem
 Strong caveat: Technology is not ready because it relies on
conventional software programming languages
 Future smart-contract platforms will be mathematically
verifiable
 Recommendation: No more than 200 lines of code at this
point
Deterministic Smart Contract
 Smart contract can be divided into deterministic and non-
deterministic smart contracts.
 Deterministic smart contracts are smart contract codes that
do not depend on outside information other than
information on the Blockchain in which they live-in to be
triggered and work effectively. In otherwords,the Blockchain
network facilitating the smart contract has sufficient
information to make decisions.
 Eg.peer-to peer lottery: the funds are held on the Blockchain
network and random numbers are also generated by the
smart contract code. At the end of the lottery, the funds are
transferred to the winners account via his or her address on
the Blockchain network
Non-Deterministic Smart
Contracts
 In Non Deterministic smart contracts the network facilitating the
smart contract code does not have sufficient information to make
decisions. Thus an outside party is needed, usually called an
‘Oracle’ in the computer science domain.
 Decisions about value flow based on human behavior, events (price
drop or hike) or predictions. However, research has shown that
using external state does not always introduce the need for trusting
an additional party.
 For example, in a driving license renewal scenario, the government
is a trusted party anyway, thus, we use government as a validation
oracle that injects external state into the block chain.
 Oracles Connectors are known in computer science for their ability
to provide information from outside a system that the system itself
cannot acquire.
 Oracles also store the data and only pass the important and
relevant data to the smart contract. This ensures the security and
high privacy of the network and improves efficiency.
Decentralized Application
(Dapp)
 Dapp is an application that uses smart contracts.
 Dapp provides a user-friendly interface to smart
contracts
 Dapp main components are smart contract and files for
web user interface front-end/back-end
Building a Smart Contract
- Steps
Step 1: Agreement
Step 2: Conditions
Step 3: Coding
Step 4: Blockchain
Step 5: Execute
Step 6: Recording
Step 1: Agreement

Two or more parties must negotiate a


written legal contract or use a form
contract from one of the parties or an
affiliation group containing their
agreement.
 The contract must include specific
transactions or other rights and obligations
that vest or are executed upon specified
sets of conditions.
Step2:Conditions
The parties must set:
 All of the conditions to be automated under their
agreement
 All permutations of each of those conditions
 The intended result or instruction in each case.

The set conditions can be internal to the contract:


 The manufacture or shipping or delivery of a product
 A schedule of due dates for payments
 Expiration of inspection rights or warranties
 A form of deliverable or notice by a party.

The set conditions can be external to the contract:


 Acts or omissions of third parties
 Accidents or weather or climate events or other acts of God
 Other events of force majeure
 Financial or product market triggers
 Changes in legal or financial status
Step 3: Coding
 The smart part of a contract requires the writing of a
computer program or code which incorporates all of the
set conditions and results, so that the contract will
automatically be performed when those conditions are
triggered.
 In Ethereum the main programming language for writing
smart contracts is Solidity.
Key Point:
 A smart contract therefore always has two versions: the
human language version and the machine code version
Step 4: Blockchain
 The smart contract code is published to the blockchain or
other decentralized ledger network by the parties.
 The smart contract code is verified and then "written" into
a block in the blockchain or other ledger.
 The parties are issued public and private keys so they
can conduct the transaction on the blockchain
Step 5: Execute
Execution of the transaction is triggered:
 by a message sent by a party validated by its private
key or
 by the objective satisfaction of external or other
events or conditions coded into the program.
 The transaction [such as transfer of funds or title is
automatically performed pursuant to the smart
contract code.
Step 6: Recording
 The completed transaction {for example: sale of
property; payment of royalties; delivery of shipment} is
 verified and written into a new block in the chain.
 All of the computers [nodes] which are part of the
relevant network are then distributed updated copies
of the ledger which show that the transaction is
completed.
Design Methodology for Smart
Contract Application
Potential Benefits of Smart
Contracts
 The attributes of a smart contract give rise to potential
benefits throughout an economic transaction lifecycle,
e.g., formation, execution, settlement.

You might also like