0% found this document useful (0 votes)
4 views17 pages

BCT Unit 2 Notes

The document discusses the differences between centralized and decentralized applications, highlighting their architectures, advantages, and disadvantages. It also covers distributed consensus mechanisms in blockchain, including various consensus algorithms like Proof of Work, Proof of Stake, and others, explaining how they maintain trust and security in decentralized networks. Additionally, it outlines use cases for both centralized and decentralized applications across various industries.

Uploaded by

harsharepaka76
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)
4 views17 pages

BCT Unit 2 Notes

The document discusses the differences between centralized and decentralized applications, highlighting their architectures, advantages, and disadvantages. It also covers distributed consensus mechanisms in blockchain, including various consensus algorithms like Proof of Work, Proof of Stake, and others, explaining how they maintain trust and security in decentralized networks. Additionally, it outlines use cases for both centralized and decentralized applications across various industries.

Uploaded by

harsharepaka76
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

Blockchain Technologies (2025-26)

UNIT-II NOTES
Syllabus:
Decentralization mechanism of Bitcoin: Centralization verses Decentralization, Distributed Consensus, Consensus without
identity using a Bitcoin, Nakamoto consensus Incentives and proof of work, putting it all together. Bitcoin transaction,
Bitcoin Scripts, Proof of burn, Proof of stake, Application of Bitcoin script, Bitcoin block.

2.1 Centralization verses Decentralization


Centralized and decentralized applications (apps) represent two distinct approaches to software architecture and governance.
Centralized applications operate on a client-server model, where a single entity controls the server, data, and overall
functionality. In contrast, decentralized applications (DApps) leverage blockchain or peer-to-peer networks, distributing
control and data across multiple nodes. This article discusses the differences between centralized applications and
decentralized applications.
What are Centralized Applications?
Centralized applications operate on a client-server model where a single entity controls the server, data, and application logic.

Key Features
1. Single Point of Control: A central authority or organization manages the application, data storage, and user access.
2. Server-Client Architecture: Users interact with the application through a client (e.g., web browser, mobile app)
communicating with a central server, which processes requests and returns responses.
3. Data Storage: All user data is typically stored in a central database, managed by the organization behind the
application.
4. Easier Maintenance and Updates: Since the application is controlled by a single entity, it can be updated and
maintained more easily, ensuring consistent performance and feature updates.

Advantages
1. Simplicity: Centralized applications are generally easier for users to navigate and use due to a straightforward
interface and consistent user experience.
2. Performance: Central servers can be optimized for speed and efficiency, providing faster response times for users.
3. Control: The central authority can enforce policies, security measures, and regulations effectively.

Disadvantages
1. Single Point of Failure: If the central server goes down or experiences issues, the entire application can become
inaccessible.
2. Privacy Concerns: Users must trust the central authority to handle their data responsibly, raising concerns about data
breaches and misuse.
3. Censorship and Control: The central authority has the power to control content, enforce rules, or restrict access,
potentially leading to censorship.

Use Cases
1. Social Media Platforms: Centralized control allows for user engagement, content moderation, and targeted
advertising. Examples include Facebook, Twitter, etc.
2. E-commerce: Centralized applications facilitate product listings, transactions, and customer service. They enable
seamless inventory management and payment processing. Examples include eBay, Amazon, etc.
3. Online Banking: Centralized banking apps allow users to manage accounts, transfer funds, and access financial
services securely from a single interface. Examples include Chase, Bank of America, etc.
4. Cloud Storage Services: Users can store, share, and collaborate on files with centralized management of data access
and synchronization across devices. Examples include Google Drive, Dropbox, etc.
5. Streaming Services: Centralized control allows for content delivery, user subscriptions, and personalized
recommendations based on user preferences. Examples include Netflix, Spotify, etc.

What are Decentralized Applications?


Decentralized applications (DApps) are software applications that run on a peer-to-peer network, typically
utilizing blockchain technology. Unlike traditional centralized applications, which rely on a single server or authority for
management and data storage, DApps operate without a central point of control. This structure enhances security,
transparency, and user autonomy.

Key Features
1. Decentralization: DApps operate on distributed networks, reducing reliance on a single entity. Data and operations are shared across
multiple nodes.
2. Smart Contracts: Many DApps use smart contracts with the terms directly written into code. This automates processes and ensures that
transactions are executed as intended without intermediaries.
3. Transparency: All transactions and interactions within a DApp are recorded on the blockchain, allowing users to verify activities and
ensuring a transparent environment.
4. Immutability: Data stored on the blockchain cannot be easily altered or deleted, providing a permanent and verifiable record of all
transactions.
5. Token-based Economics: DApps often incorporate tokens for governance, transactions, and incentivizing user participation, enabling a
new economic model.
Advantages
1. Security: Enhanced security through cryptographic principles and distributed architecture, making it harder for malicious attacks to
succeed.
2. User Control: Users have greater control over their data and interactions, reducing reliance on centralized authorities.
3. Censorship Resistance: Difficult for any entity to censor or control the application, as it operates across multiple nodes.
Disadvantages
1. Complexity: DApps can be more complex to use than traditional applications, often requiring users to manage wallets and private keys,
which can be intimidating for non-technical users.
2. Performance Issues: DApps can suffer from slower transaction speeds and higher latency compared to centralized applications,
particularly when the underlying blockchain is congested.
3. Development Challenges: Building DApps requires specialized knowledge of blockchain technology and smart contract development,
which may limit the pool of available developers.
4. Lack of Regulation: The decentralized nature can lead to regulatory challenges, making it difficult for users and developers to navigate
the legal landscape.
5. Governance Issues: In decentralized networks, governance can be complicated. Reaching consensus among stakeholders can be slow
and contentious, potentially stalling development or changes.
Use Cases
1. Finance (DeFi): Enable users to trade, lend, and borrow assets without intermediaries, facilitating peer-to-peer financial services.
Examples include Uniswap, Aave, etc.
2. Non-Fungible Tokens (NFTs): Allow creators to tokenize and sell unique digital assets (art, collectibles) directly to buyers, ensuring
ownership verification. Examples include OpenSea, Rarible, etc.
3. Supply Chain Management: nhance transparency and traceability in supply chains, allowing stakeholders to verify product origins and
movements. Examples include VeChain, IBM Food Trust, etc.
4. Decentralized Autonomous Organizations (DAOs): Facilitate community-driven decision-making and governance without centralized
control, allowing members to vote on proposals. Examples include MakerDAO, Aragon, etc.
5. Identity Verification: Provide users with control over their digital identities, allowing secure and private verification without relying on
centralized authorities. Examples include uPort, Civic, etc.

