Blockchain 2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Unit-II Bitcoin and Blockchain

*Bitcoin:
Bitcoin is a cryptocurrency, a virtual currency designed to act as money and a form of
payment outside the control of any one person, group, or entity, and thus removing the need
for third-party involvement in financial transactions.
It is rewarded to blockchain miners for the work done to verify transactions and can be
purchased on several exchanges.

*Creation of Bitcoin:
New bitcoins are generated by a competitive and decentralized process called "mining". This
process involves that individuals are rewarded by the network for their services. Bitcoin
miners are processing transactions and securing the network using specialized hardware and
are collecting new bitcoins in exchange.
The Bitcoin protocol is designed in such a way that new bitcoins are created at a fixed rate.
This makes Bitcoin mining a very competitive business.
When more miners join the network, it becomes increasingly difficult to make a profit and
miners must seek efficiency to cut their operating costs.
No central authority or developer has any power to control or manipulate the system to
increase their profits.
Every Bitcoin node in the world will reject anything that does not comply with the rules it
expects the system to follow.
Bitcoins are created at a decreasing and predictable rate.
The number of new bitcoins created each year is automatically halved over time until bitcoin
issuance halts completely with a total of 21 million bitcoins in existence.
At this point, Bitcoin miners will probably be supported exclusively by numerous small
transaction fees.

*Payment in Bitcoin:
Bitcoin was initially designed and released as a peer-to-peer payment method.
However, its use cases are growing due to its increasing value and competition from other
blockchains and cryptocurrencies.
To use your Bitcoin, you need to have a cryptocurrency wallet.
Wallets hold the private keys to the bitcoin you own, which need to be entered when you're
conducting a transaction.
Bitcoin is accepted as a means of payment for goods and services at many merchants,
retailers, and stores.
Brick-and-mortar stores that accept cryptocurrencies will generally display a sign that says
“Bitcoin Accepted Here”; the transactions can be handled with the requisite hardware
terminal or wallet address through QR codes and touchscreen apps.
An online business can easily accept Bitcoin by adding this payment option to its other
online payment options: credit cards, PayPal, etc.

*Bitcoin Script:
• Script was implemented by Satoshi Nakamoto in the release of Bitcoin Core version
0.1.
• Bitcoin script is a simple programming language.
• Bitcoin Script is essentially a set of programmed instructions that are recorded with
every transaction made.
• These instructions describe how users can access and make use of the bitcoins
available on the network.
• This is based on a series of linear structures, known as stack, which contain existing
data in order LIFO (Last In - Firt Out). Each instruction in this language is executed
one after the other consecutively.
• Bitcoin Script uses a data structure that can be thought of as a linear structure
represented by a physical stack or pile.
• Items at the top of the stack can be added (pushed) or removed (popped) in a “Last In,
First Out (LIFO)” queue.
• Imagine stacking three books: Book A (top), Book B (middle), and Book C (bottom).
• With Bitcoin Script, Book A would need to be the first taken out of the stack
(popped), followed by Book B and Book C, to put anything at the bottom of the stack
(pushed).
• The same concept is applied virtually to operations in a sequence with Script.
• This language is not Full Turing because its functionality is limited and cannot loops
Following operations are used in bitcoin script:
• OP_ADD: Pops two items off the stack, adds them together, and pushes the result
back onto the stack.
• OP_EQUAL: Pops two items from the stack and compares them to check if they are
equal. if they are equal, then it pushes the result TRUE back onto the stack.
• OP_RETURN: Can be used to store up to 80 bytes of arbitrary data on the Bitcoin
blockchain and also to mark a transaction output as invalid.
• OP_CHECKSIG: Verifies that the signature for a transaction input is valid.
• OP_CHECKMULTISIG: Commonly used in Pay To Script Hash
(P2SH) transactions. OP_CHECKMULTISIG looks at 3 public keys and 2
signatures in the stack and compares them one-by-one. Funds become spendable only
when the order of the signatures matches the order in which the public keys were
provided.
The Bitcoin script language has several characteristics and qualities, among which we can
mention:
1. It is simple and requires minimal processing.
2. Its functionality is limited, which provides greater security to the system.
3. Being a Turing Incomplete language it does not have loops, so it is ensured that the
program stops repeating and ends. Thus, the possibility of errors and malicious codes
to the Bitcoin network is avoided.
4. Its simplicity allows it to be implemented on a wide range of devices.
5. There is no state before or after the script execution. All the information necessary to
run the script must be contained in it.
6. It is based on a stack and can use two types. One main and one alternative. Where the
latter is used for the storage of intermediate step calculation data. In much the same
way as the memory key on calculators.
7. Bitcoin's scripting language is quite small. It can only contain 256 instructions, since
each instruction is expressed in one byte.

