0% found this document useful (0 votes)
5 views16 pages

Module 4 Complete

This document discusses smart contracts, their definitions, properties, and templates, as well as the role of oracles in providing external data to these contracts. It also covers the concepts of decentralized applications (DApps) and decentralized autonomous organizations (DAOs), alongside the integration of blockchain technology with cloud computing and artificial intelligence. Use cases for blockchain technology in various sectors, including government, healthcare, finance, and supply chain management, are highlighted.

Uploaded by

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

Module 4 Complete

This document discusses smart contracts, their definitions, properties, and templates, as well as the role of oracles in providing external data to these contracts. It also covers the concepts of decentralized applications (DApps) and decentralized autonomous organizations (DAOs), alongside the integration of blockchain technology with cloud computing and artificial intelligence. Use cases for blockchain technology in various sectors, including government, healthcare, finance, and supply chain management, are highlighted.

Uploaded by

g3273650
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MODULE -4

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, Health care,
Finance, Supply chain management. Blockchain and allied technologies – Blockchain and
Cloud Computing, Blockchain and Artificial Intelligence.

Smart contracts are described by Szabo as follows:

• "A smart contract is an electronic 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."

Definition :

• “A smart contract is a secure and unstoppable computer program that represents an


agreement and is automatically executable and enforceable”.

• It is written in a programming language that a computer can understand and contains


business logic between parties.

• Smart contracts execute automatically when predefined conditions are met and
ensure that all terms are carried out as specified.

• An example of a smart contract is an online payment agreement.

• Suppose Person A agrees to buy a digital product from Person B. A smart contract is
programmed so that when Person A sends the payment, the digital product is
automatically delivered. If the payment is not made, the product is not delivered.

• This process happens automatically without the need for a middleman, and the terms
are enforced by the program itself.

Properties of smart contracts:

• Automatically executable: It is self-executable on a blockchain without requiring any


intervention.

• Enforceable: This means that all contract conditions are enforced automatically.

• Secure: This means that smart contracts are tamper-proof (or tamper-resistant) and
run with security guarantees. The underlying blockchain usually provides these
security guarantees; however, the smart contract programming language and the
smart contract code themselves must be correct, valid, and verified.

• Deterministic: The deterministic feature ensures that smart contracts always produce
the same output for a specific input. Even though it can be considered to be part of
the secure property, defining it here separately ensures that the deterministic property
is considered one of the important properties.

• Semantically sound: This means that they are complete and meaningful to both
people and computers.

• Unstoppable: This means that 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

• Smart contracts can be implemented in many industries, but their most


popular use is in the financial sector. Blockchain technology first gained
attention in finance, which led to significant research interest in developing
smart contract templates. These templates aim to provide standardized
frameworks that support legally enforceable agreements for financial
instruments.
• In 2016, Christopher D. Clack and his team proposed the concept of smart
contract templates in their paper “Smart Contract Templates: Foundations,
Design Landscape and Research Directions.” The idea was to create standard
templates that link legal agreements with executable code. Another related
paper, “Smart Contract Templates: Essential Requirements and Design
Options,” further discussed how legal prose can be connected with code using
a markup language. The research focuses on creating, formatting, executing,
and storing smart legal agreements, and this work is still ongoing.
• The paper also suggested the development of Domain-Specific Languages
(DSLs) to design and implement smart contract templates. One such language
is Common Language for Augmented Contract Knowledge (CLACK), which is
intended to support legal prose and enable execution across different
platforms with cryptographic features.
• DSLs are programming languages designed for specific application domains.
They have limited but focused features, unlike General-Purpose Programming
Languages (GPLs) such as Java or C++. DSLs are optimized for particular tasks
and are not suitable for building large general-purpose applications.
• Examples of DSL-based smart contract languages include Solidity and Vyper,
which are used on the Ethereum blockchain. These languages allow developers
to write smart contracts that can be deployed as decentralized applications
(DApps).
• Research also explores creating user-friendly graphical interfaces that allow
domain experts (such as lawyers) to design smart contracts without deep
programming knowledge. In addition, general-purpose languages like Java, Go,
and C++ are also being used for smart contract development in some
blockchain platforms (e.g., EOSIO, where C++ contracts are compiled to
WebAssembly).
• One major limitation of smart contracts is that they cannot directly access
external data. To solve this problem, oracles are used. An oracle is an off-chain
service that provides external information to smart contracts on the
blockchain.
• In conclusion, smart contract templates aim to standardize, automate, and
legally enforce digital agreements by combining legal text with executable
code, supported by specialized programming languages and blockchain
technology.

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 contractEg, 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


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

