Professional Documents
Culture Documents
Ain's Thesis Writeup
Ain's Thesis Writeup
By
Ain Ul Zia
275309
Supervisor
Dr. Syed Taha Ali
Department of Electrical Engineering
In
School of Electrical Engineering and Computer Science,
National University of Sciences and Technology (NUST),
Islamabad, Pakistan.
(August 2021)
Abstract
ii
Acknowledgment
v
Table of Contents
List of Figures ix
1 Introduction 1
1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Problem Definition . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Objectives and Research Goals . . . . . . . . . . . . . . . . . 2
1.4 Thesis Organization . . . . . . . . . . . . . . . . . . . . . . . . 3
2 Background 5
2.1 A Brief Overview of Blockchain . . . . . . . . . . . . . . . . . 5
2.1.1 Blockchain Network Characteristics . . . . . . . . . . . 6
2.1.2 Blockchain Applications . . . . . . . . . . . . . . . . . 6
2.2 Bitcoin Cryptocurrency . . . . . . . . . . . . . . . . . . . . . . 6
2.2.1 Centralized and Decentralized System . . . . . . . . . . 7
2.2.2 The Bitcoin system in contrast to our current system . 8
2.3 What is the operation of a Bitcoin? . . . . . . . . . . . . . . . 9
2.3.1 Transactions . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3.2 Bitcoin Block . . . . . . . . . . . . . . . . . . . . . . . 10
2.3.3 Hashing . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3.4 Mining . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
vi
TABLE OF CONTENTS vii
3 Literature Review 19
3.1 Mempool Specifications . . . . . . . . . . . . . . . . . . . . . . 23
3.2 Importance of Mining Pools in Bitcoin . . . . . . . . . . . . . 24
3.3 Mining hardware . . . . . . . . . . . . . . . . . . . . . . . . . 26
ix
LIST OF FIGURES x
5.12 The graph depicts the difference in fees between Delta, Greedy,
and Greedy+Advice for all three algorithms from December
04 to December 08, 2020. . . . . . . . . . . . . . . . . . . . . . 52
List of Tables
xii
Chapter 1
Introduction
This chapter of the offered thesis introduces the research issue and discusses
the primary motivation for conducting research on block packing structures.
It elaborates on the thesis’s problem statement, main objectives, and re-
search goals. The chapter closes by explaining the chapter’s organisation
and providing a brief synopsis of each chapter’s contents.
1.1 Motivation
With a market capitalization of $68 billion as of January 2019, the Bit-
coin network has garnered considerable attention from both industry and
academia. Mining pools, the network’s primary component, control the
majority of computing resources and are critical for network security and
performance. While numerous metrics of the Bitcoin network exist, little
is known about the specific behaviour of mining pools (e.g., empty blocks,
mining revenue, transaction gathering, or block packing tactics) and their
impact on Bitcoin end users [44].This void must be filled by conducting a
comprehensive analysis of mining pools and their behaviour. A miner’s goal
1
CHAPTER 1. INTRODUCTION 2
is to identify transactions with the highest total fee. The transactions vol-
ume in the Mempool is an exponential rise due to the volatile nature of and
changing behaviour of the cryptocurrency market. Meanwhile, the number
of transactions for active cryptocurrencies such as Bitcoin has been steadily
increasing over time. As a result, it’s critical to have an efficient system that
chooses transactions in a timely manner while providing the most total block
fees without breaching Bitcoin’s rules and regulations [19].
• To learn more about various mining strategies and evaluate the be-
havioural patterns that influence the generating block.
Background
5
CHAPTER 2. BACKGROUND 6
These days, we use fiat currencies that are centralised. If two parties wish
to transfer money, they must go through a third party who initiates and
verifies the transaction. If user A wishes to send money to user B, user A
initiates the procedure, then a third party (in this case, a bank) receives the
notification, verifies the data, and confirms the transaction. After approval,
the money goes to user B. This requires a lot of time and money from the
bank.
each user has access to each transaction. Users verify transactions as well
as approve them if they are valid. If the public ledger of the transaction is
approved by all users on the network, the sum is transferred from user A to
user B. Compared to centralised systems, this takes less time and has lower
transaction fees.
2.3.1 Transactions
Coins are commonly used in the Bitcoin system. These virtual coins do not
exist in reality; rather, they are transactions with some ownership rights.
(2016, Tschorsch and Scheuermann) A transaction is a digitally signed state-
ment or declaration between two parties that is predicated on the exchange
of bitcoins. (Narayanan and colleagues, 2016). When we talk about a wallet
CHAPTER 2. BACKGROUND 10
in real life, we are referring to a physical item that can be touched. Similarly,
the coins we use are real objects that can be used in a variety of ways. A
Bitcoin does not function in the same way that a wallet does. We never
physically hold a bitcoin; instead, we have rights to it. In the case of a bit-
coin, the rights are transferred from one holder to another in the same way
as coins are transferred from person to person. These rights are referred to
as transactions.
Unspent bitcoins are transferred from one user’s address to another. Ev-
ery bitcoin owner has two keys, a private and a public. The private key is
kept secret and only the owner knows it, whereas the public key is known to
everyone and can be used to send bitcoins to the owner. The coins are owned
by an individual whose public key can validate the coins’ digital signature.
Unspent Transaction Output (UTXO) sets contain all the spendable money
on the Bitcoin network. A transaction to send bitcoins from one address
to another requires at least one unspent input and one spendable output.
A transaction has its own unique identity, which is a transaction hash, in
addition to inputs and outputs.
Bitcoin is made out of chained blocks which are linked together. Thus, every
block serves as a building block for a blockchain. The Genesis block was the
first block created in the history of Bitcoin. The Genesis block has a height of
0. All subsequent blocks constructed after the Genesis block are stacked on
top of it. Each block put on top of the Genesis block raises the height of the
blockchain by one. Each block contains specific information. A block stores
information such as the size of the block, the total number of transactions
grouped in the block, the transaction itself, and also the block header.
CHAPTER 2. BACKGROUND 11
way back to the Genesis block [4]. Due to this dependency and the inter-
connection of the blocks, it is extremely difficult for potential hackers to edit
any block in a blockchain. This is because each change to the data in any
block on the blockchain results in a change to the hash of the current block,
which results in an error in the previous block, which results in an error in
the preceding block, and so on. The figure depicts the general structure of a
block.
2.3.3 Hashing
size is known as hashing [5].In other words, a hash is a data’s digital signa-
ture. It is the procedure of transforming readable information into something
that is absolutely meaningless. SHA (Secure Hash Algorithm) is a collec-
tion of cryptographic hash algorithms published by the National Institute
of Standards and Technology (NIST) [6]. The Bitcoin system employs the
SHA-256 hashing algorithm. The algorithm always returns a 256-bit value
in the hexadecimal number system. The SHA-256 function’s result is fre-
quently referred to as the hash of its input. The SHA family of algorithms
is subdivided into four subgroups: SHA-0, SHA-1, SHA-2, and SHA-3 [11].
2.3.4 Mining
number that is only used once). Nonce is a counter in the block header that
miners use to modify the hash value of a block to meet the hash criterion.
When the nonce value is hashed with SHA-256, the resulting output hash
begins with a particular number of zeros [29]. The average amount of work
required for a specific block is determined by multiplying the exponential
by the number of zeros in the right hash. This indicates that the Proof of
Work contains a high level of computation in the verification process. Min-
ers’ hardware achieves this high level of computing. Miners usually mine the
blocks by computing the hash of that block with a changing nonce. So there
is no set formula or pattern for varying the nonce. It is changed in a random
order. The miner changes the nonce until the resulting hash value equals or
is less than a given goal value.
2.3.6 Mempool
1. The miner must monitor the network for broadcast transactions. They
must validate the transactions by ensuring that the signatures are cor-
CHAPTER 2. BACKGROUND 16
rect and that the outputs have not been spent previously. This is done
to alleviate the issue of double spending.
2. Miners should possess all previous blocks that comprise the blockchain
prior to joining the network. They monitor the network for new blocks.
Then they must validate each received block by validating each trans-
action contained within. Additionally, they must verify that the clock
has the proper time.
3. Miners can begin creating their own blocks once they acquire the most
recent copy of the blockchain. To accomplish this, the miner aggregates
all transactions into a new block that extends the most current block.
4. Miners must now discover a nonce that validates the block. This is a
critical step in the mining process and demands considerable effort.
6. If all miners accept the block and add it to the relevant section of the
consensus chain, the miner who worked on determining the nonce for
that block will be rewarded. At the moment, the block reward is 6.25
Bitcoins. Additionally, if any of the transactions included in the block
include transaction fees, the miner takes those costs as well.
CHAPTER 2. BACKGROUND 17
The reward for Bitcoin mining decreases as the quantity of Bitcoins mined
increases. The maximum amount of Bitcoin that may be mined is 21 Mil-
lion. After successfully mining 210,000 blocks, the payout is halved. Mining
210,000 blocks will take approximately four years. The current prize is 6.25
Bitcoins. At first, the payout for mining Bitcoin was set at 50 Bitcoin. Apart
from the reward for mining, miners also receive a fee for each successful trans-
action added to the blockchain [2].
Every 2016 blocks, the difficulty of mining Bitcoin varies. The time required
to mine 2016 Bitcoin blocks is approximately two weeks. This means that
the Bitcoin mining difficulty is recalculated approximately every two weeks.
Below the following mentioned formula is used to determine the difficulty of
Bitcoin mining:
new dif f iculty = (old dif f iculty∗2016∗10min)/(total time to mine previous 2016 blocks)
Thus, mining 2016 blocks would take around two weeks if a block was
created exactly every ten minutes. The difficulty of the mining process is
always a self-adjusting in response to the network’s aggregated mining power.
But if additional miners join the Bitcoin network, the difficulty increases,
making it more difficult to solve the problem; if a large number of them
leave, the difficulty falls, making it easier to solve [1]. The difficulty rate
must be increased or decreased to maintain control over the rate of new
block production.
CHAPTER 2. BACKGROUND 18
Literature Review
This chapter reviews earlier research in the field, as well as identifies and anal-
yses problems connected to Bitcoin networks, mempool, and mining hard-
ware and mining pools. It also discusses the used of mining hardware in the
mining process.
Bitcoin has become a global sensation. Recently, there has been a surge in
public interest in the Bitcoin cryptocurrency. Numerous individuals have
begun Bitcoin mining as a business, while numerous other businesses have
begun accepting Bitcoin as a payment mechanism. Given that Bitcoin was
launched only a few years ago, there is still a great deal of research being
conducted on the cryptocurrency. There are now a few research articles
discussing various elements of Bitcoin, including mining, security of the net-
work, and many attacks on mining pools. Satoshi Nakamoto [30] addressed
every facet of the Bitcoin protocol in his 2009 AD white paper. Although
Bitcoin is often considered to be the first digital cryptocurrency, the notion
of cryptocurrency and the cryptographic techniques that underpin it were
first suggested by David Chaum in his 1983 paper [16]. Bitcoin’s consen-
19
CHAPTER 3. LITERATURE REVIEW 20
sus technique is Proof of Work, and the concept was originally suggested in
1992 by Cynthia Dwork and Moni Naor in their article [21]. Bitcoin achieves
decentralisation through the use of the blockchain idea, which aids in the
resolution of Bitcoin’s double spending problem [17].
According to Dr. Saifedean Ammous [13], Satoshi Nakamoto, the inventor
of Bitcoin, never meant for it to be a new technology; rather, it was to be
a peer-to-peer version of electronic payment. When a transaction occurs,
it is recorded in a block by all nodes on the network. It is then confirmed
by all nodes using mathematical processes. The node that initially solves
the verification operation broadcasts the solution and transaction across the
network. All other nodes verify and approve the transaction and solution.
That first node is compensated with a certain quantity of cash. He mentioned
blockchain applications such as digital payments, which utilise a decentralised
currency system rather than a centralised one; this eliminates third-party in-
tervention and requires more processing power and time. SmartContracts
make use of blockchain currencies via multi-signature wallets and timed pay-
ments. database and record management functionality that is limited to
the native blockchain’s currency. The most successful method of payment is
digital. Additionally, blockchain technology has some challenges, including
redundancy, scalability, regulatory compliance, irreversibility, and security.
In their study paper, Florian Tschorsch and Bjorn [41] address bitcoin’s
fundamental principles, security risks, privacy, and other relevant observa-
tions. This article discusses bitcoin as a decentralised digital currency, in
which each node acts as a bank with a block-chain acting as a distributed
ledger. This is in contrast to the traditional centralised digital currency,
which exemplifies the banking model by issuing unique serial numbers to
CHAPTER 3. LITERATURE REVIEW 21
users and maintaining the ledger. The concept of double spending is briefly
discussed. It occurs when the same coin is sent to two distinct nodes or
users, resulting in the blockchain becoming inconsistent. This is avoided by
checking the legitimacy of all user transactions. Proof-of-work techniques are
used to prevent network assaults. These systems utilise the SHA-256 hash
algorithm to solve cryptographic riddles. A special phrase (discussed) is used
to describe the difficulty of locating a target’s hash. Additionally, Bitcoin
pays users through transaction fees and mining. Initially, the Bitcoin award
was 50BTC, which was halved every four years, and is currently at 12.5BTC.
Whereas transaction fees are almost certainly going to increase in the future.
Bitcoin transactions contain an identifier for the transaction, as well as inputs
and outputs. Each output is utilised as an input, producing a chain of blocks
that enables the transaction to be traced back. This output is a reference to a
script that has inputs, outputs, and a collection of arguments. To ensure the
security of bitcoin, each user is allocated a virtual wallet that contains both
a private and public key. This wallet can be a software wallet with a locally
running bitcoin instance, which is much more vulnerable to attack; a hard-
ware wallet with an offline operating device, which makes it more difficult to
gain access to for an attack; a paper wallet with keys stored in a document,
similar to cash money; or a brain wallet with passphrase hashing for private
and public keys. To strengthen the wallet’s security, multi-signature transac-
tions are employed. These transactions are signed independently. To secure
transactions, elliptic curve cryptography is utilised [27] and [28]. Addition-
ally, changing the transaction id without invalidating it relates to transaction
malleability, which is analogous to double-spending, with the difference be-
ing that the attacker is the receiver party in this situation. Due to the fact
that solo mining produces big but uncommon returns, miners collaborate to
CHAPTER 3. LITERATURE REVIEW 22
build a pool in which they earn continual small payments. The bitcoin net-
work is an unstructured peer-to-peer overlay network focused on transaction
processing and information delivery rather than on the search for specific
data items or files. In terms of scalability, the maximum size of a block is
1MB, which limits the number of transactions and the growth rate of the
block chain, hence preventing block chain extension. Increased scalability
will necessitate additional resources. A high internet speed combined with a
super peer-based overlay structure is required for a higher transaction rate.
The author delves into each of these issues, demonstrating how bitcoin is
continually expanding and developing.
criteria. This will serve as an alarm system for all mining pool workers and
for the whole Bitcoin community in the event of this scenario.
To maximise their earnings, a mining pool must select the ideal subset
of transactions from the current mempool that maximises fees while keeping
the block’s overall size below the limit. This is a variant of the 0-1 knapsack
problem [39], with the best solution being NP-hard to find. As a result,
the majority of miners employ a selection policy.By default, the transaction
selection policy [8] selects transactions from the mempool in the following
manner:
try to build the next block. This gave workers the ability to choose which
transactions to use, but it also meant that bandwidth requirements were
increased. This was later enhanced to allow employees to experiment with
the timestamp as well, giving them even more choices to test before needing
to request more work. The server in Stratum [9] gives the worker a template
that they can use to construct their own work, as well as more fields than
the time and date. This allows cutting-edge miners to request less frequently.
Furthermore, it deviated from the HTTP protocol, making it faster than its
predecessors and also reducing bandwidth. Finally, it has systems in place to
expedite the introduction of new blocks, lowering the amount of stale work.
Most, if not all, significant mining pools now use Stratum and have disabled
their getwork interface.
Thus the authors in [23] suggest a method for monitoring the transaction
selection policy of Bitcoin mining pools and detecting any departures from
the policy. This is accomplished by developing a prediction model for each
block of the transaction selection policy and tracking any changes in future
importance as new blocks are received. We then offer a scenario in which
a mining pool rejects transactions from a specified country to demonstrate
how their technique would detect this policy change.
Solo mining is the process of mining Bitcoin by a person utilising their own
hardware and operating independently. Due to the fact that solo mining
refers to individual mining, it necessitates a significant investment in hard-
ware in order to compete with other miners and to get the mining reward for
solving the block. The miner collects the reward on his or her own and can
earn a substantial profit if the miner has sufficient hardware resources. The
primary disadvantage of solo mining is that, because of the limited hardware
28
CHAPTER 4. BITCOIN MINING POOLS 29
resources, it may take years for solo miners to produce a legitimate block.
Prior to the advent of pool mining in 2011, all miners operated indepen-
dently [43].
Pool mining enables miners to pool their resources in order to receive con-
sistent payments. Each pool mines Bitcoins using a unique ID [4]. Pool
mining combines the hardware resources of all miners, resulting in a large
amount of power and a considerably faster mining speed than solo mining.
Each member of a pool is assigned a lower difficulty value. Each miner in a
pool now has an easier time solving the hash problem and establishing proof
of work. Each pool miner sends their own work to the pool for verification
by submitting a hash value less than the pool’s target value (referred to as
shares). If a share falls below the network’s target value, the pool claims the
block and the pool operator distributes the reward to all pool miners. The
most often used compensation method in pool mining is ”Pay per share” [43].
Figure 4.1: Every 210,000 blocks, or approximately every four years, the
rewards for successfully completing one block are halved.
If you’re curious about the precise dates of these halvings, you can consult
the Bitcoin Clock, which provides this information in real time. Interestingly,
throughout its history, the market price of Bitcoin has tended to correlate
closely with the decrease in the number of new coins put into circulation. This
decreased inflation rate increased scarcity, which traditionally has resulted
in an increase in price [25]. If you’re curious about the total number of
blocks mined thus far, various websites, like Blockchain.info, provide this
information in real time [25].
CHAPTER 4. BITCOIN MINING POOLS 31
Before we discuss the finest mining pools, it’s critical to realise that the
majority of mining pools are located in China. Numerous companies have
solely Chinese websites and support. The centralization of mining in China
is one of the most serious concerns confronting Bitcoin at the time. There
are approximately twenty big mining pools. When the percentage of hash
power owned by a pool is divided by the pool’s location, it was calculated
that Chinese pools control 65% of the network hash rate [42].
mining pools throughout Bitcoin’s history, as well as when and why min-
ers join or quit mining pools. Mining pools provide incentives to individual
miners and retain a portion of the awards for their profits (pool fee). Indi-
vidual miners commit computational resources in order to get a reward for
mining. They can choose to join a pool (new miners), to bounce between
pools (pool hoppers), to discontinue mining activities (dropout miners), or
to engage in numerous pools (cross-pooling miners) [40].The relocation of
miners has a direct effect on the market for mining pools. This is done by
automatically altering the mining difficulty every 2,016 blocks (two weeks)
based on the total hash rate to keep the block discovery rate at 10 minutes.
The network also pays miners and sets the block reward. The block reward
starts at 50 BTC each block (block 0) and is halved every 210,000 blocks (4
years).
4.4.1 Poolin.com
4.4.2 ANTPool
Antpool began mining in March 2014, nearly four years after the first mining
pool, Slushpool [42]. Antpool is a top Bitcoin mining pool that enables
you to easily mine and exchange bitcoin [10]. Despite recent controversies,
Antpool continues to be the top Bitcoin mining pool by hash rate on the
Bitcoin network. Antpool controls around 15% of all Bitcoin mining pools’
overall hash rate [42].However, Antpool lacks a graphical user interface [10].
4.4.3 f2pool
Bitcoin trading via iOS and Android devices. This platform supports a va-
riety of languages, including English, Spanish, and Chinese. Additionally,
f2pool supports over 40 digital currencies [10].
Slush Pool was the first mining pool, and its customers have mined over 1
million Bitcoins over the last decade using its services and software: Brai-
insOS and BraiinsOS+. The Slush Pool was founded in 2010 and was one
of the first Bitcoin mining pools. Initially, it was referred to as the ”Bitcoin
Pooled Mining Server,” or BPMS for short. This proportion places it among
the Internet’s top five Bitcoin mining pools [42].It is one of the largest mining
pools and notifies users when an issue is found. It enables the extraction of
bespoke data sets from the system using the API. The Slush Pool assists you
in minimising losses due to hardware breakdown and connection problems.
Additionally, it lacks a variety of coins [10].
The above example provides the weights of several honeycombs and the
values associated with them. The objective is to maximise the amount of
honey that fits into the bear’s knapsack.
Each transaction has a certain size, which is often determined by the
number of inputs and outputs. If these values are greater, the transaction size
will be greater. The bitcoin network broadcasts these transactions. Miners
receive these transactions and verify them before adding them to the Miner’s
memory pool (Mempool), where they wait to be confirmed. By confirmation,
we imply that transactions are added to the Block and deleted from the
Mempool. Mempools typically contain over 100,000 transactions. Whereas
Block has a finite size of 1MB and can only include a subset of transactions.
Those that have requested a transaction provide incentives to miners in order
for their transaction to be included in the block. This is referred to as the
Transaction Fee [15].So we can conclude that:
We can simply conclude from the foregoing that the issue at hand is compara-
ble to a knapsack. The knapsack problem is an illustration of combinatorial
optimization. Its name derives from a circumstance in which a large number
of objects with varying values and weights are compared to determine the
most profitable group of objects that can fit into a fixed-sized bagpack.
Chapter 5
This chapter includes data graphs generated from different simulation results,
as well as an examination and comparison of several block packing techniques
used by bitcoin mining pools.
38
CHAPTER 5. SIMULATION RESULTS AND ANALYSIS 39
Figure 5.1: The total number of Bitcoin transactions that are currently pend-
ing in the mempool. The spikes in the middle correspond to the exponential
growth and decline of the Bitcoin price at the end of 2017 and the begin-
ning of 2018. When markets experience volatility, the number of pending
transactions rapidly increases [3].
• On the positive side, the algorithm is pretty fast and runs in O(n) to
form a block from a mempool of n transactions.
• It was anticipated that this method would outperform the greedy algo-
rithm. However, the presence of outliers leads to a quality metric that
is unbounded.
fees.
• Sorting algorithms are the most prevalent and practical method for
picking cryptocurrency transactions, and the Delta algorithm is the
most well-known among miners.
• They provide a high level of service in terms of the overall fee associated
with specified transactions.
Figure 5.2: Block diagram demonstrating data collection and processing pro-
cedure
A Bitcoin node runs the Bitcoin core code base and keeps an up-to-date full
copy of the Bitcoin database. It then maintains validating, listening, and
forwarding all current transactions, and syncs its database with the updated
blockchain. There are various ways to run a Bitcoin node. Bitcoin full nodes
can run in pruned or archived mode. In pruned mode, the node just keeps the
CHAPTER 5. SIMULATION RESULTS AND ANALYSIS 43
newest blockchain states and uses less disc space than in archival mode, which
keeps all past data and uses a lot of disc space. Bitcoin light nodes simply
store block headers and rely on full nodes for data. Installed a full Bitcoin
node in pruned mode with minor code changes. It took 4–5 days for the
node to fully sync with its peers. Once fully synced, it began receiving and
forwarding network transactions. The mempool is where new transactions
enter the Bitcoin network and are processed into the database before being
deleted. So the mempool code base was changed to extract transaction data
and log it independently into entry and exit log files.
All fields were logged with a timestamp as the entry time in entry files. While
exit files also logged the same information with a timestamp indicating the
transaction’s exit time and an additional field (reason) indicating the cause
for the transaction’s exit from the mempool. This data was continuously
logged and two files (entry and exit) were dumped into the destination folder
every 24 hours. We integrated the JSON log files entry and exit using the
code in the tool Python. This specific output file JSON would resemble the
mempool of the miner. After the log files were processed, we made further
mempool snapshots of the JSON file using the C language code at an interval
of 1 or 10 seconds.
Python was used to collect data from APIs programmatically. Through which
we downloaded the raw minned blocks from the BTC.com explorer and also
extracted certain information about the blocks, such as their weight, fees, and
size. On average, 144 blocks are mined every day, and each block contains
CHAPTER 5. SIMULATION RESULTS AND ANALYSIS 44
6.25 bitcoins. 144 x 6.25 equals 900, which is the average daily number of
new bitcoins mined.
5.3.1 Dataset
The node is first synchronised, and two weeks’ worth of transactions are
logged. Because the Bitcoin protocol specifies that, by default, transactions
CHAPTER 5. SIMULATION RESULTS AND ANALYSIS 45
can survive in the Miner’s Mempool for two weeks. After two weeks, the
Node’s Mempool will resemble that of the Miner. And from BTC.com Ex-
plorer, genuine data on mined raw blocks has been collected. In fact, there
are two distinct types of data sets used in the analysis. The first dataset
spans the period from 13 May 2019 to 19 May 2019, while the second spans
the period from 04 December 2020 to 08 December 2020. Mempool snap-
shots are created using Unix timestamps. Using the C code, thousands of
sets of mempools were constructed. In this thesis, these mempools were used
as inputs for the greedy algorithm, greedy with advice, and Delta (sorting-
based method). These methods are executed using Python code on a 3.20
GHz Intel Core i7 with 16 GB RAM.
Figure 5.4: The number of blocks generated between 13 and 19 May 2019
by several mining pools utilising various techniques at various timestamps is
displayed.
Figure 5.5: The number of blocks generated between 04 and 08 Dec 2020
by several mining pools utilising various techniques at various timestamps is
displayed.
The two above graphs illustrate how mining pools deviate from block
packing strategies. I compared the block fees, block size, and weight of
the downloaded blocks from the BTC.com explorer to the block fees, block
size, and weight of the original downloaded blocks, and then anticipated the
strategies used by miners to generate those particular blocks. According to
both datasets, the F2pool created the most blocks. According to the findings
CHAPTER 5. SIMULATION RESULTS AND ANALYSIS 47
obtained by the dataset of 13-19 May 2019, BTC.com was in second place,
whereas Poolin remained in second place according to the results generated
by the dataset of 04-08 December 2020. It is still seen in both datasets
that Delta is the most common strategy among miners, greedy+advice is the
second most popular technique, and greedy appears to be less popular among
miners.Additionally, you’ll see that certain blocks are labelled ”Unknown,”
indicating that we were unable to anticipate the algorithm used to generate
them. Thus, it is established that there are additional procedures known
only to miners, and that they were utilised for the particular goal of mining
a block.
Figure 5.6: Between 13 May and 19 May 2019, a pie chart depicts the most
often utilised technique among miners and also indicates the presence of other
techniques.
CHAPTER 5. SIMULATION RESULTS AND ANALYSIS 48
Figure 5.7: The following line graph illustrates the various mining pools’
nonlinear behaviour.
Figure 5.8: The power law relationship between timestamp count and al-
gorithm is illustrated in a graph from the dataset from 13 May to 19 May
2019.
Figure 5.9: The power law relationship between timestamp count and al-
gorithm is illustrated in a graph from the dataset from 04 December to 08
December 2020.
The above two bar graphs from different datasets forecast the algorithm’s
utilisation by miners as a power law function of the timestamp count. A
CHAPTER 5. SIMULATION RESULTS AND ANALYSIS 50
Figure 5.10: The scatter plot depicts the dataset from December 04, 2018 to
December 08, 2020. utilises two unique methods to demonstrate the interplay
between generated fees in blocks: Delta and Greedy+Advice.
The above scatter figure compares the fees earned when two algorithms,
Delta and Greedy+Advice, were used to generate blocks. Thus, Delta’s fees
are on the Y-axis, whereas Greedy+Advice’s fees are on the X-axis. Both
numerical numbers are independent of each other. On a scatter plot, the
data points or dots reflect the individual values of the fees generated by the
Delta and Greedy+Advice algorithms. Delta fee data points have higher
values than Greedy+Advice fee data points and are also substantially more
dispersed than Greedy+Advice fee data points. Both quantities appear to
have a nonlinear connection. It is concluded that utilising both algorithms
would not result in the same fees.
CHAPTER 5. SIMULATION RESULTS AND ANALYSIS 51
Figure 5.11: Line graph displaying the produced block fees using the Delta,
Greedy+Advice, and Greedy algorithms from 04 December to 08 December
2020.
The accompanying line graph, which uses the dataset from 04 December
to 08 December 2020, illustrates the trend of generated block fees utilising
three algorithms: Delta, Greedy+Advice, and Greedy during a nearly one-
week period. These are the blocks that have previously been mined by the
various mining pools depicted on the graph. I replicated the blocks at the
exact timestamp using the three procedures discussed previously. The trend
indicates that Delta is the superior algorithm over the other two. However,
as seen in the preceding graphs, miners do not commit to a single block
packing approach; rather, they constantly swap between them. Additionally,
it was found that while recreating the blocks, Delta takes longer than the
other two.
CHAPTER 5. SIMULATION RESULTS AND ANALYSIS 52
Figure 5.12: The graph depicts the difference in fees between Delta, Greedy,
and Greedy+Advice for all three algorithms from December 04 to December
08, 2020.
The stacked column above graph demonstrates the difference in fees be-
tween Delta, Greedy and Greedy+Advice all three algorithms over the time
period from 04 December to 08 December 2020. The orange component
shows the Delta part covering more than two parts.It also illustrates that in
almost all circumstances the value of the Greedy fee is almost zero, but not
quite null.Additionally, this finding indicates that Delta generates the largest
block fees, which can be beneficial for miners’ incentives.
Chapter 6
This chapter finishes the thesis and summarises the research’s primary find-
ings. The first section of this chapter discusses the goals and objectives of
this investigation. The second section discusses more studies that could be
conducted in the future based on the findings of this thesis.
6.0.1 Conclusion
The Bitcoin blockchain’s long-term stability and security are highly depen-
dent on the incentive it provides to miners. With block subsidies gradually
reduced every four years, miners will increasingly rely on transaction fees as
their main source of incentive.This research demonstrates that miners do not
adhere to a single technique for block packing. They continually alter their
techniques when erecting a block.
To analyse the behaviour of several mining pools, we initially created two
distinct datasets from different time periods: one from 2019 and another
from 2020. Furthermore, separate blocks were reconstructed using three
distinct algorithms: greedy, greedy with advice, and Delta, all of which were
fed mempool snapshots. We compared these rebuilt blocks to the real mined
53
CHAPTER 6. CONCLUSION AND FUTURE WORK 54
blocks retrieved from the BTC.com Explorer. Thus, by observing block costs,
block size, and weight, it is possible to forecast the applied block packing
algorithm by different mining pools.Additionally, it was noticed that the
Delta algorithm produces the best block fees, despite the fact that its block
creation time is longer than the other two methods. So, it is critical to
conduct further research into the mining pools’ behaviour, as well as the
possibility of additional strategies, as our simulations were unable to forecast
them, and thus they are labelled as ”Unknown”. So it is important to discover
those unknown strategies too.
Based on the findings of this research, it is obvious that little research has
been conducted on the behaviour of mining pools and their transaction se-
lection policies when producing blocks. Our research indicates that miners
do not just rely on the single block packing strategy and that they also have
other secret strategies that will be used in the future. We can gain a thorough
understanding of their transaction selection strategies by utilising machine
learning methods. Additionally, it is required to overcome the disadvantages
of the previously described algorithms that are commonly employed by min-
ing pools and provide a better solution, as research results indicate that the
Delta algorithm generates superior results but takes longer to create a block.
Bibliography
55
BIBLIOGRAPHY 56
[10] 10+ best bitcoin mining pools (high btc, ethereum payouts).
https://www.guru99.com/mining-pools-bitcoin-ethereum.html, August
2021.
[12] Karl-Johan Alm. Mempool optimized fees, and the correlation be-
tween user costs, miner incentives, and block capacity. https://bc-
2.jp/mempool.pdf, Oct 2017.
[22] Ittay Eyal and Emin Gün Sirer. Majority is not enough: Bitcoin mining
is vulnerable. In International conference on financial cryptography and
data security, pages 436–454. Springer, 2014.
[27] Jon Matonis. The bitcoin mining arms race: Ghash. io and the 51%
issue. New York, NY, USA: CoinDesk, Tech. Rep, 2014.
[28] Gregory Maxwell. Coinjoin: Bitcoin privacy for the real world. bit-
cointalk. org.(august 2013). 2013.
[29] R. P. Naik. ”optimising the sha256 hashing algorithm for faster and
more efficient bitcoin mining”. 2017.
[32] Karl J O’Dwyer and David Malone. Bitcoin mining and its energy
footprint. 2014.
[35] Beltran Borja Fiz Pontiveros, Robert Norvill, and Radu State. Monitor-
ing the transaction selection policy of bitcoin mining pools. In NOMS
2018-2018 IEEE/IFIP Network Operations and Management Sympo-
sium, pages 1–6. IEEE, 2018.
BIBLIOGRAPHY 59
[36] Okke Schrijvers, Joseph Bonneau, Dan Boneh, and Tim Roughgarden.
Incentive compatibility of bitcoin mining pool reward functions. In In-
ternational Conference on Financial Cryptography and Data Security,
pages 477–498. Springer, 2016.
[38] Michael Bedford Taylor. Bitcoin and the age of bespoke silicon. In
2013 international conference on compilers, architecture and synthesis
for embedded systems (CASES), pages 1–10. IEEE, 2013.
[39] Paolo Toth. Dynamic programming algorithms for the zero-one knapsack
problem. Computing, 25(1):29–45, 1980.
[40] Natkamon Tovanich, Nicolas Soulié, Nicolas Heulot, and Petra Isenberg.
An empirical analysis of pool hopping behavior in the bitcoin blockchain.
In 2021 IEEE International Conference on Blockchain and Cryptocur-
rency, 2021.
[41] Florian Tschorsch and Björn Scheuermann. Bitcoin and beyond: A tech-
nical survey on decentralized digital currencies. IEEE Communications
Surveys & Tutorials, 18(3):2084–2123, 2016.
[42] J. Tuwiner. 9 best bitcoin mining pools: Legit sites (2021 com-
panies). 9 best bitcoin mining pools: Legit sites (2021 companies).
https://www.buybitcoinworldwide.com/mining/pools/, June 2021.
[43] Luqin Wang and Yong Liu. Exploring miner evolution in bitcoin net-
work. In International Conference on Passive and Active Network Mea-
surement, pages 290–302. Springer, 2015.
BIBLIOGRAPHY 60
[44] Canhui and Yang Qin Xiaowen Chu, Wang. Measurement and anal-
ysis of the bitcoin networks: A view from mining pools. In 2020 6th
International Conference on Big Data Computing and Communications
(BIGCOM), pages 180–188. IEEE, 2020.