Types of Bitcoin script: Script is divided into two types of scripts


1.scriptSig
2.scriptPubKey
1. scriptSig:The scriptSig is the unlock script, which requires a public key and a
digital signature.
2. scriptPubKey:The scriptPubKey, is the blocking script, which contains a public
key hash, also called a Bitcoin address
Unlocking and Locking Scripts:A script in the Bitcoin transaction unlocks the input by
verifying their digital signatures. A locking script sets the conditions for how the outputs can
be spent example:

Example :
Example of bitcoin script

*Transaction in Bitcoin:
• A Bitcoin transaction is a transfer of bitcoin from one address to another. The valid
transaction must be signed by the sender.
• Bitcoin does not have accounts. Instead, pieces of Bitcoin of arbitrary size are all
associated with an address, which is controlled by the owner of that bitcoin. These
pieces of Bitcoin are called Unspent Transaction Outputs (UTXOs).
• All Bitcoin transactions are published to the mempool, where they are considered
'pending'. When a miner adds a transaction to a block, it is then considered
confirmed.
• A transaction is a transfer of Bitcoin value on the blockchain.
• In very simple terms, a transaction is when participant A gives a designated amount of
Bitcoin they own to participant B.
• Transactions are created through mobile, desktop or hardware wallets.
• For Bitcoin users, sending a transaction is as simple as entering an amount and an
address in their wallet and pressing send. They don’t have to worry about the
technicalities of how it works.
• Bitcoin makes use of public-key cryptography to ensure the integrity of transactions
created on the network.
• In order to transfer bitcoin, each participant has pairs of public keys and private
keys that control pieces of bitcoin they own.
• A public key is a series of letters and numbers that a user must share in order to
receive funds.
• A private key must be kept secret as it authorizes the spending of any funds received
by the associated public key.
• Using the private key associated with their bitcoin, a user can sign transactions and
thereby transfer the value to a new owner.
• The transaction is then broadcast to the network to be included in the blockchain.
• Anyone who possesses your private keys has access to your bitcoin.
Bitcoin transaction has three main parts:
1. Inputs. The bitcoin address that contains the bitcoin Alice wants to send. To be more
accurate, it is the address from which Alice had previously received bitcoin to and is
now wanting to spend.
2. Outputs. Bob’s public key or bitcoin address.
3. Amounts. The amount of bitcoin Alice wants to send.
• A transaction can contain multiple inputs and outputs. As long as each output has an
associated amount and the input amounts total more than the output amounts, the
transaction is valid.
Example Of Bitcoin Transaction: Consider the following example
• Alice to send the .05 bitcoin to Bob, she signs a message with the transaction details
using her private key. The message contains the input, output, and amount as
described above. The transaction is then broadcast to the rest of the Bitcoin network
where nodes verify that Alice’s private key is able to access the inputs (by checking
that Alice’s private key matches the public key she is claiming to own).
• Once a transaction is broadcasted to a node, this node then passes it along the network
until it reaches a mining node. Miners will then order this transaction into what is
called a block template. This is a blueprint for the block which the miner is attempting
to add to the blockchain. If a miner finds the next block in the chain, then this block
template is mined and becomes an immutable block on the blockchain. Finally, this
block is broadcasted to the network’s nodes who will include it in their copy of the
chain.

