Tuesday, October 27, 2020
Home News Crypto Bitcoin transactions explained

Bitcoin transactions explained

Article #3 in a Series of 5
This article was last updated on January 13, 2020

-

(Financial News) In my previous 2 articles on Bitcoin, I gave a generalized background on Bitcoin as well as an explanation as to why Bitcoin was created in the first place. In today’s article I want to share with you more about Bitcoin transactions and how they actually work.

If you have not yet read my previous pieces, and you don’t have a good understanding of blockchain tech, maybe it is a good idea to check out those pieces first as I lay the initial groundwork there on blockchains and Bitcoins background.

This is article Number 3 in a series of 5 on Bitcoin, see below my previous 2 articles

  1. Bitcoin – What is Bitcoin?
  2. Bitcoin – Who invented it and more importantly why?

Before we get started with how a bitcoin transaction works, let us first outline the various components of a bitcoin transaction:

Definitions of the individual components of a Bitcoin Transaction

  1. Bitcoin Wallet – As the name suggests, it is a virtual wallet used to store Bitcoins. This is comparable to the wallet one might hold cash and credit cards in except that the user does not actually store the the wallet with him or her, instead the Bitcoin wallet is stored publicly on the blockchain and everyone has the ability to view anyone else’s Bitcoin wallet. Though the Bitcoin wallet is publicly stored on the blockchain, the Bitcoins stored in each wallet are only accessible to spend by use of the private key belonging to that particular Bitcoin wallet, which is to be held and protected by the owner of the Bitcoin Wallet. Depending on the type, a bitcoin wallet can have have many bitcoin addresses that are all mathematically related and share a private key.
  2. Bitcoin Private Key – A private key as it relates to Bitcoin can be thought of as an extremely long password that is mathematically linked to a Bitcoin wallet. There can be one or more private keys to a Bitcoin wallet depending on the type of wallet. The private key is what authorizes someone to spend Bitcoins on the blockchain. This is the only way to access Bitcoins in a particular wallet and move them to another wallet. Without this private key the bitcoins are not spendable. Since Bitcoin private keys are mathematically linked to a Bitcoin address, it is not possible to change your private key, and because of this, it is very important that this private key is protected at all times. A Bitcoin private key is a 256 bit number. In its most human usable form, a Bitcoin private key is expressed as a 32 byte string which is 64 characters in length using 0-9 and A-F. Think of your Bitcoin private key as your extremely long and complicated PIN code to your bank card, without that PIN code the cash is safe.
  3. Bitcoin Public Key – A Bitcoin public key, for the purposes of bitcoin, is similar to a bank account number in banking. You can give it away to people so that they can send you Bitcoins, but it will not help them access your coins anymore than just your bank account number will give a thief access to your cash. A Bitcoin public key is derived from the Private key. It would stand to reason that if you have the public key, it would be easy to derive the private key. This is not the case. In traditional reasoning one thinks that if we have 25 + x = 101, solving for x just means 101-25 = x and therefore x = 76. The same does NOT hold true for asymmetrical encryption such as Bitcoin. This is called trap door mathematics and allows only one way functions of problems, anything to reverse engineer a private key would require only a brute force attack and with literally approximately as many bitoin private key combinations as there are atoms in the known universe.
  4. Bitcoin Hash – A unique function that takes inputs strings of various lengths and converts them into a fixed length string. As it relates to Bitcoin, the hashing algorithm is Secure Hashing Algorithm 256 Bit (SHA 256). This means that the hash that is returned on any input going into SHA 256, whether 1 bit in length or 1 billion bits in length will always return a 256 Bit output.
  5. Blockchain – As it relates to Bitcoin, a blockchain is a network of peer-to-peer (P2P) computers linked together that are recording bitcoin transactions and forming the backbone to the Bitcoin transaction network. It is important to note that there is no centralized authority in the Bitcoin blockchain and all transactions are authenticated by consensus of the network as a whole.
  6. Node – an individual computer or dedicated server which runs the Bicoin software. The sum of all nodes make up the Bitcoin blockchain. Nodes serve the purpose of securing the network and the total sum of all nodes is considered to be the Bitcoin blockchain. Nodes serve the purpose of validating transactions and forming new blocks in the blockchain. They are also constantly broadcasting received transactions to other nodes. This allows all nodes to have all transactions in the blockchain.
  7. Block – A group of immutable transactions within the blockchain that is created by Bitcoin miners who have validated the transactions on the Bitcoin network. To make Bitcoin’s blockchain immutable, each block is encoded with a hash of the previous block. This makes it computationally improbable that anyone would be able to change a single block, as it would require changing every single block before it.
  8. Mempool – Mempool is the equivalent to a “waiting area” for validated transactions that a node has deemed valid. Each node on the blockchain will have its own mempool and will gather transactions from the its mempool to form a block. Whichever node on the blockchain solves the nonce first, it is awarded the next block reward as well as the right to publish that block.
  9. Nonce – The word actually comes from a Combination of 2 words – Number + Once = N + Once = nonce. What this exactly means in the context of Bitcoin transactions is that we are are an arbitrary number that is constantly replaced in the Bitcoin block header. This is the only number that can be changed by the miner in the block creation process to complete the mathematical puzzle to get the right to add the next block to the blockchain. The nonce can be thought of as a relatively easy to break private key, and Bitcoin miners are constantly competing to solve for the nonce by racing to completely billions of possibilities to find the one to fit their block. The first one to find what is called the “golden nonce” will be able to add the next block to the blockchain and get the mining fees for the transactions as well as the block reward.

