How Do Cryptocurrency Transactions Work?

In this lesson, we’re going to take a basic look at the general principles behind blockchain-based transactions, and examine the role that fees play in their execution.
June 3, 2022

How Do Cryptocurrency Transactions Work?

The vast majority of blockchains have one thing in common — they allow users to send and receive digital assets (including cryptocurrency coins and tokens) to one another without relying on any centralized intermediaries. 

Instead, blockchains leverage a peer-to-peer network of miners and/or nodes that take on the role of executing transactions in a timely fashion, ensuring their irreversibility, and maintaining a full record of all the previous transactions that occurred on the blockchain. 

In simple terms, a cryptocurrency transaction occurs when a person transfers coins or tokens to an external wallet. On many smart contract platforms, transactions don’t always involve a transfer of value, as they can instead be used to invoke smart contract functions — these are known as internal transactions. 

In this lesson, we’re going to take a basic look at the general principles behind blockchain-based transactions, and examine the role that fees play in their execution. 

How Transactions Work

Cryptocurrency transactions are ordered into blocks by miners (Proof-of-Work blockchains) or nodes (Proof-of-Stake blockchains). Once a transaction is added to a block, it is then considered confirmed, it can then receive additional confirmations (and become more irreversible) once it is witnessed by other nodes who then update their copy of the blockchain.

When a user submits a transaction using their wallet, what they are actually doing is broadcasting to the blockchain that they wish to transfer an amount from their address to another. Using public key cryptography, the blockchain determines whether the user has the right to spend these funds, the signature included in their transaction proves to miners that they do indeed have control over the spent funds, and the transaction can be included in the block.

Each miner on the network creates what is known as a ‘block template’ which includes a list of all the transactions they want to include in the next block. If they successfully mine the next block, then this template is used, allowing the included transactions to be finalized. The miner then gets to keep all the fees included in the now confirmed transactions. Miners continually update their template to include only unconfirmed transactions, since they generally have a very low chance of mining the next block, and must always remain up-to-date. 

Broadly, the steps of a transaction can be broken down into 5 steps: 
  1. A user submits a transaction to the blockchain using their private key to sign an agreement, e.g. to send 0.1 BTC to an address with a fee of 0.001 BTC.
  2. This is broadcast to the blockchain, passed between nodes, and added to the mempool awaiting inclusion in a block. 
  3. A miner creates a block template and includes the transaction due to its relatively high fee.
  4. Once the miner successfully mines the next block, the transactions listed in their template are included, and the block is added to the blockchain. 
  5. The new state of the blockchain is broadcast and other nodes update their record. The transaction is now considered confirmed and the recipient will then be free to spend their 0.1 BTC. 

By requiring other nodes to confirm transactions before funds are considered spent, the blockchain can prevent double-spend attacks — which see a user spend the same funds twice. It also ensures that the blockchain cannot be manipulated by a user with a large amount of mining power, since they would need to control more than 51% of all mining power to enable double-spending.

Who gets the transaction fees?

Transaction fees pay for the amount of computational work (PoW blockchains) or processing operations (PoS blockchains) completed by nodes on the network. They are provided as rewards to the miner or node that includes them in a block — this is in addition to a separate block reward, which is usually minted for the miner. 
As it stands, most miner/node revenue comes from block rewards, and transaction fees make up just a small portion of their revenue. However, for platforms that incorporate a halving schedule, transactions fees will eventually become the primary source of revenue for miners/nodes. 

How are transaction fees calculated?

The vast majority of blockchains require users to pay a transaction fee when sending payments or invoking smart contracts. Depending on the platform, these transaction fees can range from extremely inexpensive to potentially cost-prohibitive for many users. They also fluctuate over time in response to network congestion.

However, one thing is usually consistent among blockchain platforms — the higher the fee (in terms of $/byte), the faster the transaction is processed. Since transaction fees essentially pay for the computational work of the miners/nodes, those with the highest fees are prioritized for the next block. And since a limited number of transactions can be included in each block, only those with a sufficiently high fee will be selected. Those with a low fee will be left in the mempool until their transaction fee is competitive, if it’s not included within a set amount of time, it can be dropped — and the user would need to resubmit it. 

Transaction fees are generally measured in terms of fee per byte ($/byte), since users pay based on the size of a transaction. As such, smaller transactions generally cost less to send. 

What causes delays?

As we briefly touched on, each block can only contain a certain number of transactions (the exact number varies by blockchain based on their block size and average transaction size). Moreover, blocks are processed at a known frequency, e.g. every ~10 minutes for Bitcoin or every ~13 seconds for Ethereum. 

Because of this, transactions that don’t have a competitive fee might not be included in the next block. Instead, they may be included in a later block, at such time that their fee becomes competitive. This could be minutes, hours, and potentially even days later for transactions with extremely low fees. 

During periods of high congestion, transaction fees often spike, which can lead to delays for those that don’t bump up their fee to compensate. Many blockchains include a way to increase the fee after the transaction has been broadcast, including the Replace-By-Fee (RBF) system on the Bitcoin blockchain. 

Lesson Recap (TL;DR)

  • Blockchains use a decentralized network of miners and/or nodes to process transactions into blocks, which then get permanently added to the blockchain. This involves checking the validity of the transaction and ordering it in a block. 
  • Thanks to the combined efforts of the miner/node network, transactions can be considered essentially irreversible once included in a block. The longer ago it was confirmed, and the more confirmations it has, the more irreversible it is. 
  • Transaction fees are used to reward the miners/nodes that process them, and higher fees (in terms of $/byte) generally ensure that a transaction will be processed faster. 
  • Blockchains can experience congestion when there is too much demand for block space, which can drive up fees as users compete to secure priority processing for their transactions.

Sources:
  1. "How Does Blockchain Use Public Key Cryptography?" Toshendra Kumar Sharma, https://www.blockchain-council.org/blockchain/how-does-blockchain-use-public-key-cryptography/
  2. "Bitcoin." Wikipedia, Wikimedia Foundation, https://en.wikipedia.org/wiki/Bitcoin#Supply
  3. "Vocabulary - Bitcoin Wiki" Wikipedia, Wikimedia Foundation, https://en.bitcoin.it/wiki/Vocabulary#Memory_pool
  4. "Double Spending." Wikipedia, Wikimedia Foundation, https://en.wikipedia.org/wiki/Double-spending
  5. "Replace by Fee" Bitcoin OpTech, https://bitcoinops.org/en/topics/replace-by-fee/

Read these next

See More

We're building a one-stop guide to all things crypto.

Add to the knowledge base
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.