Introduction to Bitcoin
A digital currency is a form of money that exists purely in an
electronic form, Bitcoin is one such digital currency that relies
on a peer-to-peer (P2P) network to maintain its ledger. This
decentralized design enables bitcoin to address the
double-spending problem of digital currencies,
without requiring a financial institution as an intermediary.
Bitcoin transactions are basically string entries recorded into
blocks, which are then linked together to form the
blockchain. Imagine transactions as entries in
the ledger page, block as the page and block chain as the ledger
book. Multiple copies of this blockchain are maintained across the
network, providing security and redundancy.
Basic Bitcoin Concepts
-
Blockchain – A public digital ledger recording transactions.
-
Satoshi – The smallest unit of bitcoin (1 Bitcoin = 100,000,000
Satoshis’).
-
UTXO (Unspent Transaction Output) – Represents the remaining
balance from a transaction.
-
Mempool – A memory location were all the unverified transactions
are stored.
-
PoW – Proof of Work – Backbone of Bitcoin design ensuring
fairness using gaming theory.
Bitcoin Design Assumptions
Bitcoin's security is built on the assumption that at least 51% of
nodes in the network remain honest, preventing fraudulent
modifications to the blockchain. The credibility of Bitcoin
incentivizes participants to act honestly, as trust in the network
directly affects Bitcoin’s value.
Bitcoin Transaction Process
Transaction Flow
-
A user initiates a Bitcoin transaction, which updates the
blockchain ledger.
-
The sender’s private key is used to authorize the transaction by
signing the UTXOs.
-
The receiver’s public key hash is used as the destination
address.
-
The transaction is broadcasted to the network and enters the
Mempool.
-
Miners validate the transaction, include it in a block, and add
the block to the blockchain.
Transaction Components
Each Bitcoin transaction contains specific fields:
-
Version: Specifies the transaction format.
-
Inputs: References previous UTXOs, including:
TXID: Transaction ID of the previous transaction, this is how
transactions are linked to one another across blocks, forming a
trail of transfer of ownership of bitcoin from the point it was
mined.
Output Index: Position of the UTXO in the previous transaction,
this is required as a single transaction can have more than one
output.
ScriptSig: Contains the sender’s digital signature and public key,
this enables the miners to validate the transaction. They use to
the public key on the transaction fields and compare it with the
digital signature to validate the sender’s ability to initiate the
transaction.
Sequence: Used for time-locked transactions or Replace-By-Fee
(RBF).
-
Outputs: Specifies new UTXOs created,
including:
Value: Amount of Bitcoin being sent.
ScriptPubKey: Locking script containing the recipient’s address.
Locktime: Specifies the earliest time a
transaction can be included in a block.
{
"txid": "42e1436a6ec1a65c783a3b02eafa352302f4415c14602f26daa4f8181a02eccc",
"size": 194,
"version": 2,
"locktime": 0,
"fee": 5000,
"inputs": [
{
"coinbase": false,
"txid": "f29a6c29de88ec043eddef6d65f7e7ef6e778f2d90741b2e018a6e69caceedb9",
"output": 69,
"sigscript": "",
"sequence": 4294967293,
"pkscript": "0014f8c6f40fccbfabfd6ae8f19c25d28ec889c2fda5",
"value": 21747,
"address": "bc1qlrr0gr7vh74l66hg7xwzt55wezyu9ld9whrksw",
"witness": [
"30440220406af6acbfba91e82fa34c40e1d4e58fd0aed4e83be41c4bc16694728e073e55022045624e44867b6b77c9b70456085b3e6ecf4ba171f2d6c92ef2087b78cf00a6ff01",
"03b8fc5c116bd5a1ae4135c45c8e19749d5fd9134e5bbafa8bed67ba44aeaf05c4"
]
}
],
"outputs": [
{
"address": "1Ny9toPUCkeidGzHBSjq1NJ9GzwS1UWybB",
"pkscript": "76a914f0f95be137ece93262b4e24ee1313748300226dd88ac",
"value": 16747,
"spent": false,
"spender": null
}
],
"block": {
"height": 884415,
"position": 2
},
"deleted": false,
"time": 1739938867,
"rbf": false,
"weight": 449
}
*Above transaction is in JSON format for readability, Bitcoin uses
Serialized binary in Hex format.*
UTXO Selection Algorithms in Wallets
Bitcoin wallets use different coin selection algorithms to choose
UTXOs efficiently
-
Largest First: Uses the largest UTXO first, reducing future
transaction sizes.
-
Smallest First: Uses the smallest UTXOs first, avoiding dust
buildup.
-
Best Fit (Least Change): Selects UTXOs that minimize leftover
change.
-
Knapsack Solver: Optimizes selection to match transaction value.
Transaction Verification
Submitted Transactions are verified by full nodes, after which
they are included into the Mempool.
Verification involves checking if the sender has sufficient
balance in terms of UTXO, if the digital signature provided is
valid (Public key of the sender is used), transaction doesn’t
result in double-spending.
Miners select verified transactions, prioritizing those with
higher fees per byte instead of higher value, as there is a 1 MB
block size limitation. Miners try to fit in as many transactions
as possible in 1MB that would generate the highest amount of
transaction fee per block.
Miners compete to find a valid hash by adjusting the nonce meeting
the difficulty requirement. (Proof-of-Work)
The first miner to solve the Proof-of-Work (PoW) puzzle adds the
block to the blockchain.
The miner is rewarded with new Bitcoins (block reward) and
transaction fees of all transactions included in the block.
If two miners create blocks simultaneously, the longest chain is
chosen.
This process of adding a new block to the block chain is known as
mining as it results in new bitcoins.
Proof of Work (PoW) Mechanism
-
PoW ensures decentralization and fair competition among miners,
also PoW is an NP problem based on computational science making
it easy to verify the hash but difficult to solve for a hash.
-
Bitcoin software adjusts the difficulty after every 2016 blocks
(~2 weeks) based on the hash rate availability i.e. how quickly
or slowly these 2016 blocks were mined.
-
After picking up validated transactions from the Mempool, Miners
must find a hash value below a set difficulty target for the
block header. This is done by tweaking nonce, timestamps,
Coinbase transaction details and sometimes even the selected
transaction list itself.
-
Block reward halves every ~4 years, ensuring a total supply cap
of 21 million BTC after which the incentive for adding blocks
would just be the Transaction fees.
-
Nonce is a 32-bit number (4.3 billion+ possible values) used to
tweak the hash output. Since multiple nonce values can be valid
at any difficulty level, miners iterate through different values
to find a valid hash. This iterative process ensures fair
competition and prevents attackers from rewriting blocks too
quickly.
Bitcoin Trivia
- Genesis block – The first block in Bitcoin’s blockchain.
-
Pizza day – First real world bitcoin transaction happened when a
programmer paid 10000 bitcoins for two pizza’s worth 41$ on
22-May-2010, this day is celebrated as the Bitcoin Pizza day
every year.
-
Transaction confirmation depth – Number of blocks added after
the transaction has been verified to the block chain. 6
confirmations is the standard for large transactions, this is
known as the Gold standard. 12-24 confirmations is generally
used for Institutional transfers and cold storage providers and
exchanges like Coinbase look for 100+ confirmations.
Attacks and Network Stability
-
Transaction Starvation Attack - Malicious actors spam
transactions with high fees to delay low-fee transactions
discouraging wide spread use of bitcoin. Circular transactions
could be used for this purpose by corporates or governments that
would like to discourage use of anonymous and independent
financial systems like the Bitcoin.
-
The 51% Attack and Security – Malicious actors try to modify
confirmed blocks by creating a longer block chain than the
honest miner’s chain by achieving 50%+ of the available hash
rate. As bitcoin nodes follow the longest chain rule whenever a
fork happens, the altered attackers block chain becomes the
legitimate one. This would result in double spending and
blocking of other transactions from being confirmed destroying
the trust in Bitcoin system. Though theoretically possible, it
is highly impractical for the following reasons
High computational costs make it economically irrational. The
attacker has a short window of opportunity to alter multiple
blocks and also solve the Proof of work considering an average
block generation time of 10 mins.
A successful attack reduces trust in Bitcoin, devaluing the
attacker’s own holdings thus discouraging malicious intent.
Honest miners have strong incentives to control majority of the
total hash rate available through fair competition resulting in
block and transaction fee rewards.
Mining feasibility
Considering the huge computational requirement for mining, for
most users, the only remotely feasible way of successfully mining
using personal computers, is by using random values and not by
brute forcing all possible values. Users can run process daemons
randomly varying few possible values of the nonce and other block
variables during the short interval available before a new block
gets added to the block chain. Normal users can never compete with
the mining pools that use dedicated hardware in an iterative way.
Users can try their luck by running a full node on a normal
machine, periodically fetching the Mempool transactions, trying
out few random values and directly submitting to the network if
ever a valid hash is generated within small window of opportunity.
As on 25-02-2025 the size of a full node is about 640 GB and is
increasing about 16% per year.
The other way to involve in mining is by investing into ASIC
miners like Ant miner S19 XP which consume about 3.2 kW of
electricity. In India, Himachal Pradesh seems to be a relatively
suitable location for mining rigs due to its cold climate, low
electricity costs and fair internet availability. One might be
able to generate about 30,000/- rupees per month by joining a
mining pool.
Final Thoughts
Bitcoin is a fusion of cryptography, economics, and
decentralization, ensuring security and transparency in financial
transactions. Its limited supply, strong security model, and
decentralized nature make it a revolutionary financial system that
brings control back to the people.
In the short term Bitcoin seems to be a promising alternative to
the existing financial system but as every Technology, it too has
to adapt to the emerging challenges to maintain its relevance in
the long term.
One of the challenges it would face is the impact of quantum
computing on cryptography which is a key component of the overall
Bitcoin design. Bitcoin may adapt to this challenge by
implementing Quantum-resistant cryptography but it would again
have to deal with tradeoff related to decentralization as quantum
computers might be out of reach for normal users.
Another challenge is its ability to keep miners interested even
after all the bitcoins have been mined using just the
transactional fee as an incentive. Without the block rewards,
Bitcoin may end up as a settlement layer instead of a popular
transactional network or it could even end up like Gold as a
storage currency.
Bitcoin's long-term success will depend on its ability to evolve
through solutions like regional network layers and Lightning
Network offloading, preserving its core principles while adapting
to technological advancements.
Reference
https://bitcoin.org/bitcoin.pdf