Skip to Content

👨🏻‍🎓 Register for live classes

Fundamentals of Blockchain

Blockchain uses fundamentals from other areas already consolidated:

  • cryptography
  • distributed networks
  • game theory

Let's understand each one better.

Cryptography

Let's understand:

  • Hash function
  • Cryptographic keys
  • Public key and private key
  • Merkle tree

Root

In Greek: kryptós, "hidden", and gráphein, "written"

It is the study of the principles and techniques by which information can be transformed from its original form to an unreadable one, so that it can be known only to its recipient (holder of the "secret key"), which makes it difficult to read by an unauthorized person. Only the recipient of the message can read the information easily.

It is a branch of mathematics, part of cryptology.

Modern cryptography is fundamental to aspects of information security:

  • confidentiality
  • data integrity
  • authentication
  • non-repudiation

Source: Wikipedia

Suggestion

Film that tells the story of Alan Turing and the Enigma machine that encrypted messages.

The Imitation Game

Reading

Hash function

Algorithm that maps variable-length data to fixed-length data.

Characteristics:

  • Deterministic: the same entry will always result in the same exit
  • Fast
  • One way: from the hash it is not possible to return to the original
  • Small change in the input generates a completely different hash (it seems random)
  • Collision resistant: two documents do not generate the same hash

SHA-256

There are several types of hash functions. The most important for Blockchain is SHA-256 (Secure Hash Algorithm 256).

This function takes an input of random length and converts it to a fixed length output of 256 bits = 64 characters.

Try it:

Hash em Blockchain - Anders

The SHA-256 hash function is used within the Bitcoin network in two main ways:

  • Mining
  • Creation of Bitcoin addressess

Cryptographic keys

There are two types of cryptographic keys:

  • symmetric keys (single-key encryption)
  • asymmetric keys (public key cryptography)

Asymmetric keys are used in Blockchain.

Public key and private key

Cryptography:

  • anyone can encrypt a message using the recipient's public key.
  • only the owner of the private key is able to decrypt the encrypted message with the corresponding public key.

Authentication:

  • only the owner of the private key can sign / authorize a transaction from the corresponding public key.
  • the public key verifies that the holder of the private key sent the message.

Public key algorithms are based on mathematical problems using integer factoring, prime numbers, discrete logarithm, and elliptical curve.

It is practically impossible (computationally impractical) to determine a private key from your corresponding public key.

Some public key algorithms:

  • RSA (Ron Rivest, Adi Shamir and Leonard Adleman)
  • El Gamal
  • Elliptical curves

Wikipedia: Public-key cryptography

Merkle tree

Fundamental part of Blockchain, it allows for efficiency and security in the verification of a large mass of data, to validate the integrity of the data content.

  • Binary hashes tree
  • Type of data structure: binary dispersion tree.
  • Anti-fraud mechanism

It is a data structure for storing information in large datasets (dataset) so that the verification of this dataset is efficient.

It contains a tree of summary information about a larger piece of data. Used to check your content.

Wikipedia: merkle tree

Merkle tree

Image: merkle-root-and-merkle-proofs

  • each leaf of the tree is a hash of the transactional data
  • each node is a "hash of the hash" down to the root of the tree
  • the root of the tree is called Merkle Root

According to Andreas M. Antonopoulos, in "the Bitcoin protocol": "Merkle trees are used to summarize all the transactions in a block, producing an overall digital fingerprint of the entire set of transactions, providing a very efficient process to verify whether a transaction is included in a block".

Merkle tree

Image: Wikipedia , license Creative Commons Attribution-Share-Alike 3.0 Unported

Distributed networks

The diagrams of Paul Baran, published in the text On distributed communications (BARAN, Paul - 1964) are one of the best ways to present distributed networks:

On distributed communications

This is the basic concept of Blockchain: p2p, peer to peer or peer to peer networks, where communication can be carried out between any pair of computers.

Wikipedia: Paul Baran

Game theory

When we are talking about game theory, we are not talking about video games or board games.

It is the study of decision making between individuals when the outcome of each depends on the decisions of the others in a game-like interdependence.

In other words, it is the study of probabilities in decision making.

The problem of the Byzantine generals

It was proposed in 1982 by Marshall Pease, Robert Shostak and Leslie Lamport.

The problem of the Byzantine generals describes the pitfalls and challenges that exist when trying to coordinate communication actions within a network whose peers are not entirely reliable.

This problem was explained and solved by Barbara Liskov and Miguel Castro, from MIT, in 1999: Practical Byzantine Fault Tolerance .

We are talking about consensus, how to agree on a particular issue.

Conclusion

The purpose of this lesson was to present the fundamentals of Blockchain: cryptography, distributed networks and game theory.

In the next lesson you will understand the consensus algorithms.