*Bitcoin P2P Network:


• Peer to peer network, commonly known as P2P is a decentralized network.
• communications model that consists of a group of devices (nodes) that collectively
store and share files where each node acts as an individual peer.
• In this network, P2P communication is done without any central administration or
server, which means all nodes have equal power and perform the same tasks.
• P2P is a technology that is based on a very simple principle, and that is the concept of
decentralization.
• The peer-to-peer architecture of blockchain allows all cryptocurrencies to be
transferred worldwide, without the need of any middle-man or intermediaries or
central server.
• With the distributed peer-to-peer network, anyone who wishes to participate in the
process of verifying and validating blocks can set up a Bitcoin node.
• Blockchain is a decentralized ledger tracking of one or more digital assets on a peer-
to-peer network.
• When we say a peer-to-peer network, it means a decentralized peer-to-peer network
where all the computers are connected in some way, and where each maintains a
complete copy of the ledger and compares it to other devices to ensure the data is
accurate.
• This is unlike a bank, where transactions are stored privately and are managed only by
the bank.
Advantages of P2P Network:
• As blockchain is a decentralized system of peer to peer network, it is highly available due
to decentralization.
• Because of P2P networking capability, even if one peer gets down, the other peers are still
present. Thus nobody can take down the blockchain.
• P2P networks offer greater security compared to traditional client-server systems.
• When you are using cloud computing to store your data, you need to trust AWS and
Google drives, but with the blockchain, because it utilizes peer to peer network you don’t
need to trust any third parties which can modify your crucial data. These are non-resistant
to censorship by central authorities.
Disadvantages of P2P Network:
P2P network in blockchain, however, raises few concerns. As in blockchain, instead of a central
server, distributed ledgers must be updated on every single node, adding transactions requires a
considerable amount of computational power.

*Distributed Consensus in Bitcoin:


Blockchain is the backbone technology of digital cryptocurrency Bitcoin that allows digital
information to be decentralized and distributed. It provides immutability, privacy, security,
and transparency. In Blockchain no central authority is present to validate and verify the
transactions.To validate and verify a transaction distributed consensus algorithm is used.
Consensus Algorithm: A consensus algorithm is an algorithm or we can say a procedure
through which all the peers of the Blockchain network reach a common agreement about the
present state of the distributed ledger. In this way, consensus algorithms help to achieve
reliability in the Blockchain network and establish trust between unknown peers in a
distributed computing environment. It makes sure that every new block that is added to the
Blockchain is the one and only version of the truth that is agreed upon by all the nodes in the
Blockchain.
There are different types of consensus algorithm which are as follows:
1.Proof of Work.
2.Proof of Stake.
3.Proof of Burn.
4.Proff of Elapsed time

1.Proof of Work (PoW):


• Bitcoin uses a PoW consensus algorithm.
• Proof of work is a blockchain consensus mechanism in which computing power is
used to verify cryptocurrency transaction and add them to the blockchain.
• This algorithm is used to select a miner for the next block generation.
• The idea behind this algorithm is to solve a complex mathematical puzzle that
requires a lot of computational power and easily gives out a solution.
• Thus, the node that solves the mathematical puzzle as soon as possible gets to mine
the next block.
• The concept was invented by Moni Naor and Cynthia Dwork in 1993.
• Proof of work (PoW) is a decentralized consensus mechanism that requires members
of a network to expend effort solving an arbitrary mathematical puzzle to prevent
anybody from gaming the system.
• Proof of work is used widely in cryptocurrency mining, for validating transactions
and mining new tokens.
• Due to proof of work, Bitcoin and other cryptocurrency transactions can be
processed peer-to-peer in a secure manner without the need for a trusted third party.
• To add each block to chain, miners must compete to solve difficult puzzles using
their computer process power
• A reward is given to first miner to solve cryptographic puzzle of each block.
Disadvantages:
• It requires more energy and electricity power.
• It requires more computational power.
• It requires special hardware which is too expensive.

