0% found this document useful (0 votes)
14 views

Module IV - Part I

Uploaded by

hanige7160
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Module IV - Part I

Uploaded by

hanige7160
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Module IV

Smart contracts - Definition, smart contract templates, Oracles, Types of oracles,


Deploying smart contracts. Decentralization terminology - Decentralized
applications, Decentralized Autonomous Organizations.

Use cases of Blockchain technology - Government, healthcare, Finance, Supply


chain management.

Blockchain and allied technologies - Blockchain and Cloud Computing, Blockchain


and Artificial Intelligence.
Smart Contracts
Definition
A smart contract is a secure and unstoppable computer program representing an
agreement that is automatically executable and enforceable.
Secure and unstoppable: Means that these computer programs are required to be
designed in such a fashion that they are fault-tolerant and executable in a
reasonable amount of time.
These programs should be able to execute and maintain a healthy internal state,
even if external factors are unfavorable.
Smart contracts are self-enforcing as opposed to legally enforceable.
Smart contracts are not really smart, they are simply doing what they are
programmed to do.
A smart contract has the following four properties:

1. Automatically executable: runs on a blockchain without any intervention


2. Enforceable: all contract conditions are enforced automatically
3. Semantically sound: tamper-proof and run with security guarantees
4. Secure and unstoppable: ensures that smart contracts always produce the
same output for a specific input
Smart contract templates

Smart contracts can be implemented for any industry.

Most current use cases are related to the financial industry.

The idea of smart contract templates is to build standard templates that provide a
framework to support legal agreements for financial instruments.

Domain-specific languages are be developed to program smart contracts.

These languages are developed with limited expressiveness for a particular


application or area of interest.

DSLs are available that support development of insurance products, represent


energy derivatives, or are being used to build trading strategies.
Domain-specific languages (DSLs) are different from general-purpose programming
languages (GPLs).

DSLs have a small set of features that are sufficient and optimized for the domain.

DSLs are usually not used to build general purpose large application programs.

Graphical domain-specific language is a smart contract modeling platform where a


domain expert (not a programmer) can use a graphical user interface and a canvas
to define and draw the semantics and performance of a financial contract.

The focus is on developing high-level DSLs that can be used to program a smart
contract in a user-friendly graphical user interface, thus allowing a non-programmer
domain expert (for example, a lawyer) to design smart contracts.
Oracles
Important component of the smart contract ecosystem.
The limitation with smart contracts is that they cannot access external data, which
might be required to control the execution of the business logic;
for example, the stock price of a security product that is required by the contract to
release the dividend payments.
Oracles can be used to provide external data to smart contracts.
An Oracle is an interface that delivers data from an external source to smart
contracts.
Depending on the industry and requirements, Oracles can deliver different types of
data ranging from weather reports, real-world news, and corporate actions to data
coming from Internet of Things (IoT) devices.
A generic model of an Oracle and smart contract ecosystem
Oracles are trusted entities that use a secure channel to transfer data to a smart
contract.

Oracles are also capable of digitally signing the data proving that the source of the
data is authentic.

Smart contracts can subscribe to the Oracles, and the smart contracts can either
pull the data or Oracles can push the data to the smart contracts.

It is also necessary that Oracles should not be able to manipulate the data they
provide and must be able to provide authentic data.
.
Decentralized Oracles
These types of Oracles can be built based on some distributed mechanism.
Oracles can find themselves source data from another blockchain, which is driven
by distributed consensus, thus ensuring the authenticity of data.
For example, one institution running their private blockchain can publish their data
feed via an Oracle that can then be consumed by other blockchains.
Hardware Oracles
Real-world data from physical devices is required.
Can be used in telemetry and IoT.
Hardware devices are required to be tamper proof.
This can be achieved by using cryptographic services.
Smart Oracles

Smart Oracles are entities just like Oracles, but with the added capability of contract
code execution.

Smart Oracles proposed by Codius run using Google Native Client, which is a
sandboxed environment for running untrusted x86 native code.

Software Oracles

Handle information that is generally available over the internet.

Data originate from online sources

Eg. E-commerce, train reservation sites etc.


Computation oracles

Allow computing-intensive calculations to be performed off-chain

A blockchain (that is, a smart contract on a blockchain) can request computations to


be performed on off-chain high-performance computing infrastructure and get the
verified results back via an oracle.

Aggregation based oracles

A single value is sourced from many different feeds

Eg. single value can be the price of a financial instrument, and it can be risky to rely
upon only one feed.