Bitcoin Wallet

Let us start off with the wallet. As you see from the definition above, a Bitcoin wallet is a virtual wallet used to store Bitcoins. And this wallet is a crucial component of everything in Bitcoin, as a bitcoin must always be in a wallet.

Bitcoin wallets can fall into multiple categories including; Desktop Wallet, Mobile Wallet, Paper Wallet (Cold Storage), Hardware Wallet (Cold Storage) and Web Wallets (Hot Storage).

Unlike the fiat money in your physical leather wallet, you cannot take your bitcoins out of the wallet without putting them in another wallet, you cannot leave them on the coffee table, or drop them on the sidewalk. With cryptocurrencies, the Bitcoin is always in a wallet from moment it is minted, the transactions just move them from wallet to wallet.

Bitcoin has no centralized Authority

As you probably already know, Bitcoin (and most cryptocurrencies for that matter) operate under a peer-to-peer (P2P) protocol. Simply put this means that there is no centralized server or network that participants are using to send and validate transactions.


Want to learn more about Bitcoin? Check out our other articles on Bitcoin

Let us assume that I am sending a Bitcoin transaction to my friend as a birthday gift. From my side I would need just one piece of information, his Bitcoin address. With just that piece of information I am able to send him a Bitcoin transaction, he must do nothing to validate or accept it. Furthermore, there is no other third-party that must validate this transaction.

Bitcoin transactions are a one way street

However, just for clarity, this is a one way street, just because someone knows your Bitcoin address does NOT mean they can withdraw your Bitcoin (we will get to this in just a moment).

Using trap door (one way) mathematics, transactions are validated in a computationally efficient manner, however to attempt to reverse the transaction requires exponentially more time, energy and resources to the point that it becomes almost impossible to do.

Now back to my transaction sending my buddy Bitcoins for for his birthday present. Once he provides me his address that is all that is required of him. With that single piece of information I am able to send him a Bitcoin transaction.

Let us assume that I am sending him .001 bitcoin . What I do is I simply input the his Bitcoin Address and the amount, 0.001 BTC into my Bitcoin wallet. The process then is very simple.

The process of sending Bitcoin varies depending on wallet type

The process of actually sending BTC could vary depending on how you are sending the Bitcoin, there are many types of Bitcoin wallets including; Hardware Wallets, Desktop Wallets, Mobile Wallets, Paper Wallets and Web Wallets (Cold Wallets).

Since the processes vary drastically depending on which wallet you are using, I am simply going to demonstrate a high overview of the transaction and what happens at each level, and sometimes the processes for actually executing a bitcoin transaction could vary depending on which of the 5 Bitcoin wallet types you are using.

Though the process and user input might vary wildly the validation of a bitcoin transaction (Signing) is mechanically the same on all of the wallet types.

So in a nutshell what happens is outlined below in the 8 items below (don’t worry I will elaborate in more detail below)

  1. I input the receiver’s Bitcoin Address and the amount of Bitcoin that I am sending. Some wallets also allow you to add the mining fee, and some wallets do this automatically for you, just depends on the software.
  2. Upon inputting the 3 above items I am then required to digitally sign the bitcoin transaction with my private key from above. Again, the method of doing this will vary depending on the type of bitcoin wallet.
  3. Once I sign the digital transaction, an output is created which is a 256 bit hash of all the input data.
  4. This 256 bit hash is broadcast to the bitcoin blockchain
  5. Nodes verify that the transaction was signed by a valid private key and that balance was sufficient to spend the balance that was sent.
  6. My transaction goes into the mempool.
  7. Miners competing for the next block, one of these will be awarded the next block by solving the golden nonce, this miner will decide which transactions to include from mempool. Usually this is done based on fees, since there is limited block space, the higher fees tend to go first in Bitcoin transactions.
  8. Once a miner includes my transaction in a block it is considered “confirmed”

