How cryptography is used in blockchain

The role of cryptography within blockchain technology

Anyone who deals with blockchain technology will quickly find that it provides a state-of-the-art, cryptographic encryption method. TheCryptography basically change information in such a way that it can no longer be meaningfully understood at first glance. Information is encrypted when it is not intended to be read by everyone.

Bitcoin, for example, uses the SHA256 algorithm to group transfers in Bitcoin in hash blocks. Using the algorithm is not only about summarizing transactions, but also about concealing them from unwanted third parties. If Bitcoin transactions were not encrypted, anyone could change transactions at any time using the Bitcoin program code for their own benefit. In a nutshell, this means that cryptocurrencies like Bitcoin couldn't exist if they didn't use cryptographic encryption methods. Cryptographic encryption methods are methods that are used and developed within the discipline of cryptography.

Cryptography - a classification

In order to understand what the term cryptography means, it makes sense to look at the scientific discipline of cryptology. Cryptology deals scientifically with the encryption and decryption of information. Within cryptology, as a scientific discipline, cryptography deals with methods for encrypting information.

The term cryptography is made up of the ancient Greek words “kryptós” (German: secret, hidden) and “gráphein” (German: to write). This means that methods are used within cryptography to change information in such a way that it can no longer be understood at first glance.

In addition to cryptography, cryptanalysis is an important sub-discipline within cryptology. Cryptanalysis deals with methods to decrypt cryptographically encrypted information without the consent of the encrypting party.

In a nutshell, this means that a cryptographer changes information in such a way that it becomes incomprehensible, while the cryptanalyst makes this information understandable again without being asked.

In addition to cryptography and cryptanalysis, the discipline of Steganography applied. Steganography describes methods to disguise the communication channel over which cryptographically encrypted messages are sent.

The purpose of cryptography

The deeper meaning and purpose of the scientific discipline of cryptography is revealed by the saying “knowledge is power”. This saying is an integral part of the philosophical mindset of Francis Bacon, a 16th century English philosopher. In his work “Meditationes sacrae” from 1597, with this sentence he laid the foundation for the Age of Enlightenment and the modern natural sciences as we know them today. Knowing something also means having the opportunity to apply this knowledge.

Explained in an understandable example, this means that if Peter knows Marie's debit card PIN, he will be given the option to use Marie's debit card. This also means that he can withdraw money from her account without Marie's consent if he gets his hands on her debit card. Knowing the PIN of the EC card enables Peter to steal money from Marie. It's a problem if Marie doesn't agree. At this point, Marie could use some cryptographic encryption method to encrypt her PIN. As a result, Peter could no longer find out about Marie's PIN, i.e. no longer know it, and accordingly could no longer withdraw money from her account without being asked.

The aim of the scientific discipline is to protect messages, databases and sensitive information. Those who protect information deprive others of the opportunity to use this information for their own benefit. In order to be able to guarantee the protection of information, there are four principles within cryptography that must be observed:

  • confidentiality
  • integrity
  • authenticity
  • Commitment

The aim of the scientific discipline is to protect messages, databases and sensitive information

The principle of confidentiality means that only authorized persons are allowed to decrypt and read encrypted information again. For example, if Marie does not have the time to withdraw money before going to a party, she can ask Johann to withdraw € 50 from her account. To do this, she hands him her debit card. She sends him the PIN in encrypted form via SMS. Because only Paul knows the key to decrypt the PIN, he is the only person who can decrypt the PIN. Peter, who happens to be sitting next to Johann and reading the received SMS, cannot do anything with the encrypted PIN.

integrity means that the information transmitted may be completely unchanged when it is transmitted. In relation to the example, this means that Marie uses a cryptographic process that does not essentially change her PIN. It could be that it uses a cryptographic method that changes the original information, the PIN, in such a way that it can no longer be decrypted. This must be prevented.

