From Wax Tablets to Elliptic Curves: A Brief History of Cryptography (Part Three and Final)

At the end of this short journey through incomprehensible numbers and letters (in case you haven't already done so, I recommend you read the Before and the second part), we will talk in this article about a cryptographic method that has had great resonance in recent years, also thanks to its implementation in the Bitcoin protocol.

 

Without the pretense of being able to to liquidate Since the topic of cryptography is so vast and complex, it certainly goes beyond the scope of these articles. I'll leave plenty of room for each of us to explore the subject in such a limited space, and to explore texts that are also available online.

 

This final article aims to provide a better understanding of how a cryptographic method that is very popular and discussed today works: the use of Elliptic Curve Cryptography in the Bitcoin protocol.

 

Some preliminary information

 

 

If we wanted to use a similarity with the traditional credit system, we could think, simplifying to the minimum terms, that in the Bitcoin system the’public address represents a sort of IBAN code, the wallet either the credit institution or a safety deposit box and the’private address depict the secret code to access the account or the key used to open the safety deposit box.
Choosing a wallet is one of the first steps you need to take when entering the world of cryptocurrencies and is equivalent to opening a virtual wallet that acts as a container for your bitcoin addresses.

There are various types of wallets, each with its own advantages and disadvantages, depending on whether you want to use them on a computer, smartphone, or directly online, in the latter case without installing any software. This first category is called hot wallet, because it is based on applications that are somehow connected to the Internet.
Conversely, the cold wallet o cold storage They are considered much more secure because they are not connected to the Internet. This category includes wallets stored on an external mass storage device and kept in a safe place, or the so-called hardware wallet, hardware devices specifically created to store private addresses.

Among the cold wallets we can certainly mention the physical bitcoins, actual coins minted in metals of different values, inside which the numerical representation of the private bitcoin address is printed and stored.
Finally, one of the methods considered among the safest for storing bitcoin addresses is the paper wallet, or simply printing the bitcoin addresses on paper, perhaps even in QR Code format for easier use, to be stored in a safe place.

Although cold wallets are generally considered more secure, as they are not exposed to the potential threats of being connected to a network, it is important to keep in mind that losing one of these devices almost certainly results in the loss of the bitcoins stored within.

All these applications and devices have, as their primary purpose, the storage of bitcoin addresses, particularly the private one, on which the existence of both the public address and the bitcoins themselves depend.

The Bitcoin Protocol

We all know by now that the Bitcoin system is based on the invention of what we can define as the spine of this protocol, which is the Blockchain.
Beyond what has become today the use (and abuse, I would add) of this excellent intuition, it is necessary to remember that In order for the Bitcoin system to guarantee secure transactions between users, without the presence of intermediaries acting as guarantors, the creators have made use of important developments in cryptography., especially the public key one.

In fact, the first approach to the Bitcoin world occurs with the creation of one's own pair of keys, the public and the private one, linked together by a one-way cryptographic function called Elliptic Curve Digital Signature Algorithm (=Elliptic Curve Digital Signature Algorithm o ECDSA).
In particular, the elliptic curve called was chosen secp256k1 (so called according to the classical Standards for Efficient Cryptography or SEC, “International Consortium for the Development of Commercial Standards for Efficient Cryptography” based on elliptic curve cryptography, more information can be found on page 9 of this document), which guarantees high levels of security and short keys, in order to make it easier for users to use.

The encryption algorithm secp256k1 It first takes care of creating the private key, that is, a sequence that has the highest degree of randomness allowed by a computer. The result will be a 256-bit integer, represented by 64 hexadecimal characters..
This alphanumeric sequence is called private key and it takes on extreme importance in the Bitcoin system, both because the public key is generated from it, and because possession of a private key is equivalent to having access to the bitcoins associated with the relative address.
Since the private key acts as if it were the only secret code useful for opening a safe, this key must necessarily remain secret and kept in a safe place.

E9873D79C6D87DC0FB6A5778633389F4453213303DA61F20BD67FC233AA33262

Private key example (64 hexadecimal characters)

The cryptographic algorithm secp256k1, immediately after creating the private key, derives from it the public key, using the multiplication function of the elliptic curve. The public key is therefore uniquely linked to the private key that generated it through an irreversible function which, as mentioned in the’previous article, does not allow you to easily reverse the key creation process.

The public key is a 520-bit integer, represented by a series of 130 hexadecimal characters and, unlike the private key, does not need to remain secret because it ideally represents the address to which bitcoins can be received.

0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6

Public key example (130 hexadecimal characters)

Although it is computationally impossible to derive (today!) the private key from the public one, it was preferred to subject the latter to further mathematical functions that not only offer the user a high guarantee of security, but also allow for a simpler format for everyday use.

The bitcoin address, in fact, is obtained by subjecting the public address to multiple verification procedures. hashing performed in succession.
In more detail, the public key is first subjected to hashing through the algorithm SHA256, the result of this processing will be used as input to calculate the hash using the algorithm RIPEMD160 (=RACE Integrity Primitives Evaluation Message Digest or RIPEMD is a cryptographic hash function and was developed in Belgium in response to the hash function called SHA, developed by the US NSA).
The subsequent result is further subjected to a final encoding using the function Base58Check (used in the Bitcoin system in order to simplify the use of bitcoin addresses, reducing their length and also because it allows for greater integrity control, including an error control mechanism) the result of which will be the’bitcoin address.

16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM

Example of a bitcoin address (33 characters in Base58)

All of the above cryptographic processes bring significant advantages both in terms of usability, as they reduce the public address to just 33 alphanumeric characters, and because they integrate important security functions by allowing some automated checks against spelling errors in the bitcoin address.

Transactions and privacy

A transaction is essentially a transfer of bitcoins from one address to another. To ensure the highest level of security at all times during this very delicate phase, the Bitcoin system makes extensive use of the cryptographic techniques described in the previous article, such as’hashing and the digital signature.

Let's see what happens when we want to transfer some bitcoins from one address to another:

When a user A (who we will call Sender) decides to transfer a number X of bitcoins to a user B (who we will call Recipient) simply enter the recipient's bitcoin address and the desired amount of bitcoin into the wallet application. The software will automatically perform a series of operations that aren't directly visible to users, but are necessary to ensure the bitcoins are transferred with extreme security.

First of all, it must be said that, to simplify things greatly, by an intrinsic property of the Bitcoin protocol, whenever a Sender initiates a transaction, it will use the parts not used in previous transactions (UTxO=unspent transaction output). All of these parts, used up to the desired amount, will be sent to the Recipient; any portion exceeding the amount due will be considered as change.

In fact, each transaction can be represented as a ledger divided into inputs, containing all the previous transactions from which the bitcoins in its address originate, and outputs where the recipient addresses will be indicated, including that of the sender in case not all of one's bitcoins are used.
The output of one transaction will become the input of the next transaction.
Normally the input values are greater than the output values, since the system is structured to recognize a reward, called fee, to users (the so-called miners) who will take care of including this transaction in the Blockchain.

 

Example of a sequence of transactions, where the input of one transaction becomes the output of the next.
Image taken from “Mastering Bitcoin” by Andreas M. Antonopoulos LLC https://bitcoinbook.info – Copyright 2016, Andreas M. Antonopoulos LLC

After determining which address to send the bitcoins to, the software performs some further important operations.
First, using the Sender's private key, it is affixed Digital Signature to the transaction, so that you can prove ownership of the bitcoins you move at any time using your public key.
Furthermore the recipient's public key is included in the transaction, so that only he can be the true beneficiary of the sent bitcoins, verifying the message using his private key.

 

Pattern of using public key cryptography in Bitcoin transactions.

Each transaction consists of addresses, amounts, digital signatures, and hash values, as well as other data useful for the correct functioning of the system, but in no case are there names or references to the people using those bitcoins.
For this reason, the Bitcoin system does not allow a direct relationship between real users and the addresses they use, even if it cannot be considered an anonymous transaction system.
Every Bitcoin transaction, after being approved, is published in a ledger, called the Blockchain, which is public and unmodifiable.
This means that for each transaction made there will be a note in this register, always visible and available to anyone who wishes to consult it.
Additionally, using additional tools, some of which are freely available online, you can obtain a list of all transactions, as well as other useful information, related to a specific bitcoin address. On this topic, I recommend reading this great article.

In this context, especially for investigative purposes, the Bitcoin Forensics that is, “the discipline that studies the investigative and intelligence techniques, tools, and methodologies applicable to cryptocurrencies[…] focusing attention on the application of computer forensics or network forensics best practices to digital investigations into the world of Bitcoin and blockchain”.

These are just some of the reasons why The Bitcoin system cannot be considered totally anonymous, but it can be defined as pseudo-anonymous., since it guarantees an excellent level of privacy in any case.

Conclusions

Having come to the end of this brief digression (it depends on your point of view 😛 ) on the main cryptographic methods used to date, with the awareness of having outlined a subject with a thousand nuances, I hope to have succeeded in my intent to arouse and stimulate curiosity on a topic as complex as it is interesting.

Finally, as with previous articles, I would like to point out some texts (not all of them, because the topic is complex and there are so many of them) that were a great inspiration for me in writing this third part:

  1. Mastering Bitcoin: Unlocking Digital Cryptocurrencies by Andreas M. Antonopoulos, can be considered one of the sacred texts on the subject of Bitcoin and you can easily find it for sale online in PDF or paper format, or directly on author's github;
  2. Understanding Bitcoin: Cryptography, engineering and economics Of Pedro Franco, this can also be easily found for sale online;
  3. Cryptocurrencies and Bitcoin: A Legal Analysis by Dr. Stefano Capaccioli, a truly interesting text, also due to the fact that it was written by one of the leading Italian cryptocurrency experts with regard to the legal framework, with interesting insights on the tax and criminal aspects. It is available for sale online, usually on Ibs e Amazon.

If you have any suggestions, criticisms, or need additional reading to explore this topic further, please leave a comment below.


Comments

Leave a Reply

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