Bitcoin’s on everyone’s lips, and you don’t know what it’s all about? This article will explain the basics.

How does bitcoin work?

Imagine a small village in the mountains where money is not used. Neither do you like Patricias’s watch, and Patricia looked for Annie’s bracelet. The two ladies came to an agreement and want to exchange their accessories. But before that happens, all the inhabitants of the community gather in one place to check if Anna owns the watch and Patricia owns the bracelets. The village is not an ideal place and although people respect each other, they decided not to give each other credit of trust.

Finally, the assembly decides that the ladies can exchange things and everyone remembers that now Ania has a bracelet and Patricia has a watch. That is how the bitcoin network works.

Let’s assume that Anna has the bitcoin she wants to send Patricia. With the help of an application (desktop or mobile) she spreads throughout the network what she wants to do. The applications of other bitcoin users check if there was any bitcoin in the account. If the verification is positive, Anna can send bitcoin.

What is blockchain?

I wrote that everyone in the village check who owns the bracelet and the watch, but how does it happen? After all, memory can be ephemeral.

Well, everyone in the village has their own books, where they write down what belongs to whom, who gave what to whom and for what. Thanks to that they can check at any time who owned the watch before Ania or the bracelets before Patricia. Such a solution has a disadvantage. In exchange for concentrating the history of all exchanges in one place you have to pay with large dimensions of the book.

This is what blockchain is like, that is a chain of blocks. It contains all transactions from the beginning of bitcoin’s existence. We can check what Satoshi Nakamoto did with his bitcoins (we don’t know his real identity yet) or who has the most bitcoins (which address). But why is this book called a chain of blocks?

What is a bitcoin block?

The gathering of all members of the community in one place to confirm one exchange is an overgrowth of form over content. That’s why the village has decided that you can exchange bitcoins once a week. Then everyone will gather in the market and check the correctness of the transactions of the last 7 days.

Fortunately, bitcoin exchanges are not limited in time, because the system works 24/7. During this time, however, transactions are properly organized – divided into blocks. You can think of them as single book cards. However, the capacity of the card is limited – we have a fixed font size, font and size of the card, so you can write on it one number of transactions, not another.

So when the card reaches its capacity, it is closed and then the transaction is checked for correctness. If everything is correct, the card is pasted into the book, i.e. the block is incorporated into… a chain of blocks. Each bitcoin block has a capacity of about 1 MB and contains about 2 thousand transactions. This is relatively little and that is why the network is often overloaded.

How are transactions secured?

And couldn’t someone fake the entries in the book – so that next week Anna could sell the watch again? Finally, she would show everyone the records of her fake book suggesting that the transaction did not take place a week ago. Then all the other residents would immediately turn to their records and say that Anna is lying.

But theoretically, Anna could break into their homes and change the records in every card. In order to prevent this, two mechanisms were introduced.

How does bitcoin cryptography work?

In fact, every card is sealed, which means that the transactions made on it are confirmed as true. How does this sealing work? It uses password functions, which are used in a large number of Internet applications used to confirm identity. Although the functions themselves are complex mechanisms, it is possible to explain their mode of operation in a rather simple way.

Probably at school you solved equations where x was given and y had to be found. They could be as follows: y=2*x. If we put 2 into the equation, we got output 4.

Similarly, the hash functions work in a similar way, but their real form is practically impossible to grasp by the human mind (there are exceptions). Let us assume that at the beginning we have the word 2k18, which is connected with the given card of our book (each card has its own word). We can easily check that 2k18 after passing through the hash function gives 0qetu. 2k19 gives a completely different result: a5dfg. Although it looks like a random sequence of characters, in reality it is not. If we want to reverse the mechanism of function counting (calculate x with a given y), 0qetu will always give 2k18, and a5dfg will always give 2k19.

With our function y=2*x it is very easy to juggle the unknown. It is different with hash functions. Having something on the input, it is very easy to calculate the result, but having a result, it is very difficult to calculate what was on the input. This is a key feature of the function for use in cryptography.

How does bitcoin mining work?

The best way to find out what our 0qet word is, is to reposition all the combinations known in the universe. We can start with 1 and get to much more complicated words, but what counts is how fast we get the right word – 2k18. So this can be understood as a brutal attack on the hash function.

This requires a huge amount of computing power and that is why bitcoin mines consist of shelves filled with computer units specializing in solving cryptographic problems, i.e. finding an input word with a known output word. They do a lot of work – in a long time they need a lot of energy to work, and their owners are rewarded with bitcoins (the bitcoin network consumes more energy than a small country).

Each block is 12.5 new bitcoins created from the air (there were no new bitcoins before, only after confirmation of the block). So mining a bitcoin is actually a confirmation of the transaction.

How does bitcoin transaction confirmation look like?

However, bitcoin mining is even more complicated. I will now describe the second mechanism that prevents Anna from breaking into all the books and changing the records on all the cards in order to exchange her watch for the second time.

Each card, or bitcoin block, has three attributes:

  • The word appropriate for a given block, i.e. in our example 2k18,
  • The word referring to the previous block,
  • Third, unknown word.

Only by adding these three words and letting them pass through the hash function will the desired result be achieved. What the diggers are doing, then, is as follows:

  • We know the final word,
  • We subtract from it two known initial words,
  • We’re looking for a third word.

Thanks to the fact that in these calculations the word referring to the previous block is taken into account, we can talk about their chain. This gives us some consistency – we know that after block 5, there is always block 6 and it will stay that way. Therefore, if Anna wanted to change the contents of blocks, she would have to go back to the beginning of the book, change each card and use the calculation of the hash function.

What is proof-of-work?

This third word, which is so difficult to recognize, acts as a certificate. A block has its own identification word, a word referring to the previous block, and a certificate that confirms that the work has been done. This is the proof-of-work that blockchain is based on. This certificate shows that the miner has done his job and can get a salary. The whole network knows that the information in the block is true – it can now add three words very easily and check that they give the desired result.

Finally, we can attach a new block to the chain and glue a new block to our book.

Conclusion

Bitcoin is not based on trust, regulation or personal considerations. Instead, it uses soulless but fair mathematics.

 

Check also our related articles:

The difference between Blockchain and Bitcoin?

How exactly does the Bitcoin protocol work?