# Honorary mentions: Cryptography, Networking, Serialization and Merkle Trees

It can arguably be said that having an understanding of block-producing protocols, protocols governing fork-choice rule, and finality protocols form part of the cornerstone of what is needed to understand how blockchain systems work. Obviously, this is not everything about blockchains, but a developer coming from a Web2.0 world, who wants to get involved in blockchain protocol development should have a good mental model of these protocols.

Apart from these protocols, there are a couple of subjects that I also think need to be mentioned. And these are Cryptography, Networking, Serialization, and concepts of Merklization and proofs. I quickly touch on these.

### Cryptography

There won’t be blockchains without cryptography. The various guarantees of immutability, security, etc that blockchain systems provide all build on cryptography, and hence getting familiar with the cryptographic primitives that underpin blockchain systems is essential.

Traditionally, Cryptography on the internet has mostly been used for confidentiality and secure communication, that is helping to send messages over the internet such that no one can eavesdrop or tamper with that message. For these purposes cryptographic primitives like encryption, key exchanges etc get used.&#x20;

In blockchain systems, even though there is still the need for confidentiality and secure communication, a core usage of cryptography is establishing data integrity; that is, proving that data is valid and confirming the authenticity of the originator of data. And for this, cryptographic primitives like cryptographic hash functions, digital signatures, commitments and proofs, etc come to play.

There are also other exotic cryptographic primitives like Zero-knowledge proofs that are being researched for more advanced use cases in blockchain systems.&#x20;

{% hint style="info" %}
**Additional Resources**

* Introduction to Cryptographic Hash Functions for the Working Developer\
  <https://www.geekabyte.io/2021/10/introduction-to-cryptographic-hash.html>
* Introduction to Digital Signature for the Working Developer\
  <https://www.geekabyte.io/2022/06/introduction-to-digital-signature-for.html>
* Introduction to Cryptography by Christof Paar\
  <https://www.youtube.com/watch?v=2aHkqB2-46k&list=PL2jrku-ebl3H50FiEPr4erSJiJHURM9BX>
  {% endhint %}

### Networking

Web 2.0 is largely ruled by client/server architecture. This involves a networking model where clients connect to a server for all their operational needs. This is not the case with Blockchain systems.&#x20;

The blockchain networking model revolves around peer-to-peer networking. In this networking model, nodes form peers (a word that signifies there is no distinction of roles as you have with client/server) and they can connect to 1 or multiple peers at the same time. Peer-to-peer networking is its own specialized field where problems like routing, peer discovery, efficient propagation of messages, etc are tackled.&#x20;

Bitcoin implements its own Peer-to-peer networking while Ethereum and Polkadot make use of Libp2p, a third-party library for building peer-to-peer networks. Libp2p is not tied to blockchain systems, as it can be used in any other system that needs to form a peer-to-peer networks.

### Message Serialization

Messages are transmitted within blockchain systems and for these transmissions to be as efficient, the data needs to be serialized into formats that can be efficiently transmitted. As with cryptography, and peer-to-peer networking, serialization as a concept is not peculiar to blockchain systems therefore some blockchain systems use already defined, out-of-the-box serialization schemes, while others specify their own serialization.&#x20;

Bitcoin specifies its own serialization format, so also does Ethereum and Polkadot. Ethereum uses two serialization formats: Recursive-length prefix (RLP) and Simple serialize (SSZ). SSZ was added as a serialization format after the switch to proof of stake. Polkadot's custom serialization scheme is called Simple Concatenated Aggregate Little-Endian (SCALE).

### Merkle Trees

The Merkle tree, also referred to as binary hash trees, is one of the data structures that finds application within blockchain systems. They are tree data structures with the extra characteristics that the leaf of the tree are hashes, and all the other nodes are created by hashing two adjoining child nodes. The hash that forms the topmost node is then called the Merkle root.

The Merkle tree data structure finds its use in blockchain systems as it allows efficient and secure verification of the contents of a large data structure. This is achieved by what is referred to as Merkle inclusion proof. The general idea is that it is possible to verify that some piece of data is part of a large data structure, without having to have access to all the large data structures to ascertain this. Instead, only a subset of the data structures will be needed to make this assertion.

This comes in handy for instance when there is a need to prove that a transaction is part of all transactions that make up a block. Merkle proof enables this check to be done as long as the whole data that makes up the block can be turned into a Merkle tree with a Merkle root, then verification involves having the Merkle root and using a subset of the Merkle tree to prove the inclusion of the said transaction.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://geekabyte.gitbook.io/blockchain-protocol-development-guide/honorary-mentions-cryptography-networking-serialization-and-merkle-trees.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
