How do Bitcoin Transactions Work?

Bitcoin transactions are sent back and forth via bitcoin wallets. These transactions are digitally signed for security. Everyone on the network knows about a transaction, and the history of each transaction can be traced back to the point where the bitcoins were produced.

Holding onto bitcoins is great if you’re a constant watcher and you’re waiting for the price to increase. Yet, there will come a time when you will want to spend it. So let’s discuss how bitcoin transactions work.

There are no physical bitcoins, only records of bitcoin transactions

It’s not like pulling cash out of your wallet – bitcoins don’t actually exist anywhere, even on a hard drive. We constantly reference someone having bitcoins, but when you look at a particular bitcoin address, there are no digital bitcoins held in it. You cannot point to a physical object, or even a digital file, and say “this is a bitcoin”.

Instead you will find records of transactions between different addresses, with balances that increase and decrease. Every transaction that ever took place is stored in a vast public ledger called the block chain. If you want to work out the balance of any bitcoin address, the information isn’t held at that address; but you can reconstruct it by looking at the blockchain.

What does a transaction look like?

If Mary sends Micahel some bitcoins, that transaction contains three pieces of information:

  • An input. This is a record of which bitcoin address was used to send the bitcoins to Mary in the first place (she received them from her friend, Cindy).
  • An amount. This is the amount of bitcoins that Mary is sending to Michael.
  • An output. This is Michalel’s bitcoin address.

How is it sent?

You only need two things to send bitcoins: a bitcoin address and a private key. A randomly generated bitcoin address is just a sequence of letters and numbers. This is publicly viewed and available. The private key is another sequence of letters and numbers, but unlike your bitcoin address, this is kept secret.

Think of your bitcoin address as a safe deposit box with a glass front. Everyone knows what is in it, but only the private key can unlock it to take things out or put things in.

When Mary wants to send bitcoins to Michael, she uses her private key to sign a message with the input (the source transaction(s) of the coins), amount, and output (Michael’s address).

She then sends them from her bitcoin wallet out to the wider bitcoin network. From there, bitcoin miners verify the transaction, putting it into a transaction block and solve it.

Why must I sometimes wait for my transaction to clear?

Miners have to finish mining before your transaction can be verified. This usually takes about 10 minutes..

Some merchants may make you wait until this block has been confirmed. Not to worry – this still only takes a short while. Then you can enjoy your download or service you just paid for.

Even then there are merchants who won’t make you wait for confirmation.

 

What if the input and output amounts don’t match?

Because bitcoins exist only as records of transactions, you can end up with many different transactions tied to a particular bitcoin address. Perhaps Sally sent Mary four bitcoins, Joseph sent her five bitcoins and Cindy sent her a single bitcoin, all as separate transactions at separate times.

These are not combined and will always exist as different transaction records.

When Mary wants to send bitcoins to Michael, her wallet will try to use transaction records with different amounts that add up to the number of bitcoins that she wants to send.

The chances are that when Mary wants to send bitcoins to Michael, she won’t have exactly the right number of bitcoins from other transactions. Perhaps she only wants to send 3.5 BTC to Michael.

None of the transactions that she has in her bitcoin address are for that amount, and none of them add up to that amount when combined. Transactions can’t be split into smaller amounts.  You can only spend the whole output of a transaction.

Instead, she will have to send one of the incoming transactions, and then the rest of the bitcoins will be returned to her as change.

Mary sends the four bitcoins that she got from Sally to Michael. Sally is the input, and Michael is the output. But the amount is only 3.5 BTC, because that is all she wants to send. So, her wallet automatically creates two outputs for her transaction: 3.5 BTC to Michael, and 0.5 BTC to a new address, which it created for Mary to hold her change from Michael.

Are there any transaction fees?

There are times you will find transaction fees – but not always.

Transaction fees are calculated using various factors. Some wallets let you set transaction fees manually. Any portion of a transaction that isn’t picked up by the recipient or returned as change is considered a fee. This then goes to the miner who has solved the transaction block as a bonus.

Currently you will find many miners who process transactions for no fees. But I can see when the block reward for bitcoins decreases, the freebies will go away.

 

What if I only want to send part of a bitcoin?

Bitcoin transactions are divisible. A satoshi is one hundred millionth of a bitcoin, and it is possible to send a transaction as small as 5430 satoshis on the bitcoin network.

Leave a Reply

Your email address will not be published. Required fields are marked *