2.2 Distributed Consensus


In blockchain technology, maintaining trust and security across a decentralized network is essential. This is achieved
through distributed consensus, a mechanism that allows multiple nodes to agree on the state of the network without
relying on a central authority. Distributed consensus ensures that transactions are validated, tamper-proof, and
synchronized across all participants, which is vital for preventing fraud and ensuring the integrity of the blockchain.

There are various consensus algorithms, such as Proof of Work (PoW) and Proof of Stake (PoS), designed to achieve
this agreement. Each algorithm offers a different balance of security, efficiency, and scalability, depending on the needs
of the blockchain network.

Consensus mechanisms basically need to make sure that the distributed ledger of a blockchain stays true. This is done
through the following steps:
1) When a transaction is initiated, it is verified by a designated verifier such as a validator(PoS) or miner(PoW).
2) Then the verifier broadcasts the transaction to the network.
3) Multiple verifiers, other than the first verifier, also verify the transactions.
4) After the transaction is verified by a certain number of verifiers, it is added to a block.
5) The block is then added to a blockchain when it has sufficient numbers of transactions.
6) After a few blocks, the transaction is finalized.

Types of Consensus Algorithms:


1. Permissionless /Public Network
i) Proof of Work(PoW)
ii) Proof of Stake(PoS)
iii) Proof of Burn(PoB)
iv) Proof of Delegated Stake (PoDS)
v) Proof of Authority (PoA)
vi) Proof of Elapsed Time (PoET)
vii) Proof of Capacity (PoC)

1. Proof of Work (PoW): This was the first consensus mechanism to come into existence with Bitcoin’s blockchain. Here,
transaction verifiers, also called as miners, run complex calculations to guess the nonce value which is unique for every
transaction. These nonce values are obtained from the hashing function with the following inputs (non-exhaustive list):
1. Transaction amount
2. Public address of receiver
3. Private key of sender
4. Hash of previous transaction

Every computer (or “node”) participating in a crypto’s blockchain network has its own copy of this blockchain (which, again,
is a history of transactions bundled into blocks).
How does a new transaction get into a block? This is where proof of work comes in. Suppose you want to send someone a
certain amount of Bitcoin:
i.) Transactions are grouped. Your transaction is pooled with other non-verified transactions (people buying,
selling, or exchanging Bitcoin). These transactions are waiting to be placed into a block.
ii.) Miners compete to verify the next block. Crypto miners worldwide (basically, computers operating in the
network) work to solve a complex mathematical puzzle. Their goal is to spit out a 64-bit “hash” (like a
signature or a password) that matches Bitcoin’s “target hash.” Truth be told, it’s a huge guessing game.
Mining computers make trillions of guesses per second, which is why, as we’ll explore later, the process is
energy inefficient and costly. It takes, on average, around ten minutes for miners to mine a new block.
iii.) A new block is mined and the transactions are added to the blockchain. The first miner to reach the goal gets
to write the next page of blockchain transactions. The grouped transactions are placed in a block. That block
with its solution is sent to the entire Bitcoin network so that each computer can validate it and update their
copies of the ledger.
Every move in the Bitcoin network must happen in “consensus,” meaning that all computers must agree to the same data.
This is why proof of work is called a “consensus mechanism.” It’s also why the Bitcoin network is referred to as a “trustless
system.” The entire system is mechanized by computer consensus rather than relying on the trust of any single entity (as
opposed to a banker who might accidentally “lose” your paycheck deposit or misallocate your funds).
Examples of Proof of Work Blockchains:
i.) Bitcoin
ii.) Dogecoin
iii.) Ethereum Classic
[Link] of Stake(PoS): Proof of Stake (PoS) is a blockchain consensus mechanism that achieves distributed agreement by
selecting block validators based on the amount of cryptocurrency they hold and "stake" as collateral, rather than through
energy-intensive mining. It is energy-efficient, secure, and incentivizes honesty by allowing the network to "slash"
(confiscate) staked assets if a validator acts maliciously.
 Proof-of-stake reduces the computational work needed for verifying blocks and transactions. While proof-of-work