2.Proof of Stake:
• Proof of Stake (PoS) is a type of algorithm which aims to achieve distributed
consensus in a Blockchain.
• This way to achieve consensus was first suggested by Quantum Mechanic and later
Sunny King and his peer wrote a paper on it.
• This led to Proof-of-Stake (PoS) based Peercoin.
• A stake is value/money we bet on a certain outcome. The process is called staking.
• As understandable from the name, nodes on a network stake an amount
of cryptocurrency to become candidates to validate the new block and earn the fee
from it.
• Then, an algorithm chooses from the pool of candidates the node which will validate
the new block.
• This selection algorithm combines the quantity of stake (amount of cryptocurrency)
with other factors (like coin-age based selection, randomization process) to make
the selection fair to everyone on the network.
Proof of Stake(PoS) Mechanism:
1. Nodes make transactions.The PoS algorithm puts all these transactions in a pool.
2. All the nodes contending to become validator for the next block raise a stake. This stake
is combined with other factors like ‘coin-age’ or ‘randomized block selection’ to select
the validator.
3. The validator verifies all the transactions and publishes the block. His stake still remains
locked and the forging reward is also not granted yet. This is so that the nodes on the
network can ‘OK’ the new block.
4. If the block is ‘OK’-ed, the validator gets the stake back and the reward too. If the
algorithm is using a coin-age based mechanism to select validators, the validator for the
current block’s has its coin-age reset to 0. This puts him in a low-priority for the next
validator election.
5. If the block is not verified by other nodes on the network, the validator loses its stake
and is marked as ‘bad’ by the algorithm. The process again starts from step 1 to forge
the new block.
Advantages of PoS:
• Energy-efficient:
As all the nodes are not competing against each other to attach a new block to the
blockchain, energy is saved.
• Decentralization:
In the case of a Proof-of-Stake based system(like Peercoin), rewards are
proportional(linear) to the amount of stake. So, it provides absolutely no extra edge to
join a mining pool; thus promoting decentralization.
• Security:
A person attempting to attack a network will have to own 51% of the stakes(pretty
expensive). This leads to a secure network.
Weakness of a PoS:
• Large stake validators:
If a group of validator candidates combine and own a significant share of total
cryptocurrency, they will have more chances of becoming validators. Increased chances
lead to increased selections, which lead to more and more forging reward earning, which
lead to owning a huge currency share. This can cause the network to become centralized
over time.
• New technology:
PoS is still relatively new. Research is ongoing to find flaws, fix them and making it
viable for a live network with actual currency transactions.