● 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.


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

The standard mechanics of how oracles work is presented here:

• A smart contract sends a request for data to an oracle.

• The request is executed and the required data is requested from the source. There are
various methods of requesting data from the source. These methods usually involve
invoking APIs provided by the data provider, calling a web service, reading from a
database (for example, in enterprise integration use cases where the required data
may exist on a local enterprise legacy system), or requesting data from another
blockchain. Sources can be any external off-chain data provider on the internet or in
an internal enterprise network

• The data is sent to a notary to generate cryptographic proof (usually a digital signature)
of the requested data to prove its validity (authenticity). Usually, TLSNotary is used for
this purpose ([Link] Other techniques include Android proofs, Ledger
proofs, and trusted hardware-assisted proofs, which we will explain shortly.

• The data with the proof of validity is sent to the oracle.

• The requested data with its proof of authenticity can be optionally saved on a
decentralized storage system such as Swarm or IPFS and can be used by the smart
contract/blockchain for verification. This is especially useful when the proofs of
authenticity are of a large size and sending them to the requesting smart contracts
(storing them on the chain) is not feasible.

• Finally, the data, with the proof of validity, is sent to the smart contract.
Types of blockchain oracles:

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.

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.
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.

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

Outbound oracles = Reverse oracles:

They send data from blockchain to the external world, not into the blockchain.

• Two main use cases:

1. Blockchain-to-blockchain communication

• Data (e.g., blockchain metrics) sent from one blockchain to another.

2. Blockchain-to-physical world interaction

• Smart contract triggers real-world actions via hardware devices (e.g.,


IoT).

• Not always strictly required:

• Some hardware actions can be triggered directly by smart contract events without an
oracle.
• Security becomes critical when: Data is transferred between different blockchains →
oracle infrastructure provides trust and verification.

• External systems require verified and trusted data.

• Enterprise integration use case: Outbound oracles connect blockchain systems with
legacy enterprise systems.

• Example: A blockchain trade settlement being reported to traditional backend/legacy


settlement systems.

Deploying smart contracts

• Deployment is the process of uploading a smart contract’s code to a blockchain so it


becomes:

• Immutable (cannot be changed)

• Publicly accessible

• Executable by users and applications

• Given a unique contract address

• 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.

• 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. 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.

Decentralization – Applications:

Decentralization
• Decentralization means that control, data, and decision-making are distributed across
many participants instead of being held by a single central authority (like a company,
government, or server).

Decentralized Applications (DApps)

A Decentralized Application (DApp) is an application that:

• Runs on a blockchain or decentralized network

• Uses smart contracts for logic

• Is not controlled by a single entity

• Is transparent and tamper-resistant

Key Features : Open-source, No central server, Uses blockchain (e.g., Ethereum,


Solana) , Controlled by smart contract, Users control their own data & assets

Example Use Cases:

• DeFi apps (lending, trading)

• NFT marketplaces

• Blockchain games

• Decentralized social media.

Decentralized Autonomous Organization (DAO):

● started in April 2016 [Link]

● 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

● 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 .

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 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 as a Service, or BaaS

● blockchain's software and infrastructure are provided and maintained by the


cloud provider.

● Cloud providers offer Blockchain-as-a-Service (BaaS):

● Amazon Web Services (AWS Blockchain)

● Microsoft Azure (Azure Blockchain Workbench)

● IBM Blockchain Platform

● Google Cloud Blockchain Node Engine


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

● 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 in AI is the integration of blockchain technology with AI systems to make


AI:

● more trustworthy

● more transparent

● more secure

● more decentralized

● AI gives intelligence, Blockchain gives trust


● 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

● 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.

● Overall :

Cloud provides infrastructure, AI provides intelligence, Blockchain provides trust. Together,


they create secure, scalable, and intelligent digital systems.

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.

Automated border control using blockchain

● 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

○ 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
○ 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

○ 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

● 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

○ 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

○ 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.

○ 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.

● 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. 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

● 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

● 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

● 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

● 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

● 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

● 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

● 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.

● 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

● 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. It 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

You might also like