The Principle of authenticity states that it must be clear to Johann that Marie sent this SMS. It could also have been that Peter sent an SMS on Marie's cell phone to get the key to encode the PIN. Therefore, Marie must be able to prove by the sent message that she sent the message. She has to be able to prove it in a way that she cannot deny with hindsight. This is important because if Marie makes a mistake, for example if she accidentally reveals her PIN, in retrospect she cannot claim that it was not she who made the mistake to dismiss a guilt. At least that's what the one says Principle of liability.

In summary, it can be said that the scientific discipline of cryptography aims to be able to transmit information encrypted, i.e. incomprehensible to third parties. The transmitted information must be transmitted in such a way that the principles of confidentiality, integrity, authenticity and liability are not violated.

Cryptographic procedures are primarily used to protect data. Protecting data is important because information in the wrong hands can lead to it being misused. In relation to the example above, this means that Peter can use the PIN for his own benefit without Marie's consent. If he knew the PIN, he could withdraw the money from Marie and do whatever he wanted with it. Marie can use cryptographic procedures to prevent Peter from gaining knowledge of her PIN and, accordingly, to prevent her own account from being emptied. The importance of cryptography should now be clear.

In summary, it can be said that the scientific discipline of cryptography aims to be able to transmit information encrypted, i.e. incomprehensible to third parties

The question now arises as to which cryptographic methods are available for encrypting information.

Methods of historical cryptography

Two methodological approaches from historical cryptography are, for example, substitution and transposition. While with the substitution individual letters of a message are simply replaced by other letters, numbers or characters, with the method of transposition the individual components of a message are mixed up. There are several possible uses for both approaches.

In the category of substitution Examples include the methods Caesar, Gronsfeld, Morbit, Porta, ROT 13 or Trithemius. Under the category of Transposition Examples include the procedures Cadenus, Echo Chiffre, Jägerzaun, Rotation, Skytale or Swagman. For the sake of clarity, a substitution method will be demonstrated below.

Suppose Mareike would like to send Hagen the following message: I'm hungry. However, she does not want anyone other than Hagen to be able to read this message. Therefore she agrees with Hagen that she can encrypt and decrypt messages using the Caesar method. The Caesar procedure is due to Julius Caesar, who encrypted messages during his warfare by shifting each letter of his message three places in the alphabet to the right. So the algorithm works according to the formula “X = Y + 3”, that is the key. If you insert a letter from the original message, ie Y, into the formula, you get X. An “A” becomes a “D”. If Mareike wants to encrypt her message using the Caesar method, all she has to do is apply the Caesar key to her message. The message “I HAVE HUNGER.” Then becomes “LFK KDEH KXQJHU.” Using the key. The third letter after “I” in the German alphabet is “L”. The third letter after “C” in the German alphabet is “F” and so on. If Hagen wants to decrypt Mareike's message again, he only has to use the Caesar key in reverse. The formula for this is then: “Y = X-3”. In this way, an “L” becomes an “I”, an “F” becomes a “C” and so on. However, someone who gets their hands on the message in encrypted form only reads “LFK KDEH KXQJHU” and does not understand anything at first. This is just a simple example of a historical, cryptographic method.

Basically, a key turns an original message into an encrypted message. The encrypted message can also only be decrypted again using the key. In today's computer-aided cryptography, completely different keys can be calculated.

Methods of modern cryptography within blockchain technology

Within modern, computer-aided cryptography, especially within blockchain technology, Algorithms worked to encrypt information. The information that needs to be encrypted within the Bitcoin blockchain is transaction information.

Suppose Lucas transfers a Bitcoin from his Bitcoin wallet to Ulrike's Bitcoin wallet. Bitcoin nodes now recognize this and check the transaction. If several nodes come to the conclusion that the transaction has taken place correctly, it is integrated into a hash block and thus also into the blockchain.