Step 1. Input transaction data to the Bitcoin wallet

The very first step in handling a bitcoin transaction is making sure that you are inputting all the relevant transaction into the Bitcoin wallet. Typically this is as follows:

  1. Bitcoin Address of recipient
  2. Amount of Bitcoins you are sending
  3. The transaction fee you are paying the miner to include the transaction in the next block. Some wallets calculate this fee for you automatically and some you can input this number on your own.

Step 2. Digitally sign the Bitcoin transaction with your private key

Much the same way you need to put in your PIN code to take out money from your bank account with your debit card, in order to send someone Bitcoin you must digitally sign the transaction to authenticate that you are indeed the owner of the bitcoin you are broadcasting to the network.

Step 3. Upon signing the Bitcoin transaction a 256 bit hash is created

Bitcoin transactions are signed with the private key, and verified with the public key.

If you remember from the hashing definition above, when I digitally sign the Bitcoin transaction, all of the data in the transaction is processed by the SHA 256 algorithm. This algorithm encodes all the bitcoin transaction data into a single 256 bit hash. Remember no matter how long or short the transaction data is, the output will always be 256 bits.

Step 4. The 256 bit hash of the Bitcoin transaction is broadcast to the Bitcoin blockchain network

Your hashed transaction is broadcast to the Bitcoin network of nodes making up the blockchain. The node sees several pieces of information about the sender communicating the hash. The transaction is broadcast to all nodes on the blockchain spreading like a virus to the entire bitcoin network.

  1. The public key of the sender
  2. The balance of coins of the sender
  3. The time stamp of the message
  4. The hashed message of the transaction

Step 5. The Hash and BTC balance is validated by bitcoin nodes

Miners start then individually verify each transaction as either valid or invalid checking several components. First the check that the hash is valid, they are able to do this because they see your public key and use this to authenticate the message, if it works and the node is able to verify that it is your private key that sent the transaction and you had enough funds to send the transaction your transaction has been validated.

Step 6. My validated transaction goes into mempool

Each bitcoin node maintains its own mempool. Once my transaction has been validated by individual nodes, then the transaction is waiting for in a queue to get into the next block. Some nodes will have my transactions in mempool and some won’t, it just depends on each individual bitcoin node whether they will have enough memory to story your transaction in mempool or ignore it. Typically speaking, when the bitcoin network is not too busy the mempool is more similar across all nodes then at peak times, when pending transactions could be taking up valuable real estate in this virtual waiting room.

Step 7. Bitcoin nodes compete for the next block

From mempool the bitcoin nodes gather transactions to package into a new block of a transactions to form the next block. They gather this data, package into a block of data (not yet a blockchain block), and start trying to find the Golden Nonce in bitcoin which meets the minimum criteria of the cryptographic puzzle.

Step 8. Confirmation of my Bitcoin transaction

Once a node finds a golden nonce satisfying the minimum requirements, he will have the right to publish his results to the next block. If my transaction was included in this block then it will be confirmed, if it was not included in the block it will stay in mempool until such time that it is included into a block.

It is important to note, that block space is limited within the block. There is room for approximately 2,400 Bitcoin transactions in a single block. During very busy times there can be tens of thousands of transactions waiting in mempool. So if a transaction is important and you don’t want it waiting around, it is good to make sure you structure your transaction fee to be competitive among the rest of the transactions.

As blocks fill up and space in the block gets more competitive, transactions get more expensive as users compete for limited space in a block.

Transaction fees are the primary determining factor in priority of being pulled from the mempool into a block. So keep this in mind when sending your bitcoins.

So in a nutshell that wraps up the nuts and bolts of how Bitcoin transaction works in normal english without using words that would make either of our heads explode. Stay tuned for my next piece on Bitcoin private key.

NOTE: If there are any corrections here needed or I didn’t get something quite right, please drop a comment below and let me know. Please include source material and I will be really grateful.

Adrian Thomas
Adrian is a serial writer and entrepreneur. He is responsible for overall editorial direction and vision of Financial News where he is the Editor-in-chief. When he is not busy wearing the writer/editor/entrepreneur hat, he can be found spending time with his 8 amazing kids. Adrian is involved in multiple ventures including several cryptocurrency related projects which are in various stages of development.

Crypto Prices

Twittersphere