top of page

How does Bitcoin work?

Bitcoin is a digital currency concept put forward by the legendary and enigmatic Satoshi Nakamoto in 2009, using blockchain technology as an infrastructure and working as anti-central person-to-person. The Whitepaper explaining this concept and written by Nakamoto is a must-read for anyone who wants to understand bitcoin and cryptocurrencies in general. This wihtepaper not only explains bitcoin as a concept, but also explains how the Byzantine fault tolerance system could work in a decentralized environment.

First of all, the person who is interested in Bitcoin should know that the biggest factor underlying the real life of the bitcoin concept is the blockchain technology and understand how this technology works.

What is blockchain?

Blockchain is a chain of blocks, each of which contains data values, and is not overseen or managed by any central authority. These information chains are cryptographically secured and cannot be silenced thanks to their decentralized structure. Blockchain basically uses two data structures: Pointers and Linked Lists.


Pointers are variables that indicate where another variable is in them. Under normal circumstances, variables in programming contain data. (In the example of int a = 10, an integer variable a has a value of 10.) Pointers, on the other hand, point to the location of the variable holding that data instead of keeping a value as data.

Linked Lists

Linked lists are one of the most important units in data structures and roughly look like this.

A sequence of blocks, each of which contains a specific data and is linked to the next block by means of a pointer. The pointer variable contains the address of the next node and thus provides the connection. As we saw at the end node, the end pointer does not contain any data.

The important point here is that each pointer contains the address of the next block. So where is the pointer to the first block? The first block is called the genesis block and its pointer is inside the system.

A hash pointer is a pointer that contains the hash of the preceding block.

Hash is a process that takes data of any length and produces a result of the same length, regardless of the content of the data, with a certain function. In the case of Bitcoin, the transfer process is taken as data and mixed with the SHA-256 algorithm to produce a fixed-length result. Regardless of the length of the entered data, the SHA-256 algorithm always produces a 256-bit long result.

Blockchain in its simplest form is a linked list as shown below.

A blockchain is a linked list in which each block contains a data and a hash pointer pointing to the block that precedes it. So, what is a hash pointer? Hash pointers are very similar to regular pointers, but instead of just containing the address information of the previous block, they also contain the hash result of the data in the previous block. This small difference in settings is what makes blockchain technology so secure.

Let's suppose for a moment that an attacker wants to attack block 3 and change the data in it. Due to the hash function, the smallest change in the data will be reflected in the result as an incredibly large difference. The smallest change to the data in block 3 will change the hash result stored in block 2, the change in block 2 will affect the hash result in block 1 so the whole chain will have to be changed which is impossible. This is the method that makes blockchains unsilencing.

What is Mining?

Mining is the process required to create new bitcoins. Bitcoin mining works on the principle of Proof of Work-POW. Simply put, solving a problem should be very difficult, but once you solve it, your solution should be very easily proven to be correct.

Let's try to understand why cryptocurrencies need such a system before Bitcoin comes to the use of POW as a concept.

Before Bitcoin, different digital currencies were created, but if an anticentral and person-to-person network is created in the digital environment, the biggest problem is the logic problem called the Byzantine Generals Problem. Since Nakamoto managed to overcome this problem in bitcoin with POW, bitcoin was able to start its life and continues strongly.

Byzantine Generals Problem

Let's continue by explaining the Byzantine Generals Problem, which is also frequently used in academic studies. Byzantine generals planning to attack the enemy city have two problems:

The generals are located very far from each other, so it is impossible to direct the siege by a central authority.

The enemy also has a strong army, so the attack must be carried out by the generals at the same time so that success can be achieved.

While the siege armies are surrounding the city, each of the armies transmits the order message from the army on the right to the army on the left, and communication is maintained in this way. But the problem here is that when an order comes in that we attack on Wednesday, an army may not be ready and send a message back to attack on Friday, no. Or the soldier carrying the message can be captured by the enemy or the content of the message he carries can be changed. In such an insecure environment, any attack will fail if full coordination is not achieved.

The same logic problem applies to blockchain networks, which are the infrastructure of cryptocurrencies such as bitcoin. These are incredibly large networks, and how can we trust every single person on the network? We may want to send someone 4 ether, but how do we trust that someone malicious won't make that amount 40 ether?

Satoshi Nakamoto managed to overcome this logic problem by introducing the proof-of-work protocol. Let's see how it works:

When the besieged army wants to convey the message "we are attacking on Monday" to the army on its left, it needs to follow these steps;

First, the original message is assigned a random but one-time generated value called “nonce”. Nonce can be any value in the hexadecimal number system.

Then, a result is obtained by passing the message text with nonce value assigned hash function. In the attack, which we consider imaginary, let's assume that the commanders choose to securely share the results of the hash function with zero first 5 digits with each other.

If the result of the hash function gives the desired ones, they forward the message to the next general. If the results do not match the desired ones, it is necessary to change the assigned nonce value randomly and repeat the process until you get a result with zero first five digits. This system requires incredibly long periods of computing power.

If the soldier carrying the message is captured or the message content is changed, the hash result will vary greatly due to the characteristics of the hash function. Reviewing the message, the generals will realize that the first five digits of the hash result are not zero and will withdraw the attack.

However, although it is very unlikely, each hash function may have conflicting results. In theory, when A and B are hash results as two separate inputs, H(A) and H(B) should result in no probability of H(A) = H(B), but in real life application, no hash function is completely collision-proof.

Well, in this low probability, what happens if the soldier carrying the message is captured, the message is changed, and an attack occurs that makes the hash result come out as the generals want? It would be a time-consuming process, of course, but it is not impossible. In contrast, generals use their numerical advantage.