3.Proof of Burn: With PoB, instead of investing in expensive hardware equipment, the
validators follow the following approach:
• They burn coins by sending them to an address from where they are irretrievable.
• By committing the coins to an unreachable address, validators earn a privilege to
mine on the system based on a random selection process.
• Thus, burning coins means that validators have a long-term commitment in
exchange for their short-term loss.
• Depending on how the PoB is implemented, miners may burn the native currency of
the Blockchain application or the currency of an alternative chain, such as bitcoin.
• The more coins validators burn, the better are their chances of being selected to
mine the next block.
Why Proof of Burn Required?
There were some drawbacks in the PoW consensus algorithm which made researchers work
towards a new consensus algorithm i.e PoB.
• The first drawback is that the power consumption of PoW is very high. Miners are
awarded by upgrading the ledger under a POW model. Computational power is
employed to solve a math problem in exchange for remuneration. Greater the money a
miner spends to solve the problem, the greater the chances that they will be allowed to
mine blocks.
• PoW requires very high capital investments.
How PoB Works?
1. As the name itself suggests, there is something which should be burned. Here as we are
talking in the context of virtual currency so it’s obvious that in PoB virtual currency is
burned. The more the currencies are burned by miners the more they have the power to
create blocks.
2. By burning we don’t exactly mean burning. It means not using that coin. This may be
done if it is sent to somewhere where it can’t be spent. So miners send these coins to
such addresses from where they can’t be used. It is sent to a public verifiable address
where it cannot be accessed and thus can not be used.
3. When the coin is burnt its availability decreases leading to a potential increase in the
value of the coin.
4. Now the question is why do we need to burn the coin? The basic explanation for this is
that by destroying the currency, the consumer is displaying a big commitment to the
currency by foregoing a narrow profit in exchange for a long-term profit.
5. To avoid any undue advantages for early adopters, the PoB has devised a method that
allows for the periodic burning of crypto coins in order to maintain mining capacity.
Any time a fresh block is mined, the energy of burned coins decreases slightly.
6. It is a deflationary idea in which the quantity of currencies reduces over time, increasing
deficiency and, as a result, the currency holders’ value. Coins that grow their quantity
over time, on the other hand, tend to lose value.
Advantages of PoB:
• It required very little power compared to PoW.
• It reduces energy consumption by wasting insignificant resources when coins are
burned.
• It encourages long-term involvement in a project as a consumer is displaying a big
commitment to the currency by foregoing a narrow profit in exchange for a long-term
profit.
• The coin distribution is more fair compared to all other consensuses.
Disadvantages Of PoB:
• It is risky because one doesn’t know that will they gain the wealth they have burnt in the
future or not.
• As coins are burnt, so technically if we see then resources are wasted.
• It may suffer from rich getting richer phenomena. In which those who are wealthy are
getting wealthier by having more coins.
4.Proff of elapsed time(POET):
Proof of elapsed time (PoET) is a blockchain network consensus mechanism that prevents
high resource utilization and energy consumption; it keeps the process more efficient by
following a fair lottery system.

• Proof of elapsed time (PoET) is a consensus algorithm developed by Intel


Corporation that enables permissioned blockchain networks to determine who creates
the next block.
• PoET follows a lottery system that spreads the chances of winning equally across
network participants, giving every node the same chance.
• The PoET algorithm generates a random wait time for each node in the blockchain
network; each node must sleep for that duration.
• The node with the shortest wait time will wake up first and win the block, thus being
allowed to commit a new block to the blockchain.
• The PoET workflow is similar to Bitcoin's proof of work (PoW) but consumes less
power because it allows a node to sleep and switch to other tasks for the specified
time, thereby increasing network energy efficiency.
How Does PoET Work?
Based on the principle of a fair lottery system where every node is equally likely to be
chosen, the PoET mechanism spreads the chances of winning across the largest possible
number of network participants.

Under PoET, each participating node in the network must wait for a randomly chosen
period; the first to complete the designated waiting time wins the new block. Each node in
the blockchain network generates a random wait time and sleeps for that specified duration.

The one to wake up first—that is, the one with the shortest wait time—wakes up and
commits a new block to the blockchain, broadcasting the necessary information to the whole
peer network. The same process then repeats for the discovery of the next block.

5.Mining Pool: A mining pool is a joint group of cryptocurrency miners who combine their
computational resources over a network to strengthen the probability of finding a block or
otherwise successfully mining for cryptocurrency.
• Cryptocurrency mining pools are groups of miners who share their computational
resources.
• Mining pools utilize these combined resources to strengthen the probability of
finding a block or otherwise successfully mining for cryptocurrency.
• If the mining pool is successful and receives a reward, that reward is divided among
participants in the pool.
How a Mining Pool Works:
Individually, participants in a mining pool contribute their processing power toward the
effort of finding a block. If the pool is successful in these efforts, they receive a reward,
typically in the form of the associated cryptocurrency.
Rewards are usually divided between the individuals who contributed, according to the
proportion of each individual's processing power or work relative to the whole group. In
some cases, individual miners must show proof of work in order to receive their rewards.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy