CST 428 BLOCK CHAIN TECHNOLOGIES
S8 CSE – ELECTIVE
MODULE – 4
Smart Contracts and Use cases
Smart Contract
● an electronic transaction protocol that executes the terms of a
contract
● 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
Smart Contract - definition
● “A smart contract is a secure and unstoppable computer
program representing an agreement that is automatically
executable and enforceable”
● work on the principle that code is the law, which means that
there is no need for an arbitrator or a third party to enforce,
control, or influence the execution of a smart contract
Smart Contract - definition
● they are secure and unstoppable, which means that these
computer programs are fault-tolerant and executable in a
reasonable (finite) amount of time
● should be able to execute and maintain a healthy internal
state, even if external factors are unfavorable
Smart Contract - Properties
● Automatically executable: on a blockchain without any
intervention
● Enforceable: all contract conditions are enforced automatically
● Secure:tamper-proof (or tamper-resistant) and run with
security guarantees
● Deterministic: ensures that smart contracts always produce
the same output for a specific input
Smart Contract - Properties
● Semantically sound: they are complete and meaningful to
both people and computers
● Unstoppable: adversaries or unfavorable conditions cannot
negatively affect the execution of a smart contract. When the
smart contracts execute, they complete their performance
deterministically in a finite amount of time
Smart contract templates
● 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 (DSLs) should be built to support
the design and implementation of smart contract templates
● A language named common language for augmented contract
knowledge (CLACK) has been proposed, and research has
started to develop this language
Smart contract templates
● This language is intended to be very rich and is expected
to provide a large variety of functions ranging from
supporting legal prose to the ability to be executed on
multiple platforms and cryptographic functions
● These languages possess a small set of features that are
sufficient and optimized for a specific domain only
Smart contract templates
● Solidity is one such language that has been introduced with
the Ethereum blockchain to write smart contracts
● Vyper is another language that has been recently introduced
for Ethereum smart contract development
● It has been proposed that research should also be conducted
in the area of developing high-level DSLs that can be used to
program a smart contract in a user-friendly graphical user
interface
Oracles
● essential component of the smart contract and blockchain
ecosystem
● limitation with smart contracts is that they cannot access
external data because blockchains are closed systems
without any direct access to the real world
● This external data might be required to control the execution
of some business logic in the smart contract
Oracles
● Eg, the stock price of a security product that is required by the
contract to release dividend payments
● oracles can be used to provide external data to smart contracts
● An oracle can be defined as an interface that delivers data from
an external source to smart contracts
● Oracles are trusted entities that use a secure channel to transfer
off-chain data to a smart contract
Oracles
● Depending on the industry and use case requirements, oracles
can deliver different types of data ranging from weather reports,
real-world news, and corporate actions to data coming from an
Internet of Things (IoT) device
oracles should also be capable of digitally signing or digitally
attesting the data to prove that the data is authentic. This proof is
called proof of validity or proof of authenticity
Oracles
● Smart contracts subscribe to oracles
● Smart contracts can either pull data from oracles, or oracles can push
data to smart contracts
● oracles should not be able to manipulate the data they provide and must
be able to provide factual data
● In some cases, the data is incorrect due to manipulation or a fault in the
system
● This validation can be provided by using various cryptographic proofing
schemes
Types of blockchain oracles
Oracles
Inbound Outbound oracles/
oracles Reverse Oracle
oracles that receive incoming data used to send data out from the
from external services, and feed it blockchain smart contracts to the
into the smart contract outside world.
Inbound/ Standard or Simple Oracles
1. Software Oracles/ Standard or Simple oracles
○ responsible for acquiring information from online services on the Internet
○ usually used to source data such as weather information, financial data or
enterprise-specific data
2. Hardware oracles
○ used to source data from hardware sources such as IoT devices or sensors
○ useful in use cases such as insurance-related smart contracts where telemetry
sensors provide certain information, for example, vehicle speed and location
○ For insurance claims and payouts to decide whether to accept a claim or not
○ useful where real-world data from physical devices is required
Inbound/ Standard or Simple Oracles
3. 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
4. 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
Inbound/ Standard or Simple Oracles
5. Crowd wisdom driven oracles
○ another way that the blockchain oracle problem can be addressed where a single
source is not trusted
○ Instead, 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
Inbound/ Standard or Simple Oracles
6. Decentralized oracles
○ As blockchain platforms such as Bitcoin and Ethereum are fully decentralized, it is
expected that oracle services should also be decentralized
○ built based on a distributed mechanism.
○ oracles can find themselves source data from another blockchain, which is driven by
distributed consensus, thus ensuring the authenticity of data
7. Smart oracles
● with the added capability of executing contract code
Deploying smart contracts
● due to the security and decentralized consensus mechanism
provided by the blockchain, Smart contracts may be deployed
on a blockchain
● Ethereum is an example of a blockchain platform that natively
supports the development and deployment of smart contracts
Deploying smart contracts
● in a Bitcoin blockchain, the transaction timelocks, such as the
nLocktime field, the CHECKLOCKTIMEVERIFY (CLTV), and
the CHECKSEQUENCEVERIFY script operator in the Bitcoin
transaction, can be seen as an enabler of a simple version of
a smart contract
● timelocks enable a transaction to be locked until a specified
time or until a number of blocks to ensure a certain
transaction can only be unlocked if certain conditions are met
Deploying smart contracts
● For example, Pay party X, N number of bitcoins after 3
months
● Various other blockchain platforms support smart contracts
are Monax, Lisk, Counterparty, Stellar, Hyperledger Fabric,
Axoni core, Neo, EOSIO, and Tezos.
● to build smart contracts, Solidity, which runs on Ethereum
Virtual Machine (EVM) can be used
Decentralized Autonomous Organization (DAO)
● started in April 2016 https://www.youtube.com/watch?v=tbO-tfZX3sc
● was a smart contract written to provide a platform for
investment
● Due to a bug, called the reentrancy bug, in the code, it was
hacked in June 2016
● An equivalent of approximately 3.6 million ether (roughly 50
million US dollars) was siphoned out of the DAO into another
account
Decentralized Autonomous Organization (DAO)
● reentrancy bug - withdraw tokens from the DAO smart
contract repeatedly before giving the DAO contract a chance
to update its internal state to indicate that how many DAO
tokens have been withdrawn
● The attacker was able to withdraw DAOs
● However, before the smart contract could update its state, the
attacker withdrew the tokens again repeatedly but only a
single withdrawal was logged
Use cases of Blockchain technology-Government
● Many governments are researching the possibility of using
blockchain technology for managing and delivering public
services, including, but not limited to, identity cards, driving
licenses, secure data sharing among various government
departments, and contract management
● Transparency, auditability, and integrity are attributes of
blockchain for effectively managing government functions
Use cases of Blockchain technology-Government
● Many governments are researching the possibility of using
blockchain technology for managing and delivering public
services, including, but not limited to, identity cards, driving
licenses, secure data sharing among various government
departments, and contract management
● Transparency, auditability, and integrity are attributes of
blockchain for effectively managing government functions
Use cases of Blockchain technology-Government
Automated border control using blockchain
Use cases of Blockchain technology-Government
● Voting - limitations in current voting systems revolve around
fraud, weaknesses in operational processes, and especially
transparency
○ Many specialized voting system were introduced, but
still have vulnerabilities
○ vulnerabilities can lead to serious implications for the
whole voting process and can result in mistrust in the
government by the public
Use cases of Blockchain technology-Government
● Many governments are researching the possibility of using
blockchain technology for managing and delivering public
services, including, but not limited to, identity cards, driving
licenses, secure data sharing among various government
departments, and contract management
● Transparency, auditability, and integrity are attributes of
blockchain for effectively managing government functions
Use cases of Blockchain technology-Government
● Many governments are researching the possibility of using
blockchain technology for managing and delivering public
services, including, but not limited to, identity cards, driving
licenses, secure data sharing among various government
departments, and contract management
● Transparency, auditability, and integrity are attributes of
blockchain for effectively managing government functions
Use cases of Blockchain technology-Government
Automated border control using blockchain
Use cases of Blockchain technology-Government
● Voting
○ Blockchain-based voting systems can resolve these
issues by introducing end-to-end security and
transparency in the process
○ Security is provided in the form of integrity and
authenticity of votes by using public key cryptography
○ immutability guaranteed by blockchain ensures that
votes cast once cannot be cast again
Use cases of Blockchain technology-Government
● Voting
○ Blockchain-based voting systems can resolve these
issues by introducing end-to-end security and
transparency in the process
○ Security is provided in the form of integrity and
authenticity of votes by using public key cryptography
○ immutability guaranteed by blockchain ensures that
votes cast once cannot be cast again
Use cases of Blockchain technology-Government
● Voting
○ This can be achieved through a combination of
biometric features and a smart contract maintaining a
list of votes already cast
○ a smart contract can maintain a list of already-cast
votes with the biometric ID (for example, a fingerprint)
and can use that to detect and prevent double casting
Use cases of Blockchain technology-Government
● Voting
○ zero-knowledge proofs (ZKPs) can also be used on
the blockchain to protect voters' privacy
○ With ZKP, a voter can remain anonymous by hiding
their identities, and the vote itself can be kept
confidential
Use cases of Blockchain technology-Government
● ID cards
○ A blockchain-based online digital identity allows
control over personal information sharing
○ Users can see who used their data and for what
purpose, as well as control access to it
○ This is not possible with the current infrastructures,
which are centrally controlled
Use cases of Blockchain technology-Government
● ID cards
○ single identity issued by the government can be used
easily, and in a transparent manner, for multiple
services via a single government blockchain
○ blockchain serves as a platform where a government
is providing various services such as pensions,
taxation, or benefits and a single ID is being used to
access all these services
Use cases of Blockchain technology-Government
● ID cards
○ Blockchain, provides a permanent record of every
change and transaction made by a digital ID
○ citizens can notarize birth certificates, marriages,
deeds, and many other documents on the blockchain
tied with their digital ID as a proof of existence
Use cases of Blockchain technology-Government
● ID cards
○ Other government functions improve cost and
efficiency
■ collection of taxes
■ benefits management and disbursement
■ land ownership record management
■ life event registration (marriages, births)
■ motor vehicle registration, and licenses
Use cases of Blockchain technology-Health
● With the adaptability of blockchain in the health sector, several
benefits can be realized, including cost savings, increased
trust, the faster processing of claims, high availability, no
operational errors due to complexity in the operational
procedures, and preventing the distribution of counterfeit
medicines
Use cases of Blockchain technology-Health
● blockchains that are providing a digital currency as an
incentive for mining can be used to provide processing power
to solve scientific problems
● This helps to find cures for certain diseases
● Examples include FoldingCoin, which rewards its miners with
FLDC tokens for sharing their computer's processing power
for solving scientific problems that require unusually large
calculations
Use cases of Blockchain technology-Health
● Another one coin is CureCoin
Use cases of Blockchain technology-Finance
● currently the hottest topic
● major banks and financial organizations are researching to
find ways to adopt blockchain technology, primarily due to its
highly desired potential to cost-save
Use cases of Blockchain technology-Finance
● Insurance
○ blockchain technology can help to stop fraudulent
claims, increase the speed of claim processing, and
enable transparency
○ shared ledger between all insurers can provide a
quick and efficient mechanism for handling
intercompany claims
Use cases of Blockchain technology-Finance
● Insurance
○ with the convergence of IoT and blockchain, an
ecosystem of smart devices can be imagined and all
these things can negotiate and manage their
insurance policies, which are controlled by smart
contracts on the blockchain
Use cases of Blockchain technology-Finance
● Insurance
○ Blockchain can reduce the overall cost and effort
required to process claims
○ Claims can be automatically verified and paid via
smart contracts and the associated identity of the
insurance policyholder
Use cases of Blockchain technology-Finance
● Insurance
○ It can also withhold payment if the smart contract,
after evaluating conditions of payment, concludes that
payment should not be released
○ Several start-ups, such as Dynamis, have proposed
smart contract-based P2P insurance platforms
Use cases of Blockchain technology-Finance
● Post-trade settlement
○ many financial institutions are exploring the possibility
of using blockchain technology to simplify, automate,
and speed up the costly and time-consuming
post-trade settlement process
○ A trade lifecycle contains three steps: execution,
clearing, and settlement
Use cases of Blockchain technology-Finance
● Post-trade settlement
○ Execution - commitment of trading between two
parties and can be entered into the system
○ Clearing - the trade is matched between the seller and
buyer based on certain attributes, such as price and
quantity
○ Settlement - security is exchanged for payment
between the buyer and seller
Use cases of Blockchain technology-Finance
● Post-trade settlement
○ the post-trade settlement process usually takes two to
three days
○ With the shared ledger approach, all participants on
the blockchain can immediately see a single version of
truth regarding the state of the trade
Use cases of Blockchain technology-Finance
● Post-trade settlement
○ Moreover, P2P settlement is possible, which results in
the reduction of complexity, cost, risk, and the time it
takes to settle the trade
○ intermediaries can be eliminated by making use of the
appropriate smart contracts on the blockchain
○ regulators can view the blockchain for auditing and
regulatory requirements
Use cases of Blockchain technology-Finance
● Financial crime prevention
○ Blockchain can securely share a distributed ledger
between all financial institutions that contain verified
and true identities of customers
○ This distributed ledger can only be updated by
consensus between the participants, thus providing
transparency and auditability
Use cases of Blockchain technology-Finance
● Financial crime prevention
○ not only reduce costs but also enable regulatory and
compliance requirements to be satisfied in a better
and consistent manner
○ Blockchain can provide a single shared view of all
financial transactions in the system that are
cryptographically secure, authentic, and auditable
Blockchain in the cloud
● Cloud computing provides excellent benefits to enterprises,
including efficiency, cost reduction, scalability, high availability,
and security
● Cloud computing delivers computing services such as
infrastructure, servers, databases, and software over the
internet
Blockchain in the cloud
● Blockchain as a Service, or BaaS
○ an extension of SaaS
○ blockchain platform is implemented in the cloud for an
organization
○ organization manages its applications on the
blockchain, and the rest of the software management,
infrastructure management, and security and
operating systems are managed by the cloud provider
Blockchain in the cloud
● Blockchain as a Service, or BaaS
○ blockchain's software and infrastructure are provided
and maintained by the cloud provider
○ Some BaaS providers are - AWS, Azure, Oracle, IBM
Blockchain and AI
● All of the data that is generated as a result of M2M
communication can be used in machine learning processes to
augment the functionality of artificially intelligent DAOs or
simple AAs
● These AAs can act as agents in a blockchain-provided
Distributed Artificial Intelligence (DAI) environment, which can
learn over time using machine learning processes
Blockchain and AI
● This would enable them to make better decisions for the good
of the blockchain
● A key requirement in AI-based systems is the availability of
authentic data that can be used for machine learning and
model building
Blockchain and AI
● Once consumers, producers, and other entities are on a
blockchain, the data that is generated as a result of interaction
between these entities can be readily used as an input to
machine learning engines with a guarantee of authenticity
Blockchain and AI
● The possibility of combining intelligent oracles, intelligent
smart contracts, and AAs will give rise to Artificially Intelligent
Decentralized Autonomous Organizations (AIDAOs) that can
act on behalf of humans to run entire organizations on their
own