Full nodes across the bitcoin network continuously obtain, validate and broadcast new transactions. Transactions are collectively allocated to transaction pools on router nodes. Miners, or mining nodes, engage in an additional process known as mining, which refers to building the blockchain by adding block by block that are consensually approved by all the network’s nodes as being valid.

Let’s assume a mining node that records new transactions onto a given candidate block, which represents a block that is transiently stored onto a miner’s memory for further actions. A candidate block’s height number equals N + 1 where N refers to the highest block’s height included in the blockchain. To rephrase it, the candidate block represents a potential block’s child whose height equals N.

Now, let’s suppose that during the period when the candidate block is transiently stored, a newer block is received from another miner. This block will be validated and recorded onto the miner’s memory as the blockchain’s most recent block. The miner will compute intersection of the transactions that were included in its pool of transactions as well as in the received block. The yielded group of transactions represent transactions which have been already included by the other miner and can be eliminated from the pool of transactions. Afterwards, construction of a new candidate block takes place (none of the set’s old transactions will be included in this block). Furthermore, it will also represent a potential child emerging from the received block.

Which transactions will be confirmed first?

Have you ever been confused why some transactions are confirmed rapidly, while others might require long hours to be confirmed?

Some transactions will be prioritized for inclusion in the candidate block. The following equation represents the function of transaction priority:

The value of input refers to the bitcoins’ value in satoshis (1 bitcoin = 108 satoshis). The input age denotes the age of a referenced output by the input minus the number of blocks that have been received ever since the output was recorded onto the blockchain. The transaction size refers to the transaction’s size in bytes.

The initial 50 kilobytes of a transaction’s space are served for high priority transactions (calculated priority exceeding 57600000). The high priority refers to a threshold number that denotes a transaction involving one bitcoin (100000000 satoshis) aged 144 blocks (which equals approximately 24 hours) and included in a transaction with a size of 250 bytes. The logic behind this is that whenever a transaction is considered valuable or has to wait for considerable time to be included in a block, then it is prioritized. Nevertheless, whenever a transaction’s size is huge, it won’t be prioritized.

The space remaining of the MAX-BLOCK-SIZE is filled by the miner with other bitcoin transactions. Usually, miners will prioritize transactions with highest fees to boost their profits.

Bitcoin clients automatically implement a minimum fixed fee, or they calculate optimized transaction fees that are based on previous confirmation times.

Image from Flickr