block chain day1 to 7
block chain day1 to 7
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Recap:
• What are the different types of Blockchains
• Permissionless, Permissioned and Hybrid
• What are the permissionless Blockchains also called
• Public
• What are the permissioned Blockchains also called
• Private or Federated (Consortium)
• What are the elements of a Hybrid Blockchains
• The incorporate features of both private and public blockchains
• Which is the most popular open source public blockchain project
• Ethereum
• Which is the most popular open source private blockchain project
• Hyperledger
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Recap: Ethereum Smart Contracts
• Use Remix IDE to develop smart contracts for Ethereum
• Ethereum smart contracts are written in Solidty a programming language create
specifically for the purpose and is similar to C or C++
• Remix allows developers to create smart contracts, test them functionally as we
as run unit tests
• Requires ETH
• Develop on Testnet like Ropsten or Rikeby
• Test ETH can be requested from Metamask Faucet to execute smart contracts
https://ethereum.stackexchange.com/
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Recap: Metamask
• MetaMask is a software
cryptocurrency wallet
used to interact with the
Ethereum blockchain.
• It allows users to access
their Ethereum wallet
through a browser
extension or mobile app
• Users can connect to
multiple networks to
• Transactions can be
traced on etherscan
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Hyperledger
• Hyperledger is an public/private blockchain
• It can be configure to run as a private network or as a public network
• Members do not need any tokens to use the network
• When used as a private network, there are no rewards or transaction fees.
• Monetary considerations are external to the functioning of the blockchain and are
usually part of the membership agreements
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Hyperledger Fabric - development
• To develop applications for Hyperledger Fabric, local installations are needed
• Fabric can be installed on a Unix, Windows or a MacOS machine
• While there are no restrictions on the OS, it is recommended to use Ubuntu as the
support community is more active for Ubuntu
• Users can use command line or the VSCode extension to develop the applications; these
are independent vendor provided extensions
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Hyperledger Fabric - development
• Fabric installation
will also install
sample applications
• These can be used
to learn and build
new applications
https://hyperledger-
fabric.readthedocs.io/en/release-
1.2/understand_fabcar_network.html
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Hyperledger Fabric – Installation and development
Fabric installation for https://hyperledger-fabric.readthedocs.io/en/release-1.4/dev-setup/devenv.html
Ubuntu
https://medium.com/coinmonks/install-and-configure-hyperledger-fabric-v1-4-on-ubuntu-
18-04-3-lts-2ccbc7176887
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Hyperledger Fabric – Fabcar
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Quiz
1. Public blockchain requires ownership of 4. Which of these is a public blockchain
native tokens a) Ethereum
a) True b) Ripple
b) False c) B3i
c) Maybe 5. Smart contracts are
2. Federated blockchain networks can be a) Contracts made by smart people
susceptible to 51% attacks b) Contracts made using smart objectives
a) True c) Software code that execute on blockchain
b) False when conditions are met
c) Maybe 6. Private/Public keys are used in blockchain
3. Hyper ledger can be configured as to
a) Private a) Ensure data integrity
b) Public b) Ensure user validity
c) Federated c) They are not used in blockchain
d) Hybrid
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Traditional Systems
• Traditional systems for centuries have been
centralized.
• From ancient human communities to today’s
societal structures have revolved around a
central authority
• Organizations too for the longest of times
have been built around hierarchical
structures reflecting the social environments.
• Systems to support these structures too
needed to reflect a centralized structure
• However in recent times, there has been an
increasing move towards decentralization
both in terms of authority
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Traditional Systems
• An information system can be defined as a formal sociotechnical organizational
system designed to collect, process, store, and distribute information.
• In many organizations specialized to manage these information systems.
• An information system has five pillars
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Traditional Systems
• Current systems are built on the concept of a central authority.
• Participants trust central authority
• Reliability of the transactions are dependent on the protocols defined by the
central authority
• There is no anonymity in the transactions. The central authority has visibility of
all parties of the transaction along with its data
• Access to the system is provided by the central authority
• Single point of failure as there is one copy of the ledger
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Network Types
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Centralized Networks
Sorry sir, the server is down.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Centralized Networks
Advantages Drawbacks
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Distributed Networks
• A distributed network is a type of computer
network that is spread over different networks
• Data as well as software is spread across the
network
• This could be a computer network or over
internet
• Such networks are created to benefit from
parallel processing computing power
• Potential for localized failure; messages are lost
when connection between two or mode nodes in
lost
• Example : email servers
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Distributed Networks
Advantages Disadvantages
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Blockchain network
• We cannot use this even
for private blockchain as,
Can we use this network
all nodes in the
type to create a blockchain?
blockchain need to
NO maintain a copy of the
Image Source: https://hub.packtpub.com/
ledger for validation
• Nodes cannot keep
pulling the ledger every
time they are expected to
validate the ledger
• Public is from an access
control point of view only
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Blockchain network
OR
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Blockchain or Database
Is blockchain a database?
True
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Blockchain or Database
Blockchain Database
Blockchain Database
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Blockchain or Database - Comparision
Database Consortium – FEDERATED Public HYBRID
Access Permissioned Permissioned Permissionless Permissioned
Performance Highly performant More performant than public Slow More performant than public
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Quiz
1. Blockchain is always preferable to database 4. Every database is a blockchain
True a) True
a) False b) False
b) Maybe c) Maybe
2. Centralized networks are good for small scale 5. A distributed database is the same as
operations blockchain
a) True a) True
b) False b) False
c) Maybe c) Maybe
3. Solutions can be created with a combination 6. Hyperledger based smart contracts can be
of blockchain and database created with JavaScript
a) True a) True
b) False b) False
c) Maybe c) Maybe
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Software
• Software is a set of instructions, data or programs used to operate computers
and execute specific tasks.
• Software in general can be categorized as systems software and application
software
• They usually need a license to operate on
Application
System Software Software
They are designed to manage systems They are designed for specific business
resources purpose
Is blockchain a software?
INFO@EARLYRISE.IN
What type of software would blockchain be? WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
System Software
Application
System Software Software
• They are very complex in nature • They are comparatively simpler in nature
• A computer cannot run without • They cannot be executed independent of
system software system software
• Same software can be deployed • Each organization may have specialized
across needs and application software are
• They have no dependency on any customized to help them achieve their
other software objectives
• Users do not need to interact directly • Users directly interact with the
• For e.g. operating systems like application software
Windows, MacOS, Linux
INFO@EARLYRISE.IN
• For e..g browsers, productivity tools, etc
WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Software Delivery
• Traditionally we have had software being distributed centrally.
• The owner of the software would circulate the software to licensees via a storage
media
• When internet matures, physical devices were delivered over internet using secure
mechanisms
• Now we are in the age of “cloud”. More and more organizations are opting out of
the standalone software and moving to could base Software-as-a-Service (SaaS)
models
• Blockchain to is evolving into Blockchain- as-a-Service (BaaS) refers to third-party
cloud-based infrastructure and management who build and operate blockchain
apps. They operate like a sort of web host, running the back-end operation for a
block-chain based app or platform
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Firmare
• Firmware is a specific class of computer software that provides the low-level
control for a device's specific hardware.
Mining
• It needs specialized hardware
• It needs specialized software
Remember what • To reduce compute times hardware is now being
mining is? embedded with mining software as firmware
• This done to gain competitive advantage at
Mining is the process that
nan/pico sends levels
Bitcoin and several other
cryptocurrencies use to mint • As mining becomes more difficult, embedded
new coins and verify and secure mining software will become the norm
their blockchains.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Blockchain
• Blockchain is an application software (distributed ledger software) that allows
distributed networks to operate in a trustless manner
• It also ensures that all nodes in the network are able to remain in sync with
each other
• Most blockchain software are open source for e.g. Ethereum’s Solidity is
distributed under SPDX’s MIT license
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Blockchain Tools
• Solidity - Solidity is, undoubtedly, one of the most popular languages used by
Blockchain Developers. Influenced by C++, Python, and JavaScript, it was
designed to target the Ethereum Virtual Machine(EVM).
• Geth - Geth is used for different tasks on the Ethereum Blockchain, such as
transferring tokens, mining ether tokens, creating smart contracts, and to
explore block history.
• Mist - Mist is the official Ethereum wallet developed by the creators of
Ethereum. Mist is particularly suitable for deploying smart contracts
• Remix - Remix IDE is a browser- tool used for writing, testing, debugging, and
deploying smart contracts written in Solidity. It can be used either locally or in
the browser.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Blockchain Tools
• Metamask - Metamask is a wallet designed to function that acts as a bridge
between Ethereum Blockchain and a browser.
• Truffle - Truffle is an Ethereum Blockchain framework to create a development
environment for creating Ethereum-based apps. It comes equipped with a vast
library that provides custom deployments for writing new smart contracts,
develop complex Ethereum dApps.
• Ganache - Ganache is a Blockchain tool from the Truffle Suite that allows you to
create your own private Ethereum blockchain to test dApps, execute
commands, and inspect state while taking full control of the operation of the
chain.
• Blockchain Testnet - A Blockchain Testnet allows you to test dApps before
making them live. Each blockchain solution has its unique Testnet
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Ethereum Smart Contract – Hands On
• Create a smart contract that adds two integers
• Run the contract and verify that it works
• Create unit tests and execute them and ensure that you have more than 50% of
the tests being executed succesfully
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Ethereum Smart Contract – Hands On
pragma solidity ^0.4.24;
contract SimpleStore {
address creator;
uint a = 1;
uint b = 2;
uint c;
/**********
Standard kill() function to recover funds
**********/
INFO@EARLYRISE.IN } WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Recap:
• What are the differences between blockchain and traditional
systems
• Decentralization
• What is the key differentiator between Centralized Networks,
Distributed Networks and Decentralized Networks
• Single point of failure
• What advantage does a blockchain provide over a database
• Data immutability, no single point of failure
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Day 6
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Recap
Blockchain vs Ethereum
Network Types
Database Smart Contract
Centralized
De-Centralized
Distributed
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Decentralized Autonomous Organization
• DAO is a Decentralized Autonomous Organization is
member-owned communities without centralized MakerDAO
leadership.
• Membership based on ownership of DAO issued
governance tokens One of the most popular
DAOs is MakerDAO which
• Number of votes is proportionate to the number of tokens
is a credit lending
held platform, where loans are
• Governance conducted through proposals that members offered against DAI, its
own stablecoin which is
vote on through the blockchain
pegged to USD.
• Votes & activities are posted on blockchain for all to see
• DAOs rely on smart contracts for voting and outcomes
are automatically executed
• Legal status of DAOs is not yet very clear
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
DAO vs Traditional Organisations
Traditional
DAO
Organization
• Flat and fully democratic • Hierarchical structure
• Voting needed for implementing changes • Change can be implemented by single
• Outcome of voting is executed automatically authority or by voting
• All services offered are managed • Outcome of voting is executed manually
automatically by code • Any services offered usually need human
• All activity is transparent and visible to intervention and prone to manipulation
public • Activity is private and public has no visibility
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
DAO
Advantages Disadvantages
• Decentralized – decisions are made by community • Delays – Decision making make take longer as it
• Participation – Members are empowered in the goes through voting, and every token holder
decision making gets opportunity to vote
• Transparency – All activities and decision making • Decision making is slow also due to the need to
is published to the blockchain encourages educate the community about the proposal as it
members to act responsibly is made up of diverse individuals
• Community – Join like minded individuals for a • It is vulnerable to severe security threats as it is
common objective difficult to implement
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
DAO: Governance Tokens
• Governance tokens give holders the right to vote on issues that govern the
development and operations of a blockchain project.
• They are often awarded to active users for their loyalty and contributions to the
community
• It’s a method for projects to distribute the decision-making power to their
communities.
• This decentralized governance model helps align the interests of the token
holders with that of the project.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
DAO - types
• DAOs operate in a variety of use cases
Collect funds for They re focused on Collect funds for Collect expensive
grants in other determining the right investments in other collectibles like art
decentralized protocols for a decentralized
projects decentralized project projects
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
DAO - types
• DAOs operate in a variety of use cases
Media &
Service DAO Social DAO
Entertainment
Typically engaged in They re focused on Focused on sharing
providing talent for determining the right community driven
the decentralized protocols for a content in the media
projects decentralized project and entertainment
space
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
DAO: Landscape
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Quiz
1. DAOs use governance tokens to 5. Private Blockchain can implement a
a) Allow voting centralized network
b) For good behavior a) True
c) When any proposal is approved as reward b) False
2. Collector DAOs c) Depends on the use case
a) Provide grants to distributed projects 6. Federated Blockchains implement a
b) Help ownership of expensive assets a) Client-Server
3. DAOs are recognized as legal entities b) Private Peer-to-Peer
a) True
b) False
c) Only in some countries
4. DAOs are created as centralized
communities
a) True
b)INFO@EARLYRISE.IN
False WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Coins and Tokens
Coins Tokens
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Tokens - Types
Are sold as part of a fund These are securitized Used for buying goods or services
development and can be used as cryptocurrencies that derive value on digital platforms without an
part of a network or project e.g. from an external asset that can be intermediary
loyalty programs.. traded under a financial regulation
as security. Can be further For e.g. Monero, Ethereum, and
For e.g. Funfair, Basic Attention classified as Equity or Asset backed Bitcoin
Token, Brickblock, Timicoin, Sirin tokens
Labs Token, and Golem.
For e.g. Sia Funds, Bcap
(Blockchain Capital), and Science
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Blockchain.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Tokens - Types
Non-fungible Exchange PrivacyTokens
Tokens Tokens
A non-fungible token is a digital Primarily used them for facilitating Used for privacy applications
certificate of ownership to a exchange between other tokens or because their code
unique, non-replaceable item or as gas utility payments on crypto encourages better privacy
one not tradeable with another exchanges.
For e.g. Monero, Zcash, Dash,
For e.g. Logan Paul’s video clips, For e.g. Binance Coin or BNB token, Horizen, Beam, and Verge.
Twitter Founder Jack Dorsey’s first Gemini USD, FTX Coin for FTX
tweets NFT Exchange
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Tokens - Types
Asset backed
DeFi Tokens Stabletokens
Tokens
Form of programmable money Category of cryptocurrencies Stable tokens or stablecoins as they
where developers can program whose underlying value is backed are mainly called, are backed by a
logic into payments and by a real-world asset that could be stable or fairly value-stable asset
transaction flows. other money, stock, bonds, real like fiat
estate, gold, and precious money.
For e.g. Solana, Chainlink, Uniswap, For e.g. Tether, which is backed on
Polkadot, Aave For e.g. Quadrant Token which a 1:1 ratio with USD fiat
tokenizes the Quadrant Biosciences
Inc equity, OilCoin which tokenizes
barrels of oil held in reserve
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Tokens balances
Account
UTXO
Balances
• Amount of digital currency left remaining after a • Imitate real life accounts like in banks
transaction. • Owners balances are easily known
• Created through the consumption of existing UTXOs. Inputs • Ethereum uses this principle
consume an existing UTXO, while outputs create a new • Balance is maintained against account’s
UTXO. address
• Can be used only once and hence prevents double spending
• Bitcoin works on this principle
For example – You have 1 BTC. This represents your UTXO. If
you purchase something from Bob for .5 BTC. This will be
reflected as two transactions i.e. 1 BTC transferred to Bob and
.5 transferred back to you. Your new UTXO is worth .5
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Ethereum – Tokenomics
• Tokenomics is a term that describes the factors that impact a token’s use and
value
• Including but not limited to the token’s creation and distribution, supply and
demand, incentive mechanisms, and token burn schedules.
• For crypto projects, well-designed tokenomics is critical to success.
• Assessing a project’s tokenomics before deciding to participate is essential for
investors and stakeholders.
• Unlike fiat currencies, the rules of tokenomics are implemented through code
and are transparent, predictable, and difficult to change.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Tokenomics - Elements
Supply Utility Incentives
• Maximum supply- - Maximum number Token utility refers to the How a token incentivizes
of tokens that will exist in the lifetime of use cases designed for a participants is critical to
this token. For e.g. Bitcoin 21 million token. The utility help ensure long-term
coins. Litecoin 84 million coins. determine the potential use sustainability and is at the
Ethereum has no maximum limit, new cases for a token, which is center of tokenomics.
tokens are issues every year essential in understanding
• Circulating supply - Refers to the how the token’s economy
number of tokens in circulation. Tokens will likely evolve.
can be minted and burned, or be locked
up in other ways. This has an effect on
the price of the token as well.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Tokenomics - Future
• Non-fungible tokens (NFTs) provide a different tokenomics model based on
digital scarcity.
• The tokenization models for traditional assets such as real estate and artworks
are continuously evolving as they become mainstream.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Issuance of Tokens
• Tokens are created through an initial coin offering (ICO), which represents the
blockchain of an initial public offering (IPO).
• Tokens are created by cryptocurrency companies that want to raise money.
• Investors who are interested in the company can purchase these tokens.
• Payments for ICOs are usually done in a digital currency, hence investors first
need to purchase a digital currency already in circulation.
• ICOs are completely unregulated.
• As part of an ICO campaign, the project initiators would issue a whitepaper that
outlines the details of the project
Ethereum's ICO in 2014 is an early, prominent example of an initial coin offering.
The Ethereum ICO raised $18 million over a period of 42 days.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
On-chain vs Off-chain
On-chain On-chain
• They are transactions that occur on the • Off-chain transactions are processed
blockchain. outside the blockchain.
• These transactions are stored on the • An off-chain transaction takes the value
distributed ledger and visible to anyone outside of the blockchain.
who has a copy of the ledger. • They can be executed instantaneously
• Transactions take time • Do not require transaction fees
• Require transaction fees
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Off-chain
Considerations for storing store data off-chain
• Off-chain data stores can be used to store large documents of application
artifacts when the only shared value of the application is the evidence of the
artifact state at a point in time. The ledger includes cryptographic hashes
identifying the corresponding data residing on the off-chain data store.
• Recent values of the state of on-chain data to leverage technology such as
advanced search and analytics
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Oracles
• Smart contracts have an inherent design flow
• The are not able to interact with resources outside the blockchain network or
off-chain networks
Source:
https://chain.link/education/blockchain-
oracles
For example, there is a betting application that is written on blockchain. When the bets are place in the real
world, money is transferred to an escrow account. When the betting event occurs, how does the smart contract
know whether to release the funds to the winning bets. Oracles are used to fetch these outcomes off-chain and
deliver it to the blockchain in a secure and reliable manner.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Oracles - Types
• Oracles can be classified based on the source, direction and decentralization of
data
Inbound/ Centralized/
Software Hardware
Outbound Decentralized
This information A hardware oracle Inbound - transmit Centralized Data is
comes any data source “translates” real- information from received from a
available on the world events into external sources to single entity.
internet digital values. smart contracts, Decentralized - The
For e.g. exchange rates, For e.g. Sensor that Outbound - Send smart contract
digital asset prices collects weather data information from queries multiple
smart contracts to the oracles to determine
external world. the validity and
accuracy of the data
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Oracles - Types
• Oracles can be classified based on the source, direction and decentralization of
data
Contract-
Human
specific
Designed to be used by Individuals with
a single smart contract. specialized
For.e.g. market knowledge can also
intelligence for a serve as oracles.
specific product or For e.g. specialized
service or efficacy of research output
drug trial
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
The Oracle Problem
• Smart contracts execute decisions based on data provided by oracles
• The main challenge with this approach is that if the oracle is compromised
• This is often referred to as The Oracle Problem.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Fees
• Gas fees are payments individuals make to complete a transaction on a
blockchain
• These fees are used to compensate blockchain miners for the computing power
or staking used to verify blockchain transactions.
• They are typically paid in the blockchain’s native cryptocurrency
• Price of gas depends mainly on two main factors i.e. block time (the time
required for the respective blockchain to generate new blocks) and transaction
throughput (how many transactions a single block can process).
• In general, the faster blocks are generated and more transactions they can hold,
the less block-space competition there will be. This results in cheaper
transaction fees for all network users.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Ethereum – Gas Fee Calculation
Total Gas Fee = Gas units (limit) x (Base fee + Tip)
• A gas limit is the maximum amount of gas (or energy) that a cryptocurrency user is willing to pay when
completing a transaction on the blockchain. Default is set at 21,000 gwei
• Base fee that is dependent on network congestion. To prevent miners from gaming the system, these fees
are burnt
• To compensate miners for the base fee that they would’ve received in case of a genuine network
congestion, users are expected to include a priority fee (tip) with each transaction. The higher the priority
fee, the quicker the transaction will process.
What is gwei?
1 gwei = 0.000000001 ETH
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Quizz
1. Gas fees are 5. A block chain network needs to capture a
a) Required to pay to the owner of the network copy of government issued identify. An
b) Are paid to the miners for their effort to add a block optimal place to store this would be
c) Is optional and may not be paid by the users a) Onchain
b) Offchain
2. Tokens are c) Does not matter
a) Native to the blockchain network
b) Have an underlying assets
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Blockchain Development
Ethereum Hyperledger
Remix VSCode
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Ethereum - building blocks
https://etherscan.io/ http://ethviewer.live/
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Ethereum – Build a Smart Contract
C++
Py Remix
Solidity
JS
Sample Smart Contracts -
https://remix.ethereum.org/ https://docs.soliditylang.org/en/v
0.5.3/solidity-by-example.html
Turin Complete
Output
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Remix IDE (Compile, Deploy and Run)
Compiler Version
SolidityDefines where
contract will be
deployed.
Developers can
connect to local
Ipfs (Interplanetary file
Turin Complete system)
Ganache or to a
public VM
• Is a protocol/p2p
network for storing and
sharing files.
• Many blockchain
applications are
Account that
published on Ipfs for deploys and owns
e.g. Filecoin, Brave, etc the contract
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Remix IDE – Run and test
Deployed contract
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Remix IDE – Debug • Etereum requires Ether (ETH) to execute the contract
• ETH is a native token of the Ethereum Network
• ETH has multiple denominations much like a fiat for e.g.
INR – 1 INR = 100 Paise
Source: https://ethereum.org
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Remix IDE – Ganache Demo
Ganache is a private Ethereum blockchain environment that allows to you emulate
the Ethereum blockchain so that you can interact with smart contracts in your own
private blockchain.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Smart Contract - Hands on
Create an if else smart contract using Solidity
// SPDX-License-Identifier: MIT
• Create an integer variable to capture pragma solidity ^0.8.13;
user input
• If the input is less than 10, print 0. contract IfElse {
• If the input is less than 20, print 1. function compare(uint x) public pure returns (uint)
• If the input is greater than 20, print 2 {
if (x < 10) {
return 0;
} else if (x < 20) {
return 1;
} else {
return 2;
}
}
INFO@EARLYRISE.IN } WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Hyperledger
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Hyperledger Fabric
It contains
• Shared Ledger and smart contracts
• Ledger has two components
• World State – it’s the state of the ledger at any given
point in time. Ledger states are key-value pairs that
records a set of facts about a particular business object
• Transaction Logs – Induces all transactions that have
contributed to the current state. This is also called the
Blockchain Source: https://hyperledger-fabric.readthedocs.io/
• The ledger is built by default by LevelDb
(key value pair); alternatively one can use
CouchDb (most common)
• Smart contracts are written in chaincode
• Smart contracts interact with world state
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Hyperledger – Typical flow
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Hyperledger Fabric – Design Features
Security &
Membership Consensus
services
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Design Features
Assets Chaincode
• Software that allows definition and modification of
• Allows definition of both tangible as well as
assets on the chain
intangible assets
• It encapsulates the business logic
• This enables the exchange of almost anything of
Security • Execution is partitioned from transaction ordering,
value over the network which can include &
limiting the required levels of trust and verification
Membership
anything from whole foods to antique cars to
across node types, and optimizing network
currency futures. services scalability and performance.
• Chaincodes transactions allow modification of the
• Functions execute against the ledger’s current
assets
state database and are initiated through a
• Assets are represented as a collection of key value
transaction proposal.
pairs in binary or JSON format
• Execution results in a set of key-value writes
(write set) that can be submitted to the network
{key=car; value=Audi}
and applied to the ledger on all peers.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Design Features
Ledger Privacy
• The ledger is the sequenced, tamper-resistant record • Ledger and chaincode is deployed on a per-channel
of all state transitions in the fabric. basis.
• State transitions are a result of chaincode invocations • A ledger exists in the scope of a channel — the
(‘transactions’) submitted by participating
Security & parties. network can operate a single channel or it can be
• Each transaction results in a set of asset key-value privatized by including only a specific set of
pairs that are committed to theMembership
ledger as creates, participants.
updates, or deletes. services • Creating a separate channel will allow segregation of
• The ledger is comprised of a blockchain (‘chain’), as ledger and transactions
well as a state database to maintain current fabric • Additional privacy can be defined by installing
state. chaincode on only those nodes that need to access the
• There is one ledger per channel. asset state
• Each peer maintains a copy of the ledger for each • If additional data security is needed a private data
channel of which they are a member. collection can be created and permissioned
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Design Features
Security &
Membership Consensus
services
• Hyperledger is a private network where identities • Consensus in Hyperledger defined as the full-circle
of participants are known verification of the correctness of a set of
• Data access levels can be controlled and transactions comprising a block, where the circle
manipulated at a channel level Security & includes transactions flow from proposal and
endorsement, to ordering, validation and
Membership
commitment
services
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Hyperledger network components
Channel Certificate
Authority
• Is a private subnet used by entitled participants • Registers identities i.e. creates the username,
for transacting with each other password and other attributes
• Issues the Enrollment Certificate i.e. a certificate
Groups and its private key
Peer-2-Peer
• Renew or revoke the Enrollment Certificates
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Hyperledger network components
Membership Certificate
Service Provider Authority
• Peers host ledgers and smart • Registers identities i.e. username,
contracts. password and other attributes
• Endorser Peer - validates the transaction and • Issues the Enrollment Certificate i.e. a
executes the chaincode
• Anchor Peer – Receives updates and broadcast
certificate and its private key
it to other peers in the organization • Renew or revoke the Enrollment
• Orderer Peer – Is responsible to maintain the Certificates
state of the ledger across the network • Identity Certificate – Used by Fabric component
(Amin, Client, Peer and Orderer)
• TLS certificate - To communicate between a
client and node and is a requirement for
communication within a channel
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Hyperledger - Terminal
Folder on machine
Sample Fabric projects
where Fabric is setup
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Membership Service Provider
• Provides a layer of abstraction for membership operations i.e. cryptographic
mechanisms and protocols behind
• Issuing certificates
• Validating certificates
• User authentication
• By default Hyperledger invokes Fabric CA, however one can configure other CA’s
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Ordering Service
• An orderer is responsible for ordering of transactions
• A group of orderers together form the ordering service
• This provides a deterministic consensus ensuring there is always a sing state of the ledger across the network
• They are implemented using
• Raft – It follows a “leader and follower” model. A leader node is elected (per channel) and its decisions are
replicated by the followers. It is easier to set up and manage allowing different organizations to contribute
nodes to a distributed ordering service.
• Kafka - a distributed pub-sub messaging system and a robust queue capable of handling high volume of
data. It is suitable for offline as well as online message consumption. Messages are persisted as well as
replicated.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Hyperledger Fabric – Transaction Flow
• Client submits a transaction proposal to the
endorsing peers
• The endorsing peers validate the proposal
and return the response (valid/invalid) back
to the client
• Client submits endorsed transaction to the
ordering service
• The ordering service creates blocks with the
endorsed transactions
• The ordering service published the blocks to
all peers on the channel for final validation
Source: https://hyperledger-fabric.readthedocs.io/
• Each orderer is connected to a set of peers. It
is not necessary for a peer to be connected to
an ordered
• Each transaction is endorsed
• Endorsements match
• Not invalid due to a subsequent transaction
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Hyperledger - Steps to create an application
• Identify and define your use case
• Identify if it’s a consortium or a private network
• Identify organizations that are part of the network
• Identify the nodes that are needed
• Identify the channels that are needed and its rules
• Identify the CA for each organization and defined the MSP
• Identify any external interfaces
• Identify the assets being exchanged, the transactions related to the assets life
cycle and the states in which the assets transition to
• Identify the chaincode/smart contracts needed
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Distributed Applications - Dapps
Platform Total Dapps Daily Active users Transactions (24 hr) Volume (24 hr) Number contracts
Steem 79 ? ? ? ?
Source: https://topflightapps.com/
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Steps to create an application
• Clarify your idea - The idea is the first thing you need to think about before you
start to develop a blockchain app. Evaluate if you need a blockchain in the first
place. Consider the problems you want to solve with your DApp and start
formalizing your idea.
• Competitor research - Analyze what solutions are already out there. Identify a
niche.
• Analyze your options - There are four ways you can build your DApp from a
technical standpoint:
• Use an open blockchain for your own application.
• Create a private network
• Choose a BaaS (Blockchain as a Service) provider and integrate their cloud service into your app for e.g.
AWS, Azure, and Microsoft all offer BaaS products.
Build your own blockchain network on the most suitable platform for you.
•INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Steps to create an application
• Choose a platform
• Ethereum – The most popular platform that allows you create your own ecosystem using Solidity..
• Hyperledger –If you need a corporate tool for exchanging data within your own company, Hyperledger is
great for you. To build an app on this platform, you’ll need a team of Go, Java, and JavaScript blockchain
app developers.
• R3 Corda – A platform that mostly focuses on creating permissioned blockchains for commerce,
healthcare, trade finance, and supply chain. Makes it easy to integrate with legacy systems.
• Ripple – Used by those who want to create a financial application. Ripple allows you to easily send money
anywhere on the planet and connect to banks and payment providers.
• Start the development process (standard software dev process)
• Business analysis – Identify and define the requirements
• Design – Define the design of the application.
• Preparation stage – This consists of setting up the development environment, APIs, backend, and
architecture based on the requirements and design
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Steps to create an application
• Start the development process (standard software dev process)
• Development + quality assurance – Actual tasks of writing the code for the application and testing it
• Deployment – Deploy it on to an app store
• Maintenance and support – Post deployment support that would include fixing issues and rolling out new
features.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Typical applications of Blockchain
Banking Government
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Integrate application into Business Process
• Considerations when integrating apps with the business
• Depending on target audience, you may want to choose traditional payment gateway integration or use
cryptocurrencies
• Supply chains consist of many exchanges between different entities. A blockchain can be a great tool for
keeping track of all these stages.
• A blockchain provides security and can be configured to provide access to authorized users.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Demo- Ride sharing application
Actors?
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Demo- Ride sharing application
Actors Interaction
Driver
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Demo- Ride sharing application
Trust loops
Connectivity Trust
Platform Trust
Driver
Delivery Trust
Blockchain Telecom
User
Platform Trust
Connectivity Trust
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Demo- Ride sharing application
Smart Contracts?
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Demo- Ride sharing application
User - Smart Contract Interaction (Driver)
Rating Rating
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Demo- Ride sharing application
User - Smart Contract Interaction (User)
Rating Rating
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Demo- KYC Sharing
• An organization (Bank) as part of its customer onboarding has performed a KYC
• It now wants to share the KYC status with other organizations
• Create a blockchain based solution for KYC sharing between multiple organizations (Financial Institutions,
Telecos and Ecomm)
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Day 7
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Recap
Designing for Enterprise
Coins and
DAOs Oracles Gas Fees
Tokens
DAO is a Coins - Digital assets Third party or Third party or
Decentralized native to a particular decentralized data decentralized data
Autonomous blockchain and feed services that feed services that
Organization is defined by the provide external provide external
member-owned network protocol. data / off-chain data data / off-chain data
communities Tokens - Digital it onto the it onto the
without assets created by a blockchain. blockchain.
centralized project or smart
leadership. contract and built on
a blockchain
platform.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Demo- KYC Sharing
• An organization (Bank) as part of its customer onboarding has performed a KYC
• It now wants to share the KYC status with other organizations
• Create a blockchain based solution for KYC sharing between multiple organizations (Financial Institutions,
Telcos and Ecomm)
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Demo- KYC Sharing
Actors?
Financial
Telecos Ecomm
Institutions
Users
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Demo- KYC Sharing
Actors Interactions
Financial
Telecos Ecomm
Institutions
Users
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Demo- KYC Sharing
Trust Loops
Financial
Telecos Ecomm
Institutions
Authenticity Trust/
Confidentiality Trust
Users
Authenticity Trust/ Authenticity Trust/
Confidentiality Trust Confidentiality Trust
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Demo- Ride sharing application
Smart Contracts?
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Demo- Ride sharing application
User - Smart Contract Interaction (User)
Telecom Submit ID
KYC Ref
Submit ID
Financial
User
Institutions KYC Ref
Submit ID
KYC Ref
EComm
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Nodes
• Nodes are integral to blockchain as they validate transactions and keep the
network safe.
• A node is any physical device within a network of other tools that’s able to send,
receive, or forward information.
• In blockchain, a node is one of the computers that run the blockchain’s software to
validate and store the complete history of transactions on the network.
• In public networks anyone can set up a node; in private networks only those who
are invited/permissioned can set it up.
• While in general each node maintains identical copies of all the transactions, not
all nodes are required to do so
• Different nodes play different roles in the blockchain network
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Types of Nodes
Full Nodes Light Nodes Light Nodes
• Full nodes are expected to keep • Will only download essential • These are the nodes that can
a complete copy of all the data from processed add transactions to a
transactions. transactions. blockchain.
• They are involved in validating • Typically used as wallets • Every node in the blockchain
transactions for the • They connect to full nodes network has an option to
blockchain’s rules • Process little portions of the become a mining node.
• Instrumental in governance of blockchain instead of the whole
the blockchain for e.g. in bitcoin dataset
only 6.5 nodes are rewarded.
• They vote on any protocol level
changes
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Network Layers
• Blockchain networks are decentralized, composed
of nodes. This means that each node has to exert
considerable computing, bandwidth, and storage
resources to provide and maintain access to the
ledger.
• The more decentralized a blockchain is, the more
nodes it will have. While this redundancy is great
for the network’s security, it is not good for its
speed. That’s because more nodes are contributing
to transaction verification.
• This balancing act between security,
decentralization, and scalability is known as the
Blockchain Trilemma.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Blockchain Trilemma - Solution
• What do you do with a safe but congested highway? Build a bypass
• This is exactly how the Trilemma problem is solved in blockchain
• There are Layer 1 and Layer 2 blockchain networks.
• Layer 1 is the main network, in charge of on-chain transactions for e.g. Bitcoin
and Ethereum
• Layer 2 refers to a secondary framework or protocol that is built on top of an
existing blockchain system. The main goal of these protocols is to solve the
transaction speed and scaling difficulties that are being faced by the main
networks. For e.g. Bitcoin Lightning Network and Ethereum Plasma
• ETH can process 20 transactions per second with an average confirmation
time of 5 minutes.
• The average confirmation time for a BTC payment is approximately 10
minutes, and it can process a maximum of 7 transactions per second.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Forks
• Consensus mechanisms are designed to result in a single blockchain that
contains verified data.
• However, many times, the nodes in the network can’t come reach a consensus.
• This event leads to forks i.e. point in which the ideal ‘single’ chain of blocks is
split into two or more chains which are all valid.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Forks – Typical reasons
• When new functionality is added to the blockchain
• When known security issues are fixed
• When the community can actually void all the transaction of a specific period if
they are found to be breached and malicious.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Types of Forks
There are there types of forks possible when there is no consensus
When there is a change in the When there is a change in the Multiple miners mine a new
software on nodes such that software on nodes such that block at nearly the same
the new blocks mined on the the new blocks mined on the time, the entire network may
basis of new rules are also basis of new rules are not not agree on the choice of the
considered valid by the old considered valid by the old new block. It occurs as it
version of the software. This version of the software. takes some finite time for the
feature is also called as Nodes can decide which fork information to propagate in
backwards-compatibility. to stay on. the entire blockchain
For e.g. The Bitcoin For e.g. Casper update in the network. These forks will
network’s SegWit Ethereum (PoW to PoS) resolve themselves.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Orphaned Blocks
• Orphaned blocks are created when temporary forks die
• The series of blocks that create a blockchain are related in that they receive
information from the blocks that preceded them. When a block is closed, its
data is encoded and passed on to the next block. These two blocks are a parent
and child block. If two blocks are opened from the same parent block
simultaneously, there are two child blocks. Only one of them can be integrated
into the chain.
• Network nodes can decide which chain will be carried forward
• These are not stale blocks, which are blocks that are rejected by the
blockchain network.
• In Ethereum orphaned blocks are know as “Uncles” or “Ommer Blocks”
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Uncles in Ethereum – Ghost Protocol
• Stands for Greedy Heaviest Observer Sub Tree
• The transactions in blockchain can be published from anywhere. Two miners can be
working on the same transaction producing two blocks.
• Only one of these transactions can be added to the main blockchain resulting in Uncles
• This means that all the work done by the second miner on verifying the second block
is lost (orphaned).
• The miner does not get rewarded.
• GHOST protocol is a chain selection rule that makes use of previously orphaned blocks
and adds them to the main blockchain and partially rewards the miner.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Uncles in Ethereum – Ghost Protocol
• GHOST works by sending dummy/empty packets or ‘ghosts’ to the receiver.
• A sender sends a ghost packet with a header and encrypted payload, but no
block reward (i.e., no transactions), and waits for an empty packet from the
receiver.
• If an empty packet is received, then it means that the receiver received the
ghost, so he can send up to 2*pendingtxns to the network without
broadcasting them.
• When more than one node has a pending transaction in the queue, then there
must be some sort of protocol in place for deciding which node will broadcast
its block (i.e., which node will win).
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Application Design Principles
Designing for Enterprise
• Use open source frameworks over proprietary solutions
• Use permissioned networks to develop trust and privacy. Public blockchains come
with little of no regulatory oversights or privacy which make it unsuitable for most
enterprises. Private blockchains on the other had offer both privacy as well as
access control
• While designing the system clear guidelines on how the network would be
governed.
• Leverage standards where possible. Adhere to the blockchain platform’s protocols
and data structures. It is a good practice to contribute to the community by
developing the standards.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Application Design Principles
Designing for Enterprise
• Enterprises depend on having an advantage over their peers by keeping their data
private. The solution being proposed must ensure that there are enough measures
to ensure data privacy. Ensure that the solution does not violate any data privacy
regulations across the jurisdictions it would operate in. Review access periodically
and take corrective actions where necessary
• Security of the platform is critical to its adoptability. The nature of private or
federated blockchains make is slightly easier than public chains. This is due to the
fewer number of nodes on the chain. If the network connects to external systems,
ensure the bridge between the chain and off-chain is secure. Most security
breaches in the cryptocurrencies world happen here i.e. when they interact with
external applications like wallets
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Application Design Principles
Designing for Enterprise
• Trust is at the core of blockchain. Hence design at every stage and level should add
to the trustability of the network. While onboarding new participants, ensure due
diligence before giving them access to the network.
• And finally like all other solutions keep the design simple. The more complex the
design the higher the probability of gaps that lead to poor design or worse a risky
network.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Requirements - Discussion
A consumer in Bangladesh wants to buys a product from India. The consumer is
unable to trust the seller as there is lack of adequate information creating a lack of
trust. Also the payment mechanism is very expensive and cumbersome. Create a
blockchain based platform for cross borders eComm solution.
Functional Non-functional
Defines what a product must do, Describes the general properties
what its features and functions of a system. They are also
are. known as quality attributes.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Requirements - Discussion
The following decision flow will
help in determining the choices
that will be made when creating
a design for your blockchain
network and application
Source : https://www.researchgate.net
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Dapps Architecture - Hyperledger
• Ethereum blockchain.
• Smart Contracts.
• Ethereum Virtual Machine (EVM).
• Front-end – either browser or mobile
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Dapps: Popular apps
Following are some of the most popular Dapps
• Chainlink : It secures the data feed to and from the smart contract. Smart contracts
may need a variety of data and Chainlink provides APIs. It acts as an Oracle
• Brave : It is a privacy based web browser, with about 9 million users. It is a blockchain
based digital advertising and services platform and puts user privacy at the core. Users
are rewarded with BATs or (Basic Attention Tokens). Participants are rewarded for
publishing content and consumers are rewarded for viewing content.
• MakerDAO : It is a peer-to-peer organization created to enable peopled to lend and
borrow crypto currencies
• KYC-Chain :Verifies in real-time both individual as we all as corporate identities for
criminal or prohibited activities.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Blockchain Testing:
• Blockchain testing is the systematic evaluation of the blockchain’s various
functional as well as non-functional components
• It involves testing several components such as blocks, mining, transactions,
wallets, and so on
• It require specific tools to test the components
• Why creating a testing strategy ensure it encompasses the entire environment.
This should include on-chain, off-chain as well as any connectivity between the
blockchain network and the external world.
• As blockchain is a immutable record store, it is important that the network is well
tested. Any error in how it manages transactions and blocks would mean
irreversible flaws in the environment. This means testing plays a pivotal role in a
blockchain network development.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Blockchain Testing: Challenges
• Blockchain Knowledge – Blockchain is a relatively new technology and real
world applications are not very common. Understanding of the technology is key
to develop test strategy, test cases and execution
• Lack of Testing Tools– a real measure on reliability of testing is the availability
and robustness of the tools that are used. Unfortunately for blockchain, there is a
lack of tools that can be relied on.
• Defining Test Strategy– Defining a test strategy extensive knowledge of the
technology as well as the business application. With the current shortage of
knowledgeable resources it is difficult to define an effective strategy.
• Different use cases different networks– Different use cases implement
different types of networks. Each of the network will have requirement which are
quite divergent.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Testing Challenges:
• Integration Testing– Blockchain has quite a few components based making integration
testing complex both in identifying alternative flows and their execution.
• Security– Testing for network security in a decentralized network is not easy to design
• Data Privacy - For use cases where data privacy is critical, creating enough robust
testing mechanisms is not straightforward. This is true of non-blockchain based systems
with similar requirements.
• Scalability – It is very difficult to emulate a decentralized network and test for
scalability. A mechanism to create hundreds and thousands of nodes is not only
painstakingly time consuming but is also expensive.
• Test Data - Central to any testing is the availability of reliable and diverse test data. In
case of blockchain applications, this is scarce to get for test environments.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Testing Types:
Functional Testing- It is the testing of components, systems and their functionality,
like the addition of a block in the blockchain, block size, chain size, etc.
Integration Testing- Tests the integration of interfaces between components and
different parts of the system.
Security Testing- Security testing is essential as blockchain is used in highly secure
financial, government, or regulatory environments.
Performance Testing- Traditionally blockchains have been know for their sluggish
performance but to the effort it takes to arrive at a consensus. However as more
organizations adopt blockchain, performance is fast become a key criteria and
hence needs to calibrated and assured.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Testing Types:
Node Testing- A blockchain utility is dependent nodes performing their functions
without any failures. Thus it becomes important to test the consensus mechanisms
and that manner in which the transactions are validated and added to blocks in a
fair manner.
Smart Contracts Testing- Smart contract testing performs detailed analysis and
evaluation of a smart contract to assess the quality of its source code during the
development cycle making it easier to identify vulnerabilities and reduce the
possibility of software errors that could lead to costly exploits. Smart contracts can
be tested either in automatic manner using scripts or manually and using smart
contract audits.
API Testing- Based on the use case the network would need to test both inbound or
outbound APIs.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Testing Tools:
While there are numerous challenges in creating a robust test strategy, multiple
communities are working on providing the kind of tools that are needed to make
blockchain applications more trustworthy
• Ganache– Helps you to examine all blocks and transactions to gain insight into
what’s happening under the hood. You can quickly fire up a personal Ethereum
blockchain which you can use to run tests, execute commands, and inspect state
while controlling how the chain operates.
• Ethereum Tester– Open-source testing library with API support for forks mining
& other testing functions.
• BitCoinJ–Java-based framework for Bitcoin-based applications.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Testing Tools:
• Populus– It is built on py.test framework and has Ethereum testing functionality
offered in the form of a specific set of features to test contract deployment.
• Manticore– Tool for the analysis of smart contracts and binaries, with features
like Program Exploration, input Generation, Error Discovery, etc.
• Truffle – It brings in good testing features, such as automated contract testing.
The framework holds capabilities beyond just testing functionality within the
Blockchain application.
• Embark – It is a testing framework that focuses on developing decentralized
applications (dApps) that run on various systems or nodes. It has integrations
with Ethereum blockchain, IPFS, and a decentralized communication platforms
such as Whisper and Orbit.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Automated Testing: Functional Testing
Integration
Unit Testing System Testing
Testing
Unit testing involves testing In integration testing, In system testing you check the end-
individual components in a individual components of the to-end flow of your smart contract
smart contract for correctness. A smart contract are tested from a user’s point of view. A good
unit test is simple, quick to run, together. This approach way to perform system testing on a
and provides a clear idea of what detects errors arising from smart contract is to deploy it on a
went wrong if the test fails. It interactions between different production-like environment, such
requires creating assertions like components of a contract or as a testnet.
“The contract reverts if not across multiple contracts.
approved in 5 minutes”
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Automated Testing: Static/dynamic analysis
Dynamic
Static analysis
analysis
Static analysis examines the Dynamic analysis techniques require
source code or bytecode (in case executing the smart contract in a runtime
of Ethereum) of a smart contract environment to identify issues in code.
before execution. This means Dynamic code analyzers observe contract
you can debug contract code behaviors during execution for
without actually running the vulnerabilities. Fuzzing is an example of a
program. Static analyzers can dynamic analysis technique for testing
detect common vulnerabilities in contracts where a fuzzer feeds your
smart contracts and aid smart contract with malformed and
compliance with best practices. invalid data and monitors how the
contract responds to those inputs.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Smart Contracts: Manual Testing
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Testing Tools: Ethereum
Ethereum networks provides various tools for different kind of testing
• Unit Tests
• Static/Dynamic Analysis
• Code Audits
• Bug Bounties
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Ethereum: Unit Testing Tool
Solidity-Coverage - Solidity code coverage tool useful for testing smart contracts.
Waffle - Framework for advanced smart contract dev & testing (ethers.js).
Remix Tests - Tool for testing Solidity smart contracts. Works underneath Remix IDE
"Solidity Unit Testing" plugin.
OpenZeppelin Test Helpers - Assertion library for smart contract testing to ensure your
contracts behave as expected!
Truffle smart contract test framework - Automated contract testing framework.
Brownie unit testing framework - Utilizes Pytest, a feature-rich test framework that
lets you write small tests with minimal code, scalable & extendable.
Foundry Tests (Forge) - A fast and flexible framework capable of executing simple unit
tests, gas optimization checks, and contract fuzzing.
Etheno - All-in-one Ethereum testing tool. Eliminates complexity of setting up analysis
tools like Manticore and Echidna.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Ethereum: Static Analysis Tools
Mythril - EVM bytecode assessment tool for detecting contract vulnerabilities.
Slither - Python-based Solidity static analysis framework for finding
vulnerabilities, enhancing code comprehension, and writing custom analyses for
smart contracts.
Rattle - EVM bytecode static analysis framework designed to work on deployed
smart contracts.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Testing Tools: Dynamic Analysis
• Echidna - Fast contract fuzzer for detecting vulnerabilities in smart contracts
through property-based testing.
• Harvey - Automated fuzzing tool useful for detecting property violations in
smart contract code.
• Manticore - Dynamic symbolic execution framework for analyzing EVM
bytecode.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Smart Contract Vulnerability tests
• SWC-registry: SWC definitions and a large repository of crafted and real-world
samples of vulnerable smart contracts.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Code Audits Platforms:
• ConsenSys Diligence - Smart contract auditing service that ensures ensure
protocols are ready for launch and built to protect users.
• CertiK - Pioneering security firm in the use of cutting-edge formal verification
technology on smart contracts and blockchain networks.
• Trail of Bits - Combines security research with an attacker mentality to reduce
risk and fortify code.
• PeckShield - Offers products & services for the security, privacy, and usability of
the blockchain ecosystem.
• QuantStamp - Blockchain technology auditing service focused on security and
risk assessment services.
• OpenZeppelin - Provides security audits for distributed systems.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Bug Bounties Platforms:
• Immunefi - Security researchers review code, disclose vulnerabilities, get paid,
and make crypto safer.
• HackerOne - Connects businesses with penetration testers and cybersecurity
researchers.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Bug Bounties Platforms:
• Immunefi - Security researchers review code, disclose vulnerabilities, get paid,
and make crypto safer.
• HackerOne - Connects businesses with penetration testers and cybersecurity
researchers.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
What to test:
Knowing what you want to check will also help you to select the right tool.
• State machine. - Most contracts can be represented as a state machine.
• No invalid state can be reached
• If a state is valid that it can be reached
• No state traps the contract.
• Access controls. If your system has privileged users (e.g. an owner, controllers, ...) you must ensure that
• each user can only perform the authorized actions and
• no user can block actions from a more privileged user.
• Arithmetic operations. Checking the soundness of arithmetic operations is critical. Using SafeMath is a good step to
prevent overflow/underflow, however, you must still consider other arithmetic flaws, including rounding issues and
flaws that trap the contract.
• Inheritance correctness. Solidity contracts rely heavily on multiple inheritance.
• External interactions. Contracts interact with each other or oracles, and some external contracts should not be
trusted.
• Standard conformance. Ethereum standards (e.g. ERC20) could flaws in their design. Being aware of these helps is
its selection.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Hands on:
• Create a smart contract and deploy it to Ganache
• Execute Transactions and verify them on Ganache
• Check the blockchain for creation of the blocks
• Verify if the transactions have been added to the blocks
• Check for gas fees on transactions
Use the messenger contract that you have already created in remix for this activity
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Typical applications of Blockchain
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
DEX – Decentralized Exchanges
• The two most common types are order book DEXs and automated market
makers (AMMs)
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
DEX – Decentralized Exchanges
• The two most common types are order book DEXs and automated market
makers (AMMs)
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Crypto Wallets
• Crypto wallets keep your private keys
• They enable you to send and receive cryptocurrencies Ledger Wallet
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Crypto Wallets
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
DeFi – Decentralized Finance
• An emerging financial technology based on secure Decentralized finance is
distributed ledgers. The system removes the control the one of the fastest
banks and institutions have on money, financial growing sectors in
products, and financial services. blockchain
• Users do similar things that they would do in
traditional finance aka borrow money, make loans
or trade assets. The only difference: no
intermediaries, it is code drive.
•Some of the key attractions of DeFi
• Eliminates the fees that banks and other financial companies charge
• Money in a secure digital wallet instead of a bank.
• Anyone with an internet connection and a wallet can use it without
needing approval.
• You can transfer funds in instantaneously.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
DeFi – Decentralized Finance
• They are usually setup as DAOs
• Decision-making and transactions through the protocol are transparent through
public blockchain explorers, such as Etherscan.
• Some popular DeFi protocols include
• UniSwap – Crypto currency exchange
• GMX - Derivatives trading platforms (perpetual futures contracts on cryptocurrencies)
• Opyn - Options trading platforms
• Aave - lend and borrow cryptocurrencies and real-world assets (RWAs)
As of August 2022 the DeFi industry managed assets worth $69 billion in assets as
according to DefiLlama. That’s up from less than $1 billion at the start of 2020.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
DeFi – Decentralized Finance
Centralized Decentralized Traditional
Finance (CeFi) Finance (DeFi) Finance (TradFi)
• Refers to financial applications that • Powered by blockchain • The term “TradFi” is short
bridge the gap between traditional technology for traditional finance,
finance (TradFi) and modern financial • Users of decentralized • Relates to conventional
applications. platforms have custody and banking practices
• Have a centralized governing body in access to their funds. • Currently the largest &
control of any funds. • Can help in including the most familiar financial
• CeFi is an umbrella term that is applied unbanked into the formal infrastructure.
to centralized crypto exchanges and economy • Evolved over the centuries.
custodians, • Is less regulated than • Transactions are slow and
• Payments providers and FinTech TradFi, hence could involve expensive
applications may also be classified as higher risk • Deal with fiat currencies
CeFi
• Needs full KYC
For e.g.INFO@EARLYRISE.IN
Poloniex, Bittrex, Bitfinex WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
DeFi – Decentralized Finance
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Blockchain in supply chain
• Supply chain management is the management of the flow of goods and
services between businesses and locations. This can include the movement
and storage of raw materials, work-in-process inventory, finished goods, and
end to end order fulfilment from the point of origin to the point of
consumption.
• Supply chain data is not always visible, available or trusted.
• A blockchain supply chain helps participants record price, date, location,
quality, certification, and other relevant information to more effectively
manage the supply chain.
• Availability of this information on blockchain increases traceability of material
supply chain, lower losses from counterfeit and gray market, improve visibility
and compliance.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Web3 and Metaverse
• Web3 is an the third generation of the evolution of web technologies.
• It incorporates concepts such as decentralization, blockchain and token-based
economics.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Metaverse
• A true definition of Metaverse is not
there, well at least not yet.
• Many experts believe Metaverse to be a
3D model of the internet.
• Its basically a place parallel to the
physical world, where you spend your
digital life.
• People create digital avatars and you
interact with people and resource with
using your avatars.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Other Networks
While Ethereum is quite popular for developing applications, it is not the only
network to evaluate
If your use case requires any kind of If you are developing for
If your use case is in the domain of payments, Ripple would be the best cryptocurrencies or distributed
Healthcare, Finance, Capital choice apps related to
Markets, Digital Assets, Insurance,
cryptocurrencies, Solana is
Supply chain.
your go to network.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Tech for Good: Ethical Cobalt Mining Source:
• Cobalt mining can create serious pollution and health https://en.wikipedia.org
risks
• In poor countries it can lead to opportunistic mining
operations which put local communities at risk.
• There’s currently no foolproof way for companies to
prove to customers that they’ve sourced their cobalt
from safe mining operations.
Source:
• A consortium of Ford Motor Company, IBM, LG Chem, https://www.raconteur.net/
and RCS Global is working on a first-of-its-kind Source:
https://www.mining.com/
blockchain pilot to demonstrate how materials in the
cobalt supply chain can be responsibly produced, Cobalt mining in DRC
traded, and processed from mine to end manufacturer.
INFO@EARLYRISE.IN IBM BlockchainWWW.EARLYRISE.IN
(Hyperledger)
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
eCommerce: Mercado Libre
• Mercado Libre (MELI) is Latin America’s largest e-
commerce company by market cap
• It has rolled out its own cryptocurrency in Brazil called
Mercado Coin.
• It has a user base of 80 million in Brasil Source : https://latinafy.com/
• Users can use the coin to make purchases in their
stores.
• Users also receive cash backs into their wallets
• It has collaborated with Rippio to rollout this solution.
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Recap:
• What are Decentralized Ledgers
• Every has the same copy of the ledger
• What is Blockchain
• At its core a blockchain is a distributed and immutable ledger to record transactions
• What are the key development is Blockchain Platforms?
• 1991- tamperproof mechanism of timestamping a document
• 1998 – Bitgold
• 2008 – Satoshi Nakamoto’s whitepaper of blockchain
• 2010 – Bitcoin launched
• What is a Block?
• Collection of transactions
• What are the key principles of Blockchain
• Trust, Distributed & Decentralized, Anonymity
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Recap – Day 2
Cryptography
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Recap:
• What are the different types of Blockchains
• Permissionless, Permissioned and Hybrid
• What are the Permissionless Blockchains also called
• Public
• What are the permissioned Blockchains also called
• Private or Federated (Consortium)
• What are the elements of a Hybrid Blockchains
• The incorporate features of both private and public blockchains
• Which is the most popular open source public blockchain project
• Ethereum
• Which is the most popular open source private blockchain project
Hyperledger
• INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Recap
Blockchain vs Ethereum
Network Types
Database Smart Contract
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
Key Links
Hyperledger
Installation - https://hyperledger.github.io/composer/v0.19/installing/installing-prereqs.html
https://medium.com/coinmonks/install-and-configure-hyperledger-fabric-v1-4-on-ubuntu-18-04-3-lts-
2ccbc7176887
Community - https://ethereum.stackexchange.com/questions/tagged/hyperledger-fabric
Sample Code - https://github.com/hyperledger/fabric-samples
Ethereum
Documentation - https://ethereum.org/en/developers/docs/
IDE - https://remix.ethereum.org/
Ganache download - https://trufflesuite.com/ganache/
Code Samples for Solidity - https://solidity-by-example.org/
Community - https://ethereum.stackexchange.com/
Transaction explorer - https://etherscan.io/
Solidity cheat sheet - https://docs.soliditylang.org/en/v0.8.15/cheatsheet.html
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN
INFO@EARLYRISE.IN WWW.EARLYRISE.IN