The nodes use the SHA256 algorithm. The algorithm can be understood as a tool to create a key to encrypt the transaction, but also to decrypt the encrypted transaction data again. In terms of the Caesar code, this means that the SHA256 algorithm creates a new Caesar code for each new transaction. For example, it is conceivable that Caesar encrypts his messages with “Y = X + (4 * 3) mod26”. If a message is encrypted using the SHA256 algorithm, it becomes a hexadecimal number. An example from Wikipedia illustrates this:

SHA256 (“Franz is chasing across Bavaria in a completely neglected taxi”) =
d32b568cd1b96d459e7291ebf4b25d007f275c9f13149beeb782fac0716613f8

SHA256 (“Frank chases across Bavaria in a completely neglected taxi”) =
78206a866dbb2bf017d8e34274aed01a8ce405b69d45db30bafa00f5eeed7d5e

If even one character of the original message is changed, the cipher changes completely. This also applies to transaction data. This is important because the hexadecimal number enables nodes to recognize whether a transaction has been tampered with or has been executed twice. In both cases, they will exclude the manipulator from the network. In the example above, only a “Z” has been replaced by a “K”. However, the two ciphers differ significantly. The SHA256 algorithm must be able to combine several pieces of information into a hexadecimal number. This includes, among other things:

  • The transmitter
  • Recipient
  • The transaction amount
  • The transaction time
  • The hash block into which it should be integrated

According to the four principles of cryptography, confidentiality, integrity, authenticity and liability, the algorithm ensures that the above information can only be read by authorized Bitcoin nodes within the network. The information must be encrypted with absolute integrity. If, after encryption by the SHA256 algorithm, Lucas no longer sent one bitcoin to Ulrike, but Lucas sent five bitcoins to Felix, the entire system would not work. A transaction would then be carried out completely randomly. Ulrike must also be able to understand that Lucas transferred a Bitcoin to her wallet. This is especially important for nodes within the network that check the transaction so that they can assign the correct transaction addresses. The transaction must be binding because Lucas cannot reverse the transaction of a Bitcoin to Ulrike.

In general, it can be said that cryptographic hash functions are used within the Bitcoin blockchain to prevent sensitive information, such as the sender, recipient, transaction amount, transaction time, from being viewed by unauthorized third parties and changed at will.

If Bitcoin did not use a cryptographic hash function, it would be impossible to generate new Bitcoin, guarantee communication between individual nodes, carry out transactions and create the Bitcoin blockchain. Anyone could intercept and manipulate transaction information at any time. This must be prevented. The SHA256 algorithm, as a cryptographic encryption instrument, ensures the protection of transaction data and thereby also guarantees the stability of the Bitcoin network.

Within modern, computer-aided cryptography, especially within blockchain technology, Algorithms worked to encrypt information

Conclusion

Bitcoin was designed to curb the abuse of trust by banks. So that the customers of a bank are no longer exposed to the benevolence of bankers, Satoshi Nakamoto developed a cryptographically encrypted peer-to-peer transaction system. The system uses the SHA256 algorithm as an encryption method to protect sensitive transaction data. Within the peer-to-peer network, people can decide for themselves who they want to send bitcoins to, whether they want to generate bitcoins themselves and where they want to store bitcoins.

The decentralized and transparent architecture of the blockchain (what is blockchain?) Does not solve the problem that there are people who abuse trust in order to take advantage of it. It is precisely at this point that the importance of cryptographic procedures becomes particularly clear: They ensure that information does not fall into the wrong hands and is therefore only shared with the initiated. In the case of Bitcoin, this only implies those nodes that use the Bitcoin protocol correctly. Nodes that do not use the Bitcoin protocol correctly are automatically excluded from the network. In the sense of Francis Bacon, this means that those who protect their information are depriving others of the opportunity to gain power over themselves. In other words, this also means that cryptographic methods ensure information security and give those who use them the freedom to share their own sensitive information only with insiders. This is exactly what the SHA256 algorithm does for people who want to decide for themselves how their money should be used.