How Bitcoin Transactions Work

This article will give you an in-depth yet easy to understand explanation of what bitcoin transactions are. The explanation below is suitable for new and intermediate bitcoin users.

If you’re a cryptocurrency user, familiarizing yourself with the way a transaction works is a pretty good idea. Having a better understanding of how everything works can only be beneficial for you, not to mention that some concepts like multi-signature transactions and contracts will be easier to grasp if you first learn how a standard bitcoin transaction works, which are the transactions we usually make.

It’s worth noting that even the core developers consider that the language used to describe how transactions and their components work can often lead to an inaccurate explanation of what’s really going on. In this article, we’ll avoid those misconceptions.



Before starting we’ll give a small definition to some of the terms used in the article:

Bitcoin: when written with a capital “B” it refers to the protocol used by the currency

bitcoin: this refers to the currency itself, which we send and receive through the Bitcoin network

Tx: It’s the abbreviated term for a Bitcoin transaction

Txid: Is the ID of that transaction, this is used both by humans and the protocol when referring to transactions.

Script: is the Bitcoin protocol’s scripting system, what this does is validate every transaction made. This is a stack-based instruction engine that makes the transactions possible, no matter how easy or complex it is.

UTXO: is the abbreviated term used for Unspent Transaction Output.

Satoshi: is the subunit of bitcoin, meaning 1BTC = 100,000,000 satoshi.

What is a Bitcoin transaction and what is its purpose?

Bitcoin transactions are defined as signed pieces of data. These pieces are broadcasted to the network in order to verify their validity and if they are legitimate, they end up inside a block in the blockchain.


What’s its purpose?

The point of a Bitcoin transaction is transferring ownership of a certain amount of bitcoin to a Bitcoin address.

The outcome

When bitcoin is sent, your wallet client creates a data structure, which is the Bitcoin transaction. Then, this piece of data is broadcast to the network. After this, the transaction is relayed by the Bitcoin nodes on the network and then the network broadcasts this transaction again, if it’s valid, the nodes add it to the block that’s being mined. Within 10 to 20 minutes, this transaction, along with many others is included in a block in the blockchain. At this point whoever is receiving the transaction will be able to see it in their wallet.

BitCoin transaction

The inputs and outputs of a transaction

BitCoin input and output

There are 4 facts you need to know about transactions:


  • Bitcoins are always sent to an address, no matter the amount
  • Every bitcoin we receive is locked to the receiving address, usually associated with our wallet
  • Any amount of bitcoin we spend always comes from funds we currently have in our wallet
  • An address receives bitcoin, it does not send them. Bitcoins are sent from a wallet.

Different to a physical wallet, every amount received is separate. Here’s a quick example:

You own a wallet and you eventually receive three different amounts of bitcoin sent, the first of 0.01, second of 0.2 and the third 3BTC, meaning you’d have a balance of 3.21 BTC. However, if you take a look inside your wallet you can see that your balance isn’t exactly shown as 321,000,000 satoshi. Instead, there are three distinct amounts grouped together by their originating transactions.

What this means is that the different bitcoin amounts received never mix, they remain separated as the exact amounts sent to the wallet. These amounts given in the example above are called outputs of their originating transactions.

Bitcoin wallets will always keep these outputs separate and distinct from each other.

What exactly is an output?

Output is considered any amount sent via a standard transaction to a Bitcoin address, with a set of rules attached in order to unlock the output amount. This is also referred as “unspent transaction output” or UTXO.

Standard transaction outputs are unlocked with the private key that is associated with the address receiving the amount. Public and private keys that go along with addresses are an entirely different subject, which we’ll cover in another opportunity. Currently, our only concern is the output amount, so let’s throw in another example:

Bitcoin Wallet

Your wallet now has the previously mentioned balance of 3.21 BTC or 321,000,000 satoshi, and you want to send 15,000,000 satoshi to John, what candidate out of all three outputs would the wallet choose?

As previously mentioned, the wallet does not withdraw 15 million satoshi at random, since the amounts aren’t mixed together. Instead, what the wallet does is pick between one of the three outputs available. As you could guess, the wallet obviously goes for the 0.2 BTC output. Then, the wallet unlocks the output and uses the entire amount of 0.2 BTC as an input to the new 0.15 BTC transaction, meaning that the 0.2 BTC output is “spent” during this process.

Reading this paragraph a couple times is a good idea.

The wallet creates a transaction that sends 0.15 BTC to John, meaning that the balance will now reside in his wallet as an output. The residing 0.5 BTC is then sent back to your wallet through a new address, this is called “change”, and it will now be in your wallet as a new output.

To put it shortly, spending BTC consumes UTXOs and creates new ones, when you sent 0.15 BTC to John, the 0.2 BTC output is destroyed, and in result a new output is made of 0.05 BTC that you receive back in your wallet.

These three outputs in the wallet that are waiting to be spent are locked to their receiving addresses until one or more of them are selected as inputs for a new transaction.

While the focus here has been explaining that every amount received is separate and distinct, it’s also worth noting that the logic rules applied by wallet clients can vary when selecting UTXOs as inputs. The optimal policy would be to use older UTXOs first, but the truth is these implementations differ from wallet to wallet.

Quick summary

Amounts received never mix unlike a physical wallet. Instead, UTXOs are used individually or in groups when we’re spending bitcoin. The wallet selects UTXOs according the amount that is going to be sent, creating two new outputs: one for the receiver and one for the sender in the form of change. This in turn creates a new UTXO in our wallet, and the amount sent becomes locked to the address of the receiver. The original input used for the transaction is considered “spent” and is destroyed.

Sponsored Links