How Bitcoin Transactions Work

Bitcoin was created to function as peer-to-peer electronic cash. Whether you are spending or accepting bitcoin as payment it is prudent to understand how a transaction works.

Bitcoin transactions are messages, like email, which are digitally signed using cryptography and sent to the entire Bitcoin Network for verification. Transactions are public and can be found on the digital ledger known as the blockchain. The history of each and every bitcoin transaction leads back to the point where the bitcoins were first produced.

Bitcoins Exist as Records of Bitcoin Transactions

We define a [bitcoin] as a chain of digital signatures. Each owner transfers [bitcoin] to the
next by digitally signing a hash of the previous transaction and the public key of the next owner
and adding these to the end of the coin. A payee can verify the signatures to verify the chain of
ownership.

It’s worth mentioning here that Bitcoins do not “exist” per se. That’s right! Those BTC in your wallet do not explicitly exist the way cash, coins, or even stocks do. There are no physical bitcoins anywhere—not on a hard-drive, or a spreadsheet, or a bank account, and not even a server somewhere.

Think of the blockchain as a record of the transactions between various bitcoin addresses. These transaction records are updated by the Bitcoin network and shared across each of its nodes as balances increase and decrease. You can even use one of our Bitcoin.com tools if you want to see the history as well as current balance of any given bitcoin address.

Simply enter a bitcoin address to explore its entire history.

A Sample Bitcoin Transaction

Mark wants to send some bitcoin to Jessica. Essentially, a bitcoin transaction is comprised of three parts:

An input: This is a record of the bitcoin address from which Mark initially received the bitcoin he wants to send to Jessica.An amount: This is the specific amount of BTC Mark wants to send Jessica.An output: This is Jessica’s public key; also known as her ‘bitcoin address’

How Does a Bitcoin Transaction Work?

Sending bitcoin requires having access to the public and private keys associated with that amount of bitcoin.

Image: Bitcoin: A Peer-to-Peer Electronic Cash System by S. Nakamoto

When we talk about someone “having bitcoins” what we actually mean is that person has access to a key-pair comprised of:

a public key to which some amount bitcoin was previously sent

the corresponding unique private key which authorizes the BTC previously sent to the above pub-key to be sent elsewhere

Public keys, also called a bitcoin addresses, are random sequences of letters and numbers that function similarly to an email address or a social-media site username. They are public so you are safe sharing it with others. In fact, you must give your bitcoin address to others whenever you want them to send you BTC.

The private key is another sequence of letters and numbers. However, private keys—like passwords to email or other accounts, are to be kept secret. Never share your private key with anyone that you do not 100% trust to not steal from you, ever. Also, remember to backup private keys with pen and paper and store them somewhere safe.

Your bitcoin address is basically a transparent safe. Others can see what’s inside but only those with the private key can unlock the safe to access the funds within.

In our example transaction above, Mark wants to send some bitcoin to Jessica. To do this, he uses his private key to sign a message with the transaction-specific details. This message is then sent to the blockchain and contains an:

input: the source transaction of the coins previously sent to Mark’s address

amount: some amount of BTC to be sent from Mark to Jessica

output: Jessica’s public address.

This transaction is then broadcast to the bitcoin network where miners verify that Mark’s keys are able to access the inputs (i.e. the address(s) from where he previously received BTC) he claims to control. This confirmation process is known as mining because it requires resource-intensive computational labor and rewards miners, in BTC, per block solved. This is also the process by which new Bitcoins are ‘created’.

Why Do Some Bitcoin Transaction Confirmations Take So Long?

All bitcoin transactions must be verified by miners on the blockchain. Note, miners do not mine transactions; they mine blocks which are collections of transactions. Sometimes your transaction gets left out of the current block and gets put on hold until the next one is assembled. The bitcoin protocol dynamically adjusts requirements to have each block take approximately 10 minutes to mine.

Another reason for long confirmation times is that blocks are limited to 1MB by the current bitcoin protocol. This arbitrary limit can be increased but for the present it limits the amount of transactions that may enter a block which effectively slows down confirmation times and by extension, the entire bitcoin network.

More About Bitcoin Transaction Inputs and Outputs

Although it would be possible to handle coins individually, it would be unwieldy to make a
separate transaction for every cent in a transfer. To allow value to be split and combined,
transactions contain multiple inputs and outputs. Normally there will be either a single input
from a larger previous transaction or multiple inputs combining smaller amounts, and at most two outputs: one for the payment, and one returning the change, if any, back to the sender

Remember how bitcoins only ‘exist’ as records of transactions on the blockchain? This means that sometimes multiple transactions end up being pinned to a particular bitcoin address.

Let’s say you have 2 BTC in your wallet. These 2 BTC came from four different friends who each sent you .5 BTC for your birthday. For convenience, your wallet interface will display your holdings as, “2 BTC”. But, your wallet did not ‘add up’ each of those .5 BTC inputs into 2 BTC within your wallet. Rather, your wallet just keeps track of the four .5 BTC transactions separately, which total 2 BTC.

When you want to buy something with bitcoin your wallet uses transaction records of varying amounts that add up to the amount of bitcoin you wish to spend.

Suppose that number is .25 BTC and you want to use it to buy clothes from a merchant. Based of the info above about your holdings, we know you don’t have a single input with exactly .25 BTC. Bitcoin users cannot split a transaction into smaller amounts and only the entire output of a transaction can be spent.

So, when you open your wallet and type, “.25” in the amount field what technically happens is that one of the .5 BTC transactions (from your generous friend, Chris) will be sent, in its entirety. The difference is then returned via a new transaction. Here is the technical process broken down:

The amount owed for your clothing is .25 BTC

You ‘send’ the .5 BTC input to the store. (Remember, inputs must be spent in their entirety).

The clothing store’s bitcoin address is the output

But, your wallet actually creates two outputs for this transaction:

.25 BTC to the clothing merchant

.25 BTC to a new address created by your wallet to receive the ‘change’ from the merchant.

This might seem confusing— the good news is that knowing this stuff is not required to send or receive bitcoin.

How Much Are Bitcoin Transaction Fees?

Bitcoin transaction fees are calculated using a variety of factors. Many wallets allow users to manually set transaction fees. Any portion of a transaction that isn’t owed to the recipient or returned as ‘change’ is included as a fee. Fees go to miners and can be used to increase speed on confirmation by incentivizing miners to prioritize your transaction(s).

Why Did I Learn This Stuff?!

The relation between transactions, miners, and blocks is a fundamental aspect of the Bitcoin protocol. It is important to understand the basics of sending and receiving Bitcoin so that things like confirmation time and fees make sense.

Enthusiast and Supporter of the Blockchain Technology. Studied at Economic Science in Qafqaz University & MBA in Azerbaijan State Economic University, had experience in banking sector. Now businessman and investor.

POPULAR CATEGORY

We believe that Bitcoin and Blockchain technology is a breakthrough of a modern life. At liveBitnews.com we publish news about Bitcoin and other cryptocurrencyies. If you want to join our team and publish your own articles just contact us by email.