UNIVERSITY
ALTCOINS
How Do Bitcoin Transactions Work?

How Do Bitcoin Transactions Work?

How does the actual Bitcoin transaction process work in detail? In this article, we explain the process and terms like miner awards, nonces, and UTXOs.

How Btc Transactions Work Kv

Key Takeaways:

  • A Bitcoin transaction involves multiple steps that happen behind the scenes after users press the ‘send’ button.
  • The steps involve creating a new unique Bitcoin address, submitting the payment, verifying the transaction, encoding the information in a new block, and validating payments using only unspent transaction outputs (UTXOs) as inputs.
  • Bitcoin transaction speed per minute and hour can vary depending on network conditions.

Behind the Scenes of the Bitcoin Transaction Process

Let’s introduce Bitcoin transaction procedures with the following scenario:

Bob, an online merchant, decides to accept Bitcoin as payment.

Alice, a buyer, has bitcoins and wants to purchase merchandise from Bob.

Wallets are files that provide access to multiple Bitcoin addresses. An address is a string of letters and numbers, such as: 1HULMwZEPkjEPech43BeKJL1ybLCWrfDpN. Each address has its own balance of bitcoins, and users can create as many addresses as they want. Imagine the addresses as bank accounts that work a bit differently.

For a deep dive into Bitcoin itself, read What Is Bitcoin? A Complete Guide for Crypto Beginners.

Creating a New Address

Bitcoin client software generates Bitcoin addresses for users. When Bob creates a new address, what he’s really doing is generating a ‘cryptographic key pair’, composed of a private key (which only the user knows) and a public key (which is known to anyone).

When signing a message with a private key, it can be verified by using the matching public key. Bob’s new Bitcoin address represents a unique public key, and the corresponding private key is stored in his wallet. The public key allows anyone to verify that a message signed with the private key is valid.

Submitting a Payment

Alice’s wallet holds the private keys to each of her addresses. She tells her Bitcoin client that she’d like to transfer BTC to Bob’s address. The Bitcoin client then signs her transaction request with the private key of the address she is transferring bitcoins from. Anyone on the network can now use the public key to verify that the transaction request is actually coming from the legitimate account owner.

In other words:

The public key is used to receive bitcoins.

The private key is used to sign transactions to spend those bitcoins.

When spending bitcoins, the current owner presents their public key and digital signature in a Bitcoin transaction. The transaction is digitally signed by a private key, which indicates the authorisation to spend the funds referenced by the transaction.

With the public key and the digital signature, everyone in the Bitcoin network can verify and accept the transaction as valid, confirming that the person transferring the bitcoins had owned them at the time of the transfer.

How Miners Make Money: Miner Awards for Verifying Transactions

Assume Gary, Glenn, and George are Bitcoin miners. Their computers bundle the transactions of the past 10 minutes into a new transaction block. Each block includes a ‘coinbase’ transaction that pays out 50 bitcoins to the winning miner — in this case, Gary. A new address is created in Gary’s wallet with the balance of newly minted bitcoins.

Additionally, miners are awarded the fees paid by users sending transactions. The fee is an incentive for the miner to include the transaction in their block.

What is Bitcoin halving and how does it affect mining rewards? Find out here.

Transaction Sequence

  • The transaction is broadcast on the Bitcoin network, where each participant validates and propagates the transaction until it reaches almost every node in the network.
  • The transaction is verified by a mining node and included in a block of transactions that is recorded on the blockchain.
  • Once recorded on the blockchain and confirmed by sufficient subsequent blocks, the transaction becomes a permanent part of the Bitcoin open-distributed ledger and is accepted as valid by all participants.
  • The bitcoins received by the new owner as a part of the transaction can then be spent in a new transaction.

How Fast Are Bitcoin Transactions per Second?

Now, how long does all of this take?

Bitcoin manages an average transaction throughput of seven transactions per second (tps), which comes out to 420 Bitcoin transactions per minute; 25,200 transactions per hour; and over 600,000 Bitcoin transactions per day. While this may sound like a lot, it is still low compared to more established transaction systems like Visa, which can handle thousands of tps.

Encoding Information in a Block: Cryptographic Hashes

It is the cryptographic encoding that makes blockchain so secure, where cryptographic hash functions transform a collection of data into an alphanumeric string with a fixed length, called a hash value. 

Even tiny changes in the original data will drastically change the resulting hash value. It’s essentially impossible to predict which initial data set will create a specific hash value.

For example:

Cryptographic hashes

Nonces

To create different hash values from the same data, Bitcoin uses nonces. Changing the nonce results in a widely different hash value.

Cryptographic Hashes Noncesjun29