relies on heavy computing for security, proof-of-stake allows coin owners to use their machines to verify blocks with
less computational effort. Owners stake their coins as collateral, earning the opportunity to validate blocks and
receive rewards.
 Validators are chosen randomly to confirm transactions and validate block information. This setup randomizes fee
collection, unlike the competitive rewards system in proof-of-work.
 To become a validator, a coin owner must "stake" a specific amount of coins. For example, Ethereum requires users
to stake 32 ETH to operate a node. Multiple validators must confirm a block's accuracy before it is finalized and
closed.1 Blocks are validated by multiple validators, and when a specific number of validators verify that the block is
accurate, it is finalized and closed.

PROOF OF ST AKE PROOF OF WORK


Block creators are called validators Block creators are called miners
Participants must own coins or tokens to become Participants must buy equipment and energy to become a
validators miner
Energy efficient Not energy efficient
Security through community control Robust security due to expensive upfront requirement
Validators receive transaction fees as rewards Miners receive block rewards and fees

[Link] of Burn(PoB): Proof-of-Burn (PoB) is a unique consensus mechanism in the world of cryptocurrencies. It
works by letting miners 'burn' or permanently destroy their crypto tokens.
 This burning process gives miners the right to write blocks based on how many coins they burned. The concept
behind PoB requires miners to burn some of their digital currencies for the opportunity to mine a new block. This
process, known as burning, involves sending tokens to an unspendable address, often referred to as an "eater"
address.
 These addresses can be checked by anyone, but no one can get to them. This means the coins sent there cannot be
gotten back or spent, so they are removed from [Link] a Proof of Burn (PoB) system, the amount of coins a miner
burns can affect their chances of being chosen to mine the next block.
 This is because burning coins serves as a display of their virtual mining power. Therefore, the more coins they burn,
the greater their mining power becomes, and vice versa. As mining power increases, miners can find
new blocks more quickly, leading to more rewards.
 Unlike the Proof of Work (PoW) system, PoB doesn't require expensive hardware or consume a lot of power,
making it an energy-efficient alternative.

[Link] of Delegated Stake (PoDS): Delegated Proof of Stake (DPoS) is a popular evolution of the PoS concept, whereby
users of the network vote and elect delegates to validate the next block. Delegates are also called witnesses or block
producers. Using DPoS, you can vote on delegates by pooling your tokens into a staking pool and linking those to a
particular delegate. You do not physically transfer your tokens to another wallet, but instead utilize a staking service provider
to stake your tokens in a staking pool.
 A limited number of delegates (most protocols choose between 20 and 100) are chosen for each new block, so the
delegates of one block might not be the delegates of the next. Elected delegates receive the transaction fees from the
validated block, and that reward is then shared with users who pooled their tokens in the successful delegate’s pool.
The more you stake, the higher a share of the block reward you receive. The rewards are shared based on each user’s
stake; so if your stake represents 5% of the total staking balance, you would receive 5% of the block reward.
 According to its proponents, DPoS is a more democratic way of choosing who verifies the next block, allowing a
more diverse group of people to participate in the process since it’s based on earned reputation as a lawful staker and
not overall wealth. Additionally, because there are a limited number of validators, DPoS allows the network to reach
consensus more quickly.

[Link] of Authority (PoA): Proof-of-Authority (PoA) consensus which provides high performance and fault tolerance.
Term was proposed in 2017 by co-founder of Ethereum and Parity Technologies Gavin Wood.
Working of PoA :
 In PoA, rights to generate new blocks are awarded to nodes that have proven their authority to do so. These nodes are
referred to as "Validators" and they run software allowing them to put transactions in blocks. Process is automated
and does not require validators to be constantly monitoring their computers but does require maintaining the
computer uncompromised. PoA is suited for both private networks and public networks, like POA Network, where
trust is distributed.
 PoA consensus algorithm leverages value of identities, which means that block validators are not staking coins but
their own reputation instead. PoA is secured by trust on the identities selected.

[Link] of Elapsed Time (PoET): Proof of Elapsed Time (PoET) is a network consensus algorithm that prevents high
resource utilization and energy consumption. It implements a fair lottery system to keep the process more efficient.
Here is an overview of how PoET works:
1. Initialization: Nodes set up secure hardware such as Intel SGX to enable trusted execution and random wait time
generation.
2. Random Wait Time Generation: Each node generates a random wait time using the secure hardware. The secure
hardware ensures that the wait time cannot be predicted or altered by the node itself, maintaining fairness in the
selection process.
3. Waiting Period: Each node waits for the duration of its randomly determined period before attempting to propose a
new block. Nodes do not perform any computational work during this period, which contrasts with Proof of Work
(PoW) where nodes perform intensive calculations.
4. Block Proposal: After the waiting period elapses, the node that has waited the longest is eligible to propose the next
block. The node that has waited the longest broadcasts its proposed block to the network.
5. Block Validation: Other nodes in the network verify the legitimacy of the proposed block and ensure that the
proposer adhered to the waiting time protocol. This verification involves checking that the proposer’s wait time was
indeed randomly generated and not manipulated.
6. Consensus Achievement: If the block proposal is valid and meets the network’s consensus rules, it is added to the
blockchain, and the network reaches consensus on the new state. The process then starts over with nodes generating
new random wait times for the next round of block proposals.

