<< Go back to Posts

DRAFT - 30 minutes to learn everything about Blockchain

At least all the important details



Introduction

Here, we try to explain quickly the different concept

Triangle

  • Sécurity
  • Scalability
  • Decentralization

Bitcoin Proof of Work

To ensure that no more than one person can publish a block at a time, only the first person able to solve the current problem can.

We are given:

  • the hash of the last block
  • the hash of the block we want to publish, with the transactions comming from the MemPool

The goal is to find a nonce (a random number) such as the number of leading zeros in SHA256(hash_last + hash_new + none) is greater or equal to the current difficulty. For instance 000000c13fa4c07a6d7983ee14619bd71f2ea4001c2c6dba9ab79da4920d5c, I have six leading zeros.

TODO: how the miner get rewarded. SHA256 => 32 hex => 16 octet

Hash Rate

Number of “proof of work” test done by the whole network per second, i.e., the number of time SHA256() has been done.

The current hash rate was 620 EH (10^18). It means that over 10 minutes, a maximum of np.log2(10^18 * 60*10)= 69 bits can be tested.

With the current difficulty:

Last block hash with 19 leading zeros => 76 bits, 0000000000000000000256491fdd7cc579979b0b3f2397a73aac597ffebe8237

Proof of X

Proof of work is the most known because of bitcoin. There are many other alternatives

The more hardware and electrical power you have, the better you win.

Proof-of-stake: the more you own (and invest) in the network, the more power you have. This is equivalent to traditional exchanges where when you have shares in a company, you get coupons every X and you have a right to vote.

Proof-of-authority:

Proof-of-space

Proof-of-location:

https://docs.witnesschain.com/depin-coordination-layer/proof-of-location/introduction

Proof-of-ownership:

https://github.com/satoshilabs/slips/blob/master/slip-0019.md

MemPool

When a transaction is signed, i.e., when I say to the network “I want to send X BTC to Bob”, my transaction is not instantaneously processed.

The miners will hear that I want to do a transaction. Miners are currently working on a block, so they may not add my transaction to it. Plus, there might be other transactions waiting to be processed. Therefore, my transaction is on a “waiting list” called the mem pool.

Layers

With Bitcoin, we quickly discover that security has a price, which is network capacity. Because of the proof of work, we are limited in the number of transactions. This is why some other blockchains appeared, with other consensus mecanisms. Yet, there is still some limitation or other drawbacks. And Bitcoin has not been left, so people search for a way to improve network capacity. Here comes the layers.

Layer 1 is the “real” / low level blockchain with its “small” capacity but all the garantees.

Layer 2 is a set of protocols / other mecanisms working on top of layer 1, where transactions are done “off-chain”, i.e., they are not recorded in the blockchain’s blocks.

Layer 3 tries to increase the capacity of level 2 using other mechanisms.

Today (2024), we are talking about this 3 layers architecture. Nevertheless, layers 3 do not exists at all, and layer 2 are experimental / in progress but not democratized. The most known layer 2 is the Lightning network 1, which allows doing bitcoin transactions thanks to bitcoin smartcontract and peer-to-peer network.

Numbers

It is good to have big numbers in mind

  • 31th of october 2008: Bitcoin paper
  • 3rd of january 2009: First bitcoin block
  • 864,877 bitcoin blocks (9th of October 2024)
  • Size of a block 1.5 MByte (on average)
  • Blockchain size: 600GB
  • Number of transaction in a block: 6400 (when 1.4MB)

  • 0000000000000000000256491fdd7cc579979b0b3f2397a73aac597ffebe8237
  • Current difficulty: 92 049 594 548 485,47
  • Evaluation of difficulty: every 2016 blocks
  • Hash Rate: 620 EH (Giga: 10^9, Tera: 10^12, Peta: 10^15, Exa: 10^18)

Exchange

Exchanges are marketplaces where you can exchange cryptocurrency against something. In the regulated ones, you can buy crypto using fiat money or to sell them. You can also exchange one crypto currency (say ethereum) against another (for instance dodge coin). In some specialized exchanges, you can buy NFT

