How Miners Select and Order Transactions in Bitcoin

tldt arrow

Too Long; Didn't Read

This chapter defines blockchains and smart contracts, then explains that Bitcoin Core’s GetBlockTemplate creates three unwritten miner norms: choose by fee rate, order by fee-per-byte, and ignore transactions below a minimum fee.

Company Mentioned

Mention Thumbnail

Coin Mentioned

Mention Thumbnail
featured image - How Miners Select and Order Transactions in Bitcoin
EScholar: Electronic Academic Papers for Scholars HackerNoon profile picture
0-item

Abstract/Zusammenfassung

Publications

Acknowledgements

CHAPTER 1: INTRODUCTION

  1. Introduction

    1.1 Overview of thesis contributions

    1.2 Thesis outline

CHAPTER 2: BACKGROUND

2.1 Blockchains & smart contracts

2.2 Transaction prioritization norms

2.3 Transaction prioritization and contention transparency

2.4 Decentralized governance

2.5 Blockchain Scalability with Layer 2.0 Solutions

CHAPTER 3. TRANSACTION PRIORITIZATION NORMS

  1. Transaction Prioritization Norms

    3.1 Methodology

    3.2 Analyzing norm adherence

    3.3 Investigating norm violations

    3.4 Dark-fee transactions

    3.5 Concluding remarks

CHAPTER 4. TRANSACTION PRIORITIZATION AND CONTENTION TRANSPARENCY

  1. Transaction Prioritization and Contention Transparency

    4.1 Methodology

    4.2 On contention transparency

    4.3 On prioritization transparency

    4.4 Concluding remarks

CHAPTER 5. DECENTRALIZED GOVERNANCE

  1. Decentralized Governance

    5.1 Methodology

    5.2 Attacks on governance

    5.3 Compound’s governance

    5.4 Concluding remarks

CHAPTER 6. RELATED WORK

6.1 Transaction prioritization norms

6.2 Transaction prioritization and contention transparency

6.3 Decentralized governance

CHAPTER 7. DISCUSSION, LIMITATIONS & FUTURE WORK

7.1 Transaction ordering

7.2 Transaction transparency

7.3 Voting power distribution to amend smart contracts

Conclusion


Appendices

APPENDIX A: Additional Analysis of Transactions Prioritization Norms

APPENDIX B: Additional analysis of transactions prioritization and contention transparency

APPENDIX C: Additional Analysis of Distribution of Voting Power

Bibliography


In this chapter, we provide the necessary background on blockchains and smart contracts. We then present the context for transaction prioritization norms, followed by transaction prioritization and contention transparency. Next, we present the background information on decentralized governance. Lastly, we introduce the background details concerning Layer 2.0 solutions aimed at enhancing the scalability of blockchains.

2.1 Blockchains & smart contracts

A blockchain is a decentralized and distributed ledger of cryptographically linked records of transactions stored in blocks. A block is a set of zero[3] or more transactions. In the case of Bitcoin, a block also includes a Coinbase transaction, responsible for transferring rewards (or compensation for the miner’ efforts) to the miner’s wallet. These blocks are interconnected, tracing back to the original (or “Genesis”) block. Figure 2.1 presents an illustration of a blockchain with a block inclusion rate of 10 minutes. The ledger is maintained and continually extended by the blockchain participants by carrying out various functions. Transaction issuers, for instance, issue transactions and share it with other participants through a peer-to-peer (P2P) network. Such transactions are deemed unconfirmed until they are added permanently to the blockchain. Some others, called miners[4] (in proof-of-work blockchains) or block proposers (in proof-of-stake blockchains), bundle the transactions into blocks for confirmation. They propose the new block over the P2P network where others can verify it and, if successful, add to their copy of the blockchain—thereby extending the ledger or chain of blocks. The miner typically collects a reward in the form of newly minted coins as an incentive for their contribution to


Figure 2.1: Illustration of a blockchain consisting of three blocks, with an extimation generation and inclusion time approximately 10 minutes. It is important to note that every block, except for the Genesis block which is the initial block in the blockchain, also uses the hash of its preceding block to compute its own hash.


