The blockchain, literally, is a chain of blocks. There is an initial block, the Genesis block and blocks that point to their predecessors. This arrow pointing to the predecessor is a hash, an identification of the entire contents of the previous block; it is an address that appears in the block header. The trunk of the block consists of an average of 2000 transactions between bitcoin users.

Since the hash of the block depends on the entire contents of the block, the simple change of a bit changes its hash, that is, invalidates the arrow of the successor to it! Therefore, for the blocks to continue to form a chain, you need to change this arrow. Therefore, the successor hash changes! Therefore, for blocks to continue to form a chain, it is necessary to change the arrow of the successor of the successor, and so on, a chain reaction! That is, if we change some detail, for example, a transaction in the first block, all the arrows (= hashes) that follow must be recalculated!

Enters so-called “mining”, which makes this change very difficult, because only blocks whose hashes are small, that is, start with many zeros, are accepted by the network (that is,, by the nodes that check). So, it is not enough to change a transaction and calculate the new hashes of all successors. It is necessary to make this change such that all hashes are small! It is very difficult to find such a change. Currently, the search for such a block requires a billion years on a regular computer; but only ten minutes on the mining network. While the bad guy started searching for acceptable blocks, the network has already created several others, invalidating this work!

All existing bitcoins were generated by mining, that is, they were given (by the coinbase transaction) as a reward to the one who created a block (with a small hash). All other transactions have an input and output. On the entry is added a sufficient amount to pay what will be spent. You have to spend everything! So usually a transaction includes the sender as the recipient, the change. What you don’t expect will win the minor will include this transaction in your package as a prize (currently about $40). The recipient is designated by his public key, and only at the time he spends the coins does he need to demonstrate his possession of the corresponding private key, by his signature of the transaction.

Bitcoin uses encryption by finite elliptic curves to sign transactions: Diffie-Hellman uses finite rings such as {0, 1, ..., *m*} (for example, *m* = 12 for the clock, and a prime number such as *p* = 2^{255} − 19 with 100 digits in Bitcoin). The concept used by Bitcoin resembles that of Diffie-Hellman, only instead numbers 0, 1, 2, … uses pairs of numbers (*x*, *y*), that is, points of a curve, of a graph, called elliptical. The beauty of this curve is that we can add points on them: *p* + *q* + *r* = 0 if these three points *p*, *r* and *q* lie on the same line. Instead of multiplying the same number several times, we add the same point. It is easy to add points with this recipe on these finite rings, but it is very difficult to know how many times a point was added to itself to get the resulting point. The ciphering corresponds to the addition, the decryption to the knowledge of this number of times.

Finally, the signature scheme is a variation of ElGamal’s signature: the signature shows that the owner of the private key was able to solve a difficult equation, so difficult that it is practically impossible to solve it without this private key that provides a shortcut.