In decentralized exchanges, you cannot use fiat money, but

Decentralized exchange

Unless you are able to mine cryptocurrency, you ca

Fiat money

Traditional currencies like Euro, Dollar, Yen, etc.

They are issued by a government and not backed by a physical counterparty like gold or silver.

On Ramp / Off Ramp

Money conversion direction:

  • On-ramp: Conversion of Fiat money to crypto
  • Off-ramp: conversion of crypto into fiat

Wallet

Definition

A wallet is a “place” where all your private keys are stored. A wallet can handle multiple cryptocurrency at a time (Bitcoin, Ethereum, …) and for each crypto, you can have multiple private keys. From each private key we are able to derive the corresponding public key and address.

https://strm.sh/posts/bitcoin-address-generation-in-pure-python/

TODO: illustration

Hot VS Cold

A cold wallet is not accessible online. It can be a sheet of paper with the key writted in, a physical device (like Ledger), a file in a floppy disk or in your computer. Each time you want to use it, you need to load it. In terms of security, this is the best choice, as no one can steal it remotely. The main drawback is that you are responsible for it, there is no recovery possible in case of disaster (loss or other)

A hot wallet is stored online, usually thanks to a third party.

Custodial

A wallet is custodial if you do not manage the keys of your wallet. Most of the time, when you use an exchange, you do not have access to the private key, and everything is accessible thanks to your email and main password.

A non-custodial wallet is a wallet that you manage yourself.

Memotechnic

Private keys or wallet keys are a list of bits. They can be read thanks to hexadecimal formal (you look at 4 bits at a time and convert it as a alphanum charecter in 0123456789abcdef). Nevertheless, this is quite difficult to remember, or to copy (in a paper notebook for instance).

In BIP39 has been introduced a way to convert the private keys into a list of human readable words. BIP39 wordlist Each word represent 11 bits of the key. This words are common, so their writing cannot be mistaken, and they have been choosen such as all four first letters are different.

In Bitcoin, a private key is 256 bits, so you would need 24 words to represent it.

TODO

## Hierarchical Deterministic Wallet

Rather than having many private keys to remember, another option is to have a master key and to derive all private key from it. TODO

Memotechnic converter

KYC

For Know Your Customer.

The idea of bitcoin was to do transaction without sharing your identity. Anyone can create a cold wallet at no cost. However, it is empty. To get some coins, you need to exchange fiat money (€, $, £, …) against tokens/coins. To do that, you need to provide your identity (ID card).


BIP

Bitcoin Improvement Proposal

List of proposal (some are draft, other accepted or rejected) to improve the Bitcoin protocol.

As it exist for “normals” protocols with “RFC: Request for Comment”.

  • BIP39: List of 2048 words (one word represent 11 bits) which can represent your private key passphrase to get your private key / wallet unlocked. Words should be short and common. The four first letters are different for all words. From the wallet private key, you can issue several public key for different cryptocurrency. For a wallet: 12 words. Therefore, the key is 11 x 12 = 132 bits long

ERC

Ethereum Request for Comment

Same as BIP, but for Ethereum.

The most known are:

  • ERC20 for alternative currency (identical coin that can be exchanged in a quantity).
  • ERC721 for NFT (unique object)

# Smart Contract

This is a piece of code which can be executed during a blockchain transaction.

Within a blockchain, it is useless to run for instance a code doing image segmentation as there is no value. As a blockchain is a set of addresses and currency with verifiable properties, the codes are “contract” which gives credentials / prove the ownership of something to someone.

NFT

Non-Fongible Tokens.2

This is a particular type of “digital object” created thanks to smartcontract.

Interaction are done with the smartcontract.

To a digital document (image, text, or anything else) is given a signature and the possiblity to be owned.

The Smartcontract defines:

  • What is the digital object
  • Who is the owner
  • How it can be exchanged

Minting

Lyfecycle of a token.



>> You can subscribe to my mailing list here for a monthly update. <<