This problem can be overcome by three generals sending messages to the left at the same time, instead of a single general sending the message from the right to the one on the left in turn. If the generals who create their own messages create a cumulative message, pass this message through the hash function, assign a nonce value to the result, and then put it into the hash function again, this time the first six digits of the result must be zero.

At this stage, it will be a serious waste of time to find the nonce value of this message and change the content of the message.

However, the task of the generals who receive the message is easy; they just need to add the nonce value given to them to the hash result and compare the results. This step is a very quick and simple process. This idea is the working mechanism of the proof-of-work principle.

Finding the nonce value for the appropriate hash requires enormous computing power and time

However, it takes very little time to examine the results and determine if there is any malicious intent.

This is how miners implement the proof-of-work protocol in Bitcoin mining. They use their computational power to solve the cryptographic problem in front of them and create the next block. In the Bitcoin blockchain, blocks are created every 10 minutes.

How do transfers take place on the Bitcoin network?

Let's say John wants to send some bitcoin to Dave. How does this transfer take place? Bitcoin transfers work very differently from fiat money transfers. If John wanted to give 10 USD to Dave, he would physically remove the 10 USD banknote from his wallet and give it to Dave and the transfer would be completed. But for bitcoin, it's different, it's not something we physically own. What we have is proof that we have bitcoin.

There are two things we should know and pay attention to;

Miners confirm and secure transfer transactions with the data they place in the block they create. They also charge a fee for this service.

When we look at fiat currencies, we do not know and do not follow any banknote we have before us. There is no practical practical way of doing this. However, every bitcoin transfer transaction is recorded on the bitcoin network.

In the light of this information, let's take a look at the bitcoin transfer between John and Dave. This transfer has two parts; input and output(input-output)

In order for John to carry out this transfer, he must have bitcoin from the previous transfers. As we mentioned earlier, all transfers are recorded in the bitcoin network.

John needs to collect the bitcoins from the transfers he received with the names TR(0), TR(1) and TR(2) beforehand and create a new transfer with the name TR(INPUT) and send it to Dave. Here TR(INPUT) becomes the input data for the new transfer.

This is roughly what the bitcoin transfer by Input looks like.

The output data will simply contain the amount of bitcoins Dave should have after the new transfer and the remaining change, which is then sent back to John as the TR(INPUT) value in his next transfer.

This process includes a single output result if we do not include the change part, but it is possible for transfers with multiple output results. This narrative simply shows how a transfer takes place on the bitcoin network. However, in order for these to occur successfully, certain conditions must be met.

Conditions that transfers must comply with:

TR(INPUT) >TR(OUTPUT). The input transfer should always be greater than the output transfer. In each transfer, the difference between the input and output (output + change) is paid to the miners as a fee. So, Mining Transaction Fee = TR(INPUT)-(TR(OUTPUT)+CURRENCY)

On the input side, it should be TR(0)+TR(1)+TR(2)=TR(INPUT). In other words, John should have enough bitcoin to send to Dave. If Mike doesn't have enough bitcoin to process the transaction, the transfer is rejected by the miners.

Now Dave has to prove that he is the owner of the bitcoins sent to him. John has encrypted his bitcoin transfer with Dave's public key. Dave can only open this password with his private key.

Meanwhile, John has to prove that he has enough bitcoin to send to Dave. It does this by signing the transfer it wants to perform with its own private key. Anyone can open it with Mike's public key and verify that they actually have the required amount of bitcoins. This evidence is called signature data.

Input data (including signature data) and output data are added together and passed through the SHA-256 hash algorithm. The output of this algorithm is called the transfer.

There is one thing to keep in mind, for a bitcoin transfer to occur, the miner who mined the block must physically put that transfer into the block. The miner who mined the block can receive a fee for all the transfers he put in that block. As the transfer amounts increase over time, the transfers have to wait for a new block to appear due to the blocks that are completely filled. In fact, people who don't want to wait pay more mining fees, making their transfers stand out and making them more attractive to miners.

This introduced the replace-by-fee principle. It simply works like this: Even if he sent 5 BTC to John Dave, it is never included in the block and remains pending because the mining fee is kept low. There is no way to undo or cancel this transaction as spent bitcoin cannot be recovered. However, if John makes a transfer to the same address for the same amount of BTC and keeps the mining fee higher, the old transfer is deemed invalid and the new one waits for the transaction.

The future of Bitcoin and cryptocurrencies in general is full of countless possibilities. Blockchain applications know no boundaries, and projects in this field are becoming more successful and safer day by day.

In the journey from commodity currencies to the use of precious metals such as gold and silver, to paper money and nominal currencies, the idea of ​​​​money in the virtual environment is not very new, but it has become possible in recent history to become applicable.

According to some, he is a group in the CIA, according to others, he is an alien or maybe he is really a cyberpunk Satoshi Nakamoto. Whoever it is, he left us alone to decide what to do next with his ideas and practice that will completely change the way we view our assets and how we store them. He paved the way for the emergence of ideas more advanced than his own and convinced the world to have a completely different perspective.

Satoshi had not neglected to hide a message in the genesis-starter block, which he extracted and wrote as hard code. Noting the date of January 3, 2009, he attached a headline from the UK Times of that day about the banks responsible for the worldwide economic crisis; “Minister is on the verge of second bailout for banks”. He's probably making fun of federal reserve banking with these words. It is unknown why Satoshi created this non-spendable address in the starting block. 16 BTC has been sent to this address anonymously so far, and therefore the total supply of 21 million bitcoins will never actually happen.

It took only 9 years for Bitcoin to reach levels that would frighten the world's central banks, and it has a long way to go.

bottom of page