Multiple data providers can be used where all of these feeds are inspected, and
finally, the price value that is reported by most of the feeds can be picked up.
Crowd wisdom driven oracles
Useful when a single source of information is not trusted.
Multiple public sources are used to deduce the most appropriate data eventually
A political event or a sporting event where members of the public know the results
and can provide the required data
Similarly, this data can be sourced from multiple different news websites
This data can then be aggregated, and if a sufficiently high number of the same
information is received from multiple sources, then there is an increased likelihood
that the data is correct and can be trusted.
Smart oracles
They can execute contract code.
Deploying smart contracts on a blockchain
Ethereum is an example of a blockchain platform that natively supports the
development and deployment of smart contracts.
Smart contracts on Ethereum blockchain are usually part of a broader application
such as Decentralized Autonomous organization (DAOs).
Bitcoin scripting language, though limited, can be used to construct basic smart
contracts.
For example, you can implement conditions such as "Pay party X, N amount of
bitcoins after 3 months".
Various other blockchain platforms support smart contracts such as Monax, Lisk,
Counterparty, Stellar, Hyperledger fabric, corda, and Axoni core.
Smart contracts can be developed in various languages.
The critical requirement, for smart contract is determinism, which is very important
because it is vital that regardless of where the smart contract code executes, it
produces the same result every time and everywhere.

Smart contract code is absolutely bug-free.

Various languages have been developed to build smart contracts such as Solidity,
which runs on Ethereum Virtual Machine (EVM).

There are platforms which already support mainstream languages for smart contract
development.

Hyperledger fabric supports Golang, Java, and JavaScript for smart contract
development.
Decentralized Organizations
DOs are software programs that run on a blockchain and are based on the idea of
actual organizations with people and protocols.
Once a DO is added to the blockchain in the form of a smart contract or a set of
smart contracts, it becomes decentralized and parties interact with each other
based on the code defined within the DO software.
Decentralized Autonomous Organizations
Just like DOs, a Decentralized Autonomous Organization (DAO) is also a computer
program that runs atop a blockchain and embedded within it are governance and
business logic rules.
DAO and DO are fundamentally the same thing: The main difference, is that DAOs
are autonomous, which means that they are fully automated and contain
artificially-intelligent logic.
DOs, on the other hand, lack this feature and rely on human input to execute
business logic.
The Ethereum blockchain led the way with the initial introduction of DAOs.
In a DAO, the code is considered the governing entity rather than people or paper
contracts.
However, a human curator maintains this code and acts as a proposal evaluator for
the community.
DAOs are capable of hiring external contractors if enough input is received from the
token holders (participants).
Currently, DAOs do not have any legal status, even though they may contain some
intelligent code that enforces certain protocols and conditions.
Decentralized Applications (DApps)

DApps, are software programs that can run on their respective blockchains, use an
existing established blockchain, or use only the protocols of an existing blockchain.

These are called Type I, Type II, and Type III DApps.

Requirements of a Decentralized Application

For an application to be considered decentralized, it must meet the following criteria.

i) The DApp should be fully open source and autonomous, and no single entity
should be in control of a majority of its tokens. All changes to the application must
be consensus-driven based on the feedback given by the community.
ii) Data and records of operations of the application must be cryptographically
secured and stored on a public, decentralized blockchain to avoid any central points
of failure.

iii) A cryptographic token must be used by the application to provide access and
rewards to those who contribute value to the applications, for example, miners in
Bitcoin.

iv) The tokens must be generated by the DApp according to a standard


cryptographic algorithm. This generation of tokens acts as a proof of the value to
contributors (for example, miners).
Architecture of Dapps / Decentralized application development
Components of a Dapp
➔ Ethereum blockchain.
➔ Smart Contracts.
➔ Ethereum Virtual Machine (EVM).
➔ Front-end.
[Explain each]
Metamask
Metamask is a browser plugin that serves as an Ethereum wallet.
Role of Metamask

Whenever the front end needs the user to sign a transaction, it calls on Metamask.
So metamask plays the role of the signer.

Metamask will allow us to connect the blockchain with our personal account and
interact with the smart contract.

A user’s private keys are stored by Metamask in the browser.

Metamask acts both as a provider and a signer


DApp examples
KYC-Chain
This application provides the facility to manage Know Your Customer (KYC) data securely
and conveniently based on smart contracts.
OpenBazaar
This is a decentralized peer-to-peer network that enables commercial activities directly
between sellers and buyers instead of relying on a central party, such as eBay and
Amazon.
This system is not built on top of a blockchain; instead, DHTs are used in a peer-to-peer
network to enable direct communication and data sharing among peers. It makes use of
Bitcoin and various other cryptocurrencies as a payment method.
Lazooz
This is the decentralized equivalent of Uber. It allows peer-to-peer ride sharing and users
to be incentivized by proof of movement, and they can earn Zooz coins.

You might also like