the network along with the transactions fees provided by the issuers. We use the term “fee” to refer generally to the incentive offered by a user to miners for prioritizing the inclusion of their transaction in a block, albeit its exact form may vary, e.g., fee rate (or fee-per-byte) in Bitcoin and gas price in Ethereum[5]. To join a blockchain, miners use a software implementation (along with the hardware) which we refer as a node. A node allows a miner to receive broadcasts of transactions and blocks from their peers, validate the data, and mine a block. Nodes queue the unconfirmed transactions received via broadcasts in an in-memory buffer, called the Mempool, from where they are dequeued for inclusion in a size-limited block. One can also configure the node to skip mining and simply use it as an observer.


Some blockchains, such as Ethereum, allow for the execution of smart contracts— contractual agreements encoded in software programs that run atop the blockchain. Smart contracts are typically developed using Solidity, a domain-specific programming language (Solidity Team, 2023), and they can be executed in the Ethereum Virtual Machine (EVM). Their implementations abide by standards such as ERC-20 (Ethereum Foundation, 2023a) and ERC-721 (Ethereum Foundation, 2023b) to ensure compatibility and interoperability among them. These standards define, for instance, the key functions for creating and implementing smart contracts for fungible tokens (e.g., Compound’s COMP token (Leshner and Hayes, 2019)) in the case of ERC-20 or non-fungible tokens (NFTs) in the case of ERC-721.

2.2 Transaction prioritization norms

A crucial detail absent in the design of a blockchain per (Nakamoto, 2008) is any notion of a formal specification of transaction prioritization. Said differently, Nakamoto’s design does not formally specify how miners should select a set of candidate transactions for confirmation from all available unconfirmed transactions. Notwithstanding this shortcoming, “norms” have originated from miners’ use of a shared software implementation: For example, in Bitcoin, miners predominantly use the Bitcoin Core (bitcoin.org, 2023) software for communicating with their peers (e.g., to advertise blocks and learn about new unconfirmed transactions) and reaching a consensus regarding the chain.


Of particular note in the popular Bitcoin core’s implementation is the GetBlockTemplate (GBT) mining protocol, implemented by the Bitcoin community around February 2012.[6] GetBlockTemplate rank orders transactions based on the fee-per-byte (i.e., transaction fees normalized by the transaction’s size) metric (Bitcoin Wiki, 2023a).


In Bitcoin, the term size, refers to virtual size, each unit of which corresponds to four weight units as defined in the Bitcoin improvement proposal BIP-141 (Lombrozo et al., 2015). The size (or maximum capacity) of a block is also limited to 1 MB virtual size. The predominant use of GBT (through the use of Bitcoin core) by miners coupled with the fact that GBT is maintained by the Bitcoin community implicitly establishes two norms. A third norm stems from a configuration parameter of the Bitcoin core implementation. We now elucidate these three norms.


I. When mining a new block, miners select transactions for inclusion, from the Mempool, based solely on their fee rates.


II. When constructing a block, miners order (place) higher fee rate transactions before lower fee rate transactions.


III. Transactions with fee rate below a minimum threshold are ignored and never committed to the blockchain.


The GBT protocol implementation in Bitcoin core is the source of the first two norms. GBT’s rank ordering determines both which set of transactions are selected for inclusion (from the Mempool) and in what order they are placed within a block. GBT dictates that a transaction with higher fee-per-byte will be selected before all other transactions with a lower fee-per-byte. It also stipulates that within a block a transaction with the highest fee-per-byte appears first, followed by next highest fee-per-byte, and so on.


The third norm stems from the fee-per-byte threshold configuration parameter. Bitcoin core, by design, will not accept any transaction with fee rate below this threshold,



Figure 2.2: Volume of transactions issued and blocks mined as a function of time, showing that transactions have been issued at high rates for both (a) Bitcoin and (b) Ethereum blockchains.



essentially filtering out low-fee-rate transactions from even being accepted into the Mempool. The default (and recommended) value for this configurable threshold is set to 1 sat/B. [7]


Author:

(1) Johnnatan Messias Peixoto Afonso


This paper is available on arxiv under CC BY 4.0 DEED license.

[3] As miners can also mine a block without including any transaction on it, we refer to those blocks as empty blocks.


[4] Throughout this thesis, we use the terms miner, mining pool, mining pool operator (MPO), and block proposer interchangeably.


[5] Ethereum recently switched its consensus mechanism from proof-of-work to proof-of-stake with The Merge hard fork deployed on September 15, 2022, at block number 15537394 (Ethereum Foundation, 2022a,b).

Trending Topics

blockchaincryptocurrencyhackernoon-top-storyprogrammingsoftware-developmenttechnologystartuphackernoon-booksBitcoinbooks