The mining computers calculate new hash values based on a combination of the previous hash value, the new transaction block, and a nonce. Creating hashes is computationally trivial, but the Bitcoin system requires the new hash value to have a particular form — specifically, it must start with a certain number of zeros.

The miners have no way to predict which nonce will produce a hash value with the required number of leading zeros. So they are forced to generate many hashes with different nonces until they happen upon the one that works.

But Where Is Alice’s Unconfirmed Transaction in the Nonce?

In the meantime, Alice’s transfer to Bob gets buried beneath other, more recent transactions. While it is not written into the blockchain yet, it is already queued up to be confirmed and this information can not be altered anymore. For anyone to modify the details, they would need to redo the work that Gary did — as any changes would require a completely different winning nonce — and then redo the work of all the subsequent miners, which is nearly impossible.

Unspent Transaction Output (UTXO)

Before introducing unspent transaction outputs (UTXOs), we need to know the input and output of Bitcoin transactions.

Input

An input is a reference to an output from a previous transaction. All of the new transaction’s input values (the total coin value of the previous outputs referenced by the new transaction’s inputs) are added up, and the total (less any transaction fee) is completely used by the outputs of the new transaction.

Often, a transaction includes multiple inputs.

Output

An output contains instructions for sending bitcoins. A transaction output includes the value that this output will be worth when claimed.

Unspent Transaction Output (UTXO)

Because each output of a particular transaction can only be spent once, the outputs of all transactions included in the blockchain can be categorised as either unspent transaction outputs (UTXOs) or spent transaction outputs. For a payment to be valid, it must only use UTXOs as inputs.

Unspent Transaction Outputjun29

The figure above shows the main parts of a Bitcoin transaction. Each transaction has at least one input and one output, and each input spends the satoshis paid to a previous output. Each output then waits as a UTXO until a later input spends it. When a user’s Bitcoin wallet indicates a balance of 10,000 satoshis, it actually means they have 10,000 satoshis waiting in one or more UTXOs.

UTXO During Transactions

Imagine someone used the address 1HULMwZEPkjEPech43BeKJL1ybLCWrfDpN to receive bitcoins twice before. The transaction on 5 February 2019 contains 4,000 satoshis, and the transaction on 9 March 2019 contains 6,000 satoshis. Bitcoin’s blockchain will not help them add up the balance such that there exists a record with 1HULMwZEPkjEPech43BeKJL1ybLCWrfDpN: 10,000. Instead, every time a user wants to spend their bitcoins, they must unlock those transactions that belong to them (with bitcoins sent to their public key) one by one.

For example, to send 3,000 satoshis, one need only to unlock either the transaction dated 5 February 2019 or the transaction dated 9 March 2019 since both of them contain larger than 3,000 satoshis. 

But to send 8,000 satoshis, both transactions need to be unlocked to spend all the bitcoins in a new transaction since partial spending is not allowed; the user must use all bitcoins they have unlocked. If they intended to send only 8,000 satoshis, they still need to spend 10,000 satoshis in the new transaction, then send 2,000 satoshis back to an address that belongs to them.

Get an introduction to Bitcoin trading in this article.

Final Words — Paying With Bitcoin

While Bitcoin transactions work seamlessly, real-life retail payments with BTC are still hampered by slow transaction speeds. Yet, making actual payments with Bitcoin is one of the key functionalities of BTC that Satoshi Nakamoto envisioned in the Bitcoin white paper. Bitcoin’s Layer-2, termed the Lightning Network, currently provides a solution to this scalability problem. 

Read more about making near-instant payments with Bitcoin through the Lightning Network.

Due Diligence and Do Your Own Research

All examples listed in this article are for informational purposes only. You should not construe any such information or other material as legal, tax, investment, financial, or other advice. Nothing contained herein shall constitute a solicitation, recommendation, endorsement, or offer by Crypto.com to invest, buy, or sell any digital assets. Returns on the buying and selling of digital assets may be subject to tax, including capital gains tax and/or income tax, in your jurisdiction or the jurisdictions in which you are a resident for tax purposes. Any descriptions of Crypto.com products or features are merely for illustrative purposes and do not constitute an endorsement, invitation, or solicitation.

Past performance is not a guarantee or predictor of future performance. The value of digital assets can increase or decrease, and you could lose all or a substantial amount of your purchase price. When assessing a digital asset, it’s essential for you to do your own research and due diligence to make the best possible judgement, as any purchases shall be your sole responsibility.

Share with Friends

Ready to start your crypto journey?

Get your step-by-step guide to setting up
an account with Crypto.com

By clicking the Submit button you acknowledge having read the Privacy Notice of Crypto.com where we explain how we use and protect your personal data.

Crypto.com Mobile App