Foundations of Blockchain
上QQ阅读APP看书,第一时间看更新

Cryptography in Blockchain

In the previous chapters, we introduced cryptography that are relevant to blockchain. Although we have a clear understanding of some of these cryptographic primitives, we haven't explored their applications in a real blockchain application. In this chapter, we will cover some of the applications of cryptographic primitives, which will include hash functions and digital signatures. We will cover them in-depth by actually implementing them in a basic blockchain application.

In this chapter, we'll cover the following topics:

  • Hashing in blockchain
  • Digital signatures in blockchain

One thing to note is that each cryptographic primitive that is used with blockchain technology has a distinct role. Hash functions and digital signatures are two concepts of cryptography that are extensively used with blockchain.

We can mainly observe three layers in the blockchain technology. These are a peer-to-peer network layer, a consensus layer, which deals with the block creation and validation mechanism, and an application layer, which utilizes underlying blockchain in order to build an application. Cryptography is mainly used in the consensus and application layers of the blockchain. A hashing algorithm is mainly used to create block identity, ensure the integrity of the blockchain, and also acts as a key ingredient of consensus algorithms, such as Bitcoin's Proof of Work. The digital signature, on the other hand, deals with the application layer, where it is used to validate events by embedding them in transactions.

Since hashing and digital signatures contribute to the blockchain at different layers, we will cover the significance of these concepts throughout different sections of this chapter.