Blockchain 2
Blockchain 2
Blockchain 2
*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.
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.
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.
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.