[Link] of Capacity (PoC): Proof of capacity allows the mining devices, also known as nodes, on the blockchain network
to use empty space on their hard drive to mine the available cryptocurrencies.
 Instead of repeatedly altering the numbers in the block header and repeated hashing for the solution value as in a
PoW system, PoC works by storing a list of possible solutions on the mining device’s hard drive even before the
mining activity commences.
 The larger the hard drive, the more possible solution values one can store on the hard drive, the more chances a
miner has to match the required hash value from his list, resulting in more chances to win the mining reward.
Permissioned/Private Network:
1. Practical Byzantine Fault Tolerance(PBFT)
2. Paxos
3. Raft

[Link] Byzantine Fault Tolerance(PBFT):


 Byzantine Fault Tolerance(BFT) is the feature of a distributed network to reach consensus(agreement on the same
value) even when some of the nodes in the network fail to respond or respond with incorrect information. The
objective of a BFT mechanism is to safeguard against the system failures by employing collective decision
making(both - correct and faulty nodes) which aims to reduce to influence of the faulty nodes. BFT is derived
from Byzantine Generals' Problem.
 Byzantine fault tolerance can be achieved if the correctly working nodes in the network reach an agreement on
their values. There can be a default vote value given to missing messages i.e., we can assume that the message
from a particular node is 'faulty' if the message is not received within a certain time limit. Furthermore, we can
also assign a default response if the majority of nodes respond with a correct value. Leslie Lamport proved that if
we have 3m+1 correctly working processors, a consensus(agreement on same state) can be reached if atmost m
processors are faulty which means that strictly more than two-thirds of the total number of processors should be
honest.
How pBFT works ?
pBFT tries to provide a practical Byzantine state machine replication that can work even when malicious nodes are operating
in the system. Nodes in a pBFT enabled distributed system are sequentially ordered with one node being the primary(or the
leader node) and others referred to as secondary(or the backup nodes). Note here that any eligible node in the system can
become the primary by transitioning from secondary to primary(typically, in the case of a primary node failure). The goal is
that all honest nodes help in reaching a consensus regarding the state of the system using the majority rule. A practical
Byzantine Fault Tolerant system can function on the condition that the maximum number of malicious nodes must not be
greater than or equal to one-third of all the nodes in the system. As the number of nodes increase, the system becomes more
secure. pBFT consensus rounds are broken into 4 phases(refer with the image below):
 The client sends a request to the primary(leader) node.
 The primary(leader) node broadcasts the request to the all the secondary(backup) nodes.
 The nodes(primary and secondaries) perform the service requested and then send back a reply to the client.
 The request is served successfully when the client receives 'm+1' replies from different nodes in the network with the
same result, where m is the maximum number of faulty nodes allowed.

 The primary(leader) node is changed during every view(pBFT consensus rounds) and can be substituted by a view
change protocol if a predefined quantity of time has passed without the leading node broadcasting a request to the
backups (secondary). If needed, a majority of the honest nodes can vote on the legitimacy of the current leading node
and replace it with the next leading node in line.
[Link]: Paxos is an algorithm that enables a distributed set of computers (for example, a cluster of distributed
database nodes) to achieve consensus over an asynchronous network. To achieve agreement, one or more of the computers
proposes a value to Paxos. Consensus is achieved when a majority of the computers running Paxos agrees on one of the
proposed values.

 In general terms, Paxos selects a single value from one or more of the values that are proposed, and then broadcasts
that value to all of the cooperating computers. Once the Paxos algorithm has run, all of the computers (or database
nodes)) agree upon the proposed value, and the cluster clocks forward.

Roles in PAXOS
PAXOS involves three distinct roles played by different nodes in the network:
1. Proposer: A node that initiates the consensus process by proposing a value. This value could be anything from a new data entry to
a configuration change.
2. Acceptor: A node that participates in the consensus process by responding to proposals from proposers. Acceptors play a crucial role in
validating proposals and ensuring agreement.
3. Learner (Optional): A node that observes the consensus process and eventually learns the decided value. This role is not always
explicitly defined in all variations of PAXOS. Learners can be any nodes in the system that need to be updated with the agreed-upon
value.
How Does the PAXOS Consensus Algorithm Work?
PAXOS is a complex algorithm with several variations. This explanation focuses on a basic version, highlighting the three key phases that
involve message exchanges between proposers and acceptors:
1. Prepare Phase
1. The proposer initiates the process by sending a "prepare" message with a unique proposal number to all acceptors.
2. This message inquires if the acceptors have previously accepted a value for the same round (identified by the proposal number).
3. The round number helps prevent conflicts arising from concurrent proposals. Imagine two proposers suggesting different values at
roughly the same time. The round number ensures that only proposals from the latest round are considered.
2. Promise Phase
If an acceptor has already accepted a value for the same round (perhaps from a previous proposal), it includes that value in its response. This
information is crucial for the proposer, as it helps identify any potential conflicts or ongoing consensus processes.
3. Accept Phase
1. Based on the promises received, the proposer broadcasts an "accept" message to all acceptors. This message contains the proposed
value and any previously accepted values learned from the promise phase. This allows all nodes to learn about the proposed value and
potential conflicts.
2. If a majority of acceptors respond with a promise indicating they haven't accepted a different value for the round, the proposer
considers the value accepted. This signifies that the proposed value has gained enough support to be considered the agreed-upon value.
Learning the Decided Value
1. Learners can passively observe the messages exchanged during the Accept phase to learn the decided value. By monitoring the
"Accept" messages, learners can identify the value being proposed by a majority and eventually converge on the agreed-upon value.
2. Alternatively, proposers can explicitly send "learn" messages to other nodes after a value is accepted. This approach actively informs
learners about the chosen value, ensuring faster synchronization.

[Link]: It’s designed to be easier to understand than previous algorithms like Paxos while providing strong fault
tolerance and leader election capabilities.
Core Concepts:
1. Nodes (Servers): In Raft, the network is composed of several nodes or servers.
2. Leader: One of the nodes in the Raft cluster is elected as the leader. The leader is responsible for managing
the replication of logs across the cluster.
3. Follower: All other nodes in the cluster are followers. They respond to requests from the leader and forward
client requests to the leader.
4. Candidate: When a leader fails, a new leader needs to be elected. Nodes transition to the candidate state
and initiate an election.
5. Term: Raft operates in terms, where each term begins with an election and ends with a new leader being
elected or re-elected.
6. Log Replication: Raft ensures that all logs across the cluster are replicated and maintained in the same
order.
Consensus and Leader Election:
The primary goal of Raft is to achieve consensus among nodes in the cluster regarding the state of the system.
Here’s how it works:
1. Leader Election:
 At the beginning of each term, nodes start as followers.
 If a follower doesn’t hear from the leader for a certain period (election timeout), it transitions to the candidate
state.
 The candidate requests votes from other nodes. If it receives votes from the majority, it becomes the leader.
 If no node receives a majority, a new election is started in the next term.
2. Log Replication and Consistency:
 The leader accepts client requests and appends them to its log.
 It then sends the log entry to followers, which replicate the log entry.
 Once a majority of followers acknowledge the entry, it’s committed to the log and applied to the state
machine.
We can definitely elaborate more on the Raft consensus algorithm and its components for a deeper understanding.
Here’s a more detailed explanation of the components and syncing process:
Consensus in Raft
Raft’s approach to consensus is crucial for ensuring the integrity and consistency of the distributed system.
Consensus is achieved through a series of steps:
[Link] Replication:
 When a client initiates an operation, such as setting a key-value pair, the leader node receives the request.
 The leader appends the operation to its log and broadcasts this log entry to all other nodes in the cluster,
including peer nodes.
 Each node in the cluster appends the log entry to its log.
2. Majority Agreement:
 Raft operates on the principle of majority agreement. Before committing an operation to its state
machine, the leader node waits for acknowledgments from most nodes.
 If most of the nodes (Say N/2 + 1) acknowledge the operation by replicating it in their logs, the leader
commits the operation to its state machine.
 This ensures that the operation is officially part of the system’s state and will be applied consistently
across all nodes.
 Additionally, the leader regularly sends updates to the other servers to keep them in sync. This ensures
that even if a server falls behind or crashes, it can quickly catch up with the latest state of the key-value
store.

2.3 Consensus without identity using a Bitcoin : Consensus without identity is a fundamental concept introduced by
Bitcoin to solve the problem of agreement in a decentralized network where participants are unknown and untrusted.
 In traditional systems, consensus depends on verified identities, but in open networks identities can be easily faked,
leading to issues like Sybil attacks where a single user creates multiple identities to gain control. Bitcoin overcomes
this by replacing identity with computational effort through a mechanism called Proof of Work (PoW).
 In this system, participants known as miners compete to solve complex cryptographic puzzles, and the first to solve
the puzzle gets the right to add a new block of transactions to the blockchain. Other nodes verify this block, and the
network accepts the chain that has the most accumulated work, commonly referred to as the longest chain.
 This ensures that consensus is achieved based on the amount of computational power invested rather than the number
of participants or their identities. Since generating computational power requires significant resources such as
electricity and hardware, it becomes extremely difficult and expensive for an attacker to manipulate the system, even
if they create many fake identities.
 Thus, Bitcoin establishes trust through mathematics, economic incentives, and distributed verification rather than
relying on central authorities or personal identities, making it a secure and decentralized solution for achieving
consensus in an open network.

2.4 Nakamoto consensus Incentives and proof of work:


 The Nakamoto Consensus is a protocol used in blockchain networks to achieve agreement on the state of the
blockchain without a central authority. It ensures that all participants in the network agree on a single version of the
blockchain, maintaining its integrity and avoiding problems like double-spending and 51% attacks. This consensus
mechanism is named after Satoshi Nakamoto, the pseudonymous creator of Bitcoin.

Key Components of the Nakamoto Consensus

 Proof of Work (PoW) : Proof of Work is a key element of the Nakamoto Consensus. It involves solving
complex mathematical problems to add new blocks to the blockchain. Miners use computational power to
solve these problems, and the first one to solve it gets to add the next block and receive a block reward.
 Block Difficulty : The difficulty of the mining mathematical problems adjusts automatically. This ensures
that new blocks are added at a steady rate, typically every 10 minutes for Bitcoin. If more miners join and
provide more computational power (hash rate), the difficulty increases to maintain the block creation rate.
 Block Rewards and Incentives : Miners are rewarded for their efforts with newly created bitcoins and
transaction fees. These incentives motivate miners to contribute their computational power to the network,
ensuring its continuous operation and security.
 Decentralization:The Nakamoto Consensus operates without a central authority. It relies on a
decentralized network of miners and nodes spread around the world. This decentralization is crucial for the
security and resilience of the blockchain.

How the Nakamoto Consensus Works


 Transaction broadcast: When a user wants to make a transaction, they broadcast it to the network. The
computer nodes in the network pick up this transaction and verify its validity.
 Transaction verification: Nodes check the transaction to ensure it follows the network's rules and that the
user has enough balance. Once verified, the transaction is ready to be included in a block.
 Inclusion in a block: Miners collect verified transactions and group them into a block. They then start
solving the Proof of Work problem associated with that block.
 Solving the Proof of Work: Miners compete to solve a mathematical problem (hashing). The first miner
to solve it broadcasts their solution to the network.
 Block addition: Other nodes verify the miner's solution. If it is correct, the new block is added to the
blockchain. This block becomes the latest entry in the chain, and miners begin working on the next block.
 Chain continuity: The blockchain grows over time, with each block linked to the previous one through
cryptography. This creates a secure and tamper-resistant chain of blocks.

Benefits of the Nakamoto Consensus

 Trustless environment: The Nakamoto Consensus allows participants to transact without trusting each
other or a central authority. The protocol ensures that only valid transactions are approved.
 Security: The combination of Proof of Work, difficulty adjustment, and decentralization makes the
network highly secure. It is resistant to attacks and data tampering.
 Transparency: The blockchain is a public ledger, making all transactions visible to anyone. This
transparency ensures the system's trustworthiness and allows anyone to verify transactions.
 Financial inclusion: Anyone with internet access can participate in the network, promoting financial
inclusion.

2.5 Incentives in Bitcoin:


 In Bitcoin, miners are incentivized primarily through two mechanisms: block rewards and transaction fees.
 When a miner successfully solves the Proof of Work puzzle and adds a new block to the blockchain, they receive a
block reward in the form of newly created bitcoins, which serves as the main incentive, especially in the early stages
of the network.
 In addition to this, miners also earn transaction fees paid by users whose transactions are included in the block,
providing a continuous source of income even as block rewards decrease over time due to halving events.
 These incentives encourage miners to invest computational power, validate transactions honestly, and secure the
network, as attempting to cheat would require significant resources and result in economic loss, making honest
participation the most profitable strategy.
2009-Jan-09: 50 BTC
2012-Nov-28: 25 BTC (1419 days - every 9.73 minutes < 10 minutes)
2016-Jul-09: 12.5 BTC (1319 days - every 9.04 minutes < 10 minutes)
2020-May-11: 6.25 BTC (1402 days - every 9.61 minutes < 10 minutes)
2024-??: 3.125 BTC

Key Components of Bitcoin Incentives


[Link] Rewards:
 Definition: Block rewards are the incentives miners receive for successfully adding a new block to the Bitcoin
blockchain. This reward consists of two parts: the block subsidy and transaction fees.
 Block Subsidy: This is a fixed amount of newly created bitcoins awarded to miners for mining a block. Initially set a
t 50 BTC, this amount halves approximately every four years in an event known as "halving." As of the latest
halving in 2024, the block reward is 3.125 BTC.
 Transaction Fees: In addition to the block subsidy, miners earn transaction fees from the transactions included in
the block. Users pay these fees to incentivize miners to prioritize their transactions, especially during periods of
high network congestion.
2. Economic Model:
 The Bitcoin network operates under a strict monetary policy, capping the total supply at 21 million coins. This
deflationary model creates scarcity, which can increase the value of Bitcoin over time.
 As block rewards decrease due to halving events, transaction fees are expected to play a more significant role in
miners' revenue, making it crucial for miners to optimize their operations and fee strategies.
3. Mining Process:
 Miners use computational power to solve complex cryptographic puzzles, validating transactions and creating new
blocks. This process is energy-intensive and requires significant investment in hardware and electricity.
 The competition among miners to solve these puzzles ensures the security and decentralization of the network, as it d
istributes the responsibility of transaction validation across a global community.
Conclusion
 Bitcoin incentives are essential for maintaining the network's security and functionality. By rewarding miners with
block subsidies and transaction fees, the Bitcoin ecosystem encourages participation and ensures the integrity of
transactions. Understanding these incentives is crucial for anyone involved in Bitcoin mining or investment,
especially in light of the ongoing changes in the network's economic structure.

2.6 Bitcoin transaction:


 Bitcoin transaction means sending bitcoin from one person to the other in the secured blockchain network. These are
messages that are digitally signed using cryptography and are verified by the miners that are present in the
blockchain network. The miner is the person who solves mathematical puzzles(also called proof of work) to validate
the transaction. Anyone with mining hardware and high processing power can take part in this.
 Numerous miners take part simultaneously to solve the complex mathematical puzzle, the one who solves it first,
wins 12.5 bitcoin as a reward. miner verifies the transactions(after solving the puzzle) and then adds the block to the
blockchain when confirmed.
 The transaction input is the bitcoin address from which the money was sent, and the transaction output is the bitcoin
address to which the money was sent. Generally, a bitcoin transaction takes 10 to 20 minutes to confirm any
transactions. if network congestion takes place, then time might take even 60 minutes.
Why Do Some Bitcoin Transaction Confirmations Take So Long?
Time is taken for transaction confirmation mainly depends on two factors:
 Transaction fees: As discussed above, if the user pays minimal transaction fees, then the time taken for
confirmation of a particular transaction would take a longer time. the mining process needs significant technology
and efforts, therefore the importance of transaction fees comes into play.
 Network load: Every transaction gets stored temporarily in the memory pool till the miners confirm it. When the
transaction activities reach a certain high threshold, the memory pool gets jammed thereby slowing the confirmation
time of the transaction even more. Due to this, all the subsequent transactions become susceptible to delay.
How Bitcoin Transaction Works?
Sending or exchanging bitcoins undergoes lots of procedures underneath. The bitcoin wallet and the network ensures that the
digital currency reaches the receiver properly. There are two basic terminologies related to this-
 Public key: Also known as a bitcoin address, these are publicly known to all like your username in social media
handles. In order to receive bitcoins, the user must share his public key with the other user.
 Private key: These are kept secret and must not be shared with anyone, similar to the user's password of social
media accounts. Private keys are the most important thing in the whole cryptocurrency concept. The private key
allows the user to have access to bitcoins, if the user forgets the private keys, there's no way to recover the bitcoins or
the private key. Therefore, it is advised to make a proper backup of the private key in a safe place.
 Transaction input is nothing but the address of the sender which gets registered in the network and remains in an
encrypted and inaccessible state. Transaction output is the receiver's address which is registered on the bitcoin
network.

How To Send Bitcoin


In order to send or receive bitcoins, one must possess a bitcoin wallet application.
 After installing the bitcoin wallet app, select the type of currency you want to send. For example ethereum, bitcoin,
etc.
 Write in the receiver's address.
 Type the amount of bitcoin you wish to send.
 Pay the required transaction fee.
 Press the "send bitcoin" button and the cryptocurrency will be transferred.
How to Receive Bitcoin?
In order to receive bitcoins, do the following steps:
 Open the wallet and click receive.
 Share the public key address. It can be a QR code or a combination of numbers and letters.
 Anyone with a public address can send the cryptocurrency.

2.7 Bitcoin Scripts


 The Bitcoin Script is a stack-based programming language that helps in creating more complex transactions that
involve specific conditions. Bitcoin scripts are small programs which define the conditions in which a specific
amount of Bitcoin tokens can be spent. You can send Bitcoin to someone with a locking script which describes how
the Bitcoin can be redeemed in future. The recipient must use an unlocking script corresponding to the locking script
for spending the received Bitcoin tokens.
 The Bitcoin script working mechanism is almost similar to the LIFO data structure. The validation of a Bitcoin script
transaction involves combining the locking script and unlocking script and executing them on a virtual machine. It is
important to remember that the locking script comes from the output of the previous transaction and the unlocking
script comes from the input of the current transaction.
Technical Details of How Bitcoin Script Works
The overview of the working mechanism of Bitcoin scripting only offers a simple way to understand the technology. You
should also learn about the technical aspects of Bitcoin script execution process to familiarize with how it works. The
following steps in the Bitcoin scripting process will shed more light on its significance in the crypto space.
[Link] Two Scripts
 The primary essence of the Bitcoin scripting language in blockchain is all about the two scripts that define Bitcoin
scripting. The locking script or the ScriptPubKey is a part of information from the output of previous transaction. It
provides the conditions that should be followed to spend the Bitcoins sent in the transaction.
 The unlocking script or the ScriptSig includes part of information from the input of the existing transaction. The
ScriptSig offers descriptions on the operations and data required to satisfy the requirements of ScriptPubKey. You
can notice that the locking script serves as a lock on the Bitcoin tokens sent in a transaction while the unlocking
script is the key to unlock the tokens.

2. Combining and Executing the Scripts


 The next crucial step in the working of Bitcoin Script is the concatenation process. The Bitcoin node verifying a
transaction will take the ScriptSig from the input and combine it with the ScriptPubKey of the output it wants to
spend. Execution of the combined script in a step-wise manner on the stack defines a crucial aspect in how Bitcoin
scripting works.
[Link] Elements and Opcodes
 The most important highlight in any Bitcoin scripting guide is about the utility of opcodes and data elements. Since
Bitcoin Script is a stack-based programming language, it relies on predefined commands, known as opcodes or
operation codes. The operation codes help in performing different actions on the data pushed on a stack. It is also
important to acknowledge the use of data elements like signatures, hashes, and public keys in Bitcoin scripting.

 The validity of a transaction depends on successful execution of the Bitcoin Script. You can confirm a successful
execution when the top item on the stack at the end of execution is a non-zero value. On the other hand, an error or a
‘FALSE’ result upon completing execution means that the transaction is invalid.

Script is a mini programming language used as a locking mechanism for outputs in bitcoin transactions.
 A locking script (ScriptPubKey) is placed on every transaction output.
 An unlocking script (ScriptSig or Witness) must be provided to unlock an output (i.e. when used as an input to a
transaction).
 If a full script (unlocking + locking) is valid, the output is "unlocked" and can be spent.
Example:
P2PKH (Pay-to-Public-Key-Hash): P2PKH is the most common type of Bitcoin transaction script.
It means:
“Pay to the hash of a public key”.
 Instead of sending Bitcoin directly to a public key, it is sent to a hashed version of the public key.
 Adds an extra layer of security and privacy.
Key Components
 Public Key
o Generated from private key.
 Public Key Hash
o Hash of the public key (used as address).
 Private Key
o Used to unlock/spend funds.
o Digital Signature Proves ownership.
Script:
Combining 2 scripts, first verify the public key vs. address of the signer, then check the signature using the public key of the
signer.
scriptSig: <sig> <pubKeyA>
scriptPubKey: OP_DUP OP_HASH160 <addressA> OP_EQUALVERIFY OP_CHECKSIG

OP_DUP OP_HASH160 <PubKeyHash> OP_EQUALVERIFY OP_CHECKSIG

 This script defines the conditions required to spend Bitcoin.

1.OP_DUP (Duplicate)
 Duplicates the top item on the stack.
 Why?
We need the public key twice:
o One copy for hashing
o One copy for signature verification
2. OP_HASH160
 Applies two hash functions:
o SHA-256
o Then RIPEMD-160
 Converts the public key into a public key hash.
Output: Hashed version of the public key
3. <PubKeyHash>
 This is the expected public key hash (from the Bitcoin address).
 Hardcoded in the locking script.
Acts like: “Only this specific address can spend the funds”
4. OP_EQUALVERIFY
 Compares:
o Hash from OP_HASH160
o Given <PubKeyHash>
 If equal → continue
 If not → transaction fails immediately
 Ensures correct public key is provided.
5. OP_CHECKSIG
 Verifies the digital signature using the public key.
 Checks:
o Signature is valid
o Matches the transaction data
Confirms ownership of private key.
How It Works Together (Flow)
When spending, the user provides:
 Signature
 Public key
Then:
1. OP_DUP → duplicate public key
2. OP_HASH160 → hash it
3. Compare with <PubKeyHash>
4. OP_EQUALVERIFY → must match
5. OP_CHECKSIG → verify signature

A P2PKH script execution is shown as follows:

2.8 Application of Bitcoin script


Key Applications of Bitcoin Scripts
 Multi-Signature Wallets:Multi-
signature (multisig) wallets require multiple private keys to authorize a transaction. This adds an extra layer of securi
ty, making it ideal for businesses and cryptocurrency exchanges. Common configurations include 2-of-2 and 2-of-
3 multisig wallets, where a transaction requires two out of two or two out of three authorized signatures.
 Escrow Services:Bitcoin scripts can facilitate escrow transactions, where funds are held by a third party until certain
conditions are met. This is particularly useful in peer-to
peer transactions, ensuring that both parties fulfill their obligations before the funds are released.
 Time-Locked Payments: Time-
locked transactions allow users to create conditions where funds can only be spent after a specified period or block h
eight. This feature is beneficial for decentralized finance (DeFi) applications, where funds need to be locked for a cer
tain duration before withdrawal.
 Pay-to-Script-Hash (P2SH):
P2SH addresses enable the creation of complex Bitcoin scripts without revealing the full script on the blockchain. Ins
tead, only a hash of the script is required, allowing for more intricate redeem conditions and the implementation of s
mart contracts.
 Custom Transaction Types:Developers can craft custom scripts tailored to specific use cases, allowing for greater f
lexibility and programmability in Bitcoin transactions. This includes creating scripts that enforce specific conditions
for spending funds, enhancing the overall utility of Bitcoin.

2.9 Bitcoin block:


Bitcoin uses a blockchain to implement its digital distributed transaction ledger. The following diagram illustrates the
structure of a block, and how the blocks are chained together using the header hash. The transactions in the body of the block
are chained together separately; and a binary hash kept in the block header in the form of Merkle Root. The chaining of
hashes ensure that the blockchain is immutability and append-only.

Each block has a 80-byte header that contains:


1) Version number (4-byte)
2) hash of the previous block header (32-byte)
3) Merkle root of all transactions in this block (32-byte)
4) Timestamp (4-byte)
5) Difficulty Target Hash nBits - for controlling the new block rate (4-byte) (to be explained later)
6) A random nonce (4-byte)
 A blockchain provides a distributed, immutable, public transaction ledger for Bitcoin.
 A blockchain is a chain of blocks. A block is a collection of transactions. Each block has a header and can contain a
few thousand transactions.
 A network of communicating nodes (called miners) running the bitcoin software maintains the blockchain
transaction ledger collectively and distributively - without a central authority.
 The blockchain protect against modification of previous transaction records by chaining up the hashes. Modifying
one block requires modification of all hashes in the subsequent blocks.
 The blockchain also protect against double spending via a Proof-of-Work Consensus Protocol (a form of voting to
reach a consensus in a decentralized environment - to be explained in detail later). Protecting against double
spending without a central authority is the main contribution of Satoshi's Bitcoin white paper.
Block
 Each block contains a hash of the previous block header. Any change to this block's content invalidates the hash of
all subsequent blocks in the chain. This ensures the immutability and append-only of the transaction ledger.
 To maintain the transaction ledger, new blocks need to be created to record new transactions.
 Satoshi sets a target is to create a new block (of new transactions) every 10 minutes. To encourage the nodes
(miners) to create new blocks, there are rewards for nodes - in terms of new coin and transaction fee. The nodes
compete to create new block to receive these rewards, which require computational efforts, called "proof-of-work"
(to be explained later).
 Each block is limited to 1MB in size, which can batch up a few thousand transactions.
 Transactions kept in the block are hashed, and the hashes are then paired, hashed, paired again, and hashed again
until a single hash remains, known as the merkle root of a merkle tree. Merkle tree supports the purging of spend
transactions (to be explained later). The Merkle tree (other than the root) needs not be kept in the block, as it can be
re-generated from the transactions stored when needed.

You might also like