- Préambule
- Un livre référence pour qui s'intéresse à la blockchain d'un point de vue fondamental.
- Un mois de lecture du 12 mars au 14 avril.
- Une approche approfondie qui va des bases du concept de livre des transactions partagées, aux protocoles de consensus, aux applications distribuées, aux cryptos monnaies, à l'ethereum, au web3 etc...
- Mes notes de lecture en résumé ci-dessous.
- Chapter 1: Blockchain 101
- Multiple confirmations of a transaction over time provide consistency in Bitcoin. For this purpose, the process of mining was introduced in Bitcoin.
- Mining is a process that facilitates the achievement of consensus by using the PoW algorithm.
- With physical cash, it is almost impossible to trace back spending to the individual who actually paid the money.
- Smart contract: code needed to execute a required function when certain conditions are met.
- Smart property: it is possible to link a digital or physical asset to the blockchain in such a secure and precise manner that it cannot be claimed by anyone else.
- Enterprise Ethereum Alliance
- Hyperledger
- Chapter 2: Decentralization
- Many exiting applications and ideas emerge from the decentralized blockchain technology, such as decentralized finance and decentralized identity.
- A significant innovation in the decentralized paradigm is decentralized consensus.
- Blockchain can serve as a decentralized health record management system where health records can be exchanged securely and directly between different entities.
- Not everything can or needs to be decentralized.
- There are systems that pre-date blockchain and Bitcoin, including BitTorrent and the Gnutella file-sharing system.
- IPFS and BigChainDB are more suitable for storing large amounts of data in a decentralized way.
- Many services hat a government commonly offers can be delivered via blockchains such as government identity card systems, passports, and records of deeds, marriages and births.
- Web 3 = decentralized internet
- Chapter 3: Symmetric cryptography
- Symmetric cryptography refers to a type of cryptography where the key that is used to encrypt the data is the same one that is used for decrypting the data.
- Hash functions play a vital role in blockchain.
- The SHA-256 algorithm is used in Bitcoin's PoW algorithm.
- Chapter 4: Public key cryptography
- Asymmetric cryptography refers to a type of cryptography where the key that is used to encrypt the data is different from the key that is used to decrypt the data. These keys are called private and public keys.
- Digital signatures are used to provide data origin authentication and non-repudiation.
- Hash functions are used to build Merkle trees.
- Hash functions are of particular importance in blockchains, as they are key to constructing Merkle trees, which are used in blockchains for the efficient and fast verification of large datasets.
- Chapter 5: Consensus algorithm
- In distributed systems, a common goal is to achieve consensus (agreement) among nodes on the network even in the presence of faults.
- State machine replication is a standard technique to achieve fault tolerance in distributed systems.
- In an asynchronous environment, the deterministic consensus is impossible.
- Liveness means that the protocol can make progress even if the network conditions are not ideal.
- PBFT (Practical Byzantine Fault Tolerant) provides immediate and deterministic transaction finality. This is in contrast with the PoW protocol, where a number of confirmations are required to finalize a transaction with high probability.
- IBFT (Istanbul Byzantine Fault Tolerant): validators can be added or removed by voting between members of the network.
- Nakamoto consensus, or PoW, is the longest-running blockchain network.
- The PoW is designed to mitigate Sybil attacks.
- A Sybil attack is a type of attack that aims to gain a majority influence on the network to control the network. Its a type of attack where a single adversary creates a large number of nodes with fakes identities on the network, which are used to gain influence on the network. This attack is also prevented in Bitcoin by using PoW, where miners are required to consume a considerable amount of computing power to earn rewards.
- The key idea behind PoW as a solution to the Byzantine generals problem is that all honest generals (miners in the Bitcoin world) achieve agreement on the same state (decision value). Note that this is a probabilistic solution and not deterministic.
- PoS (Proof of Stake) mechanisms generally select a stake holder and grant appropriate rights based on their staked assets.
- Create a system that meets all the requirements without compromising the core safety and liveness properties of the system.
- Chapter 6: Introducing Bitcoin
- Many exiting applications and ideas emerge from the decentralized blockchain technology, such as decentralized finance and decentralized identity.
- A significant innovation in the decentralized paradigm is decentralized consensus.
- Blockchain can serve as a decentralized health record management system where health records can be exchanged securely and directly between different entities.
- Not everything can or needs to be decentralized.
- There are systems that pre-date blockchain and Bitcoin, including BitTorrent and the Gnutella file-sharing system.
- IPFS and BigChainDB are more suitable for storing large amounts of data in a decentralized way.
- Many services hat a government commonly offers can be delivered via blockchains such as government identity card systems, passports, and records of deeds, marriages and births.
- Web 3 = decentralized internet
- Symmetric cryptography refers to a type of cryptography where the key that is used to encrypt the data is the same one that is used for decrypting the data.
- Hash functions play a vital role in blockchain.
- The SHA-256 algorithm is used in Bitcoin's PoW algorithm.
- Asymmetric cryptography refers to a type of cryptography where the key that is used to encrypt the data is different from the key that is used to decrypt the data. These keys are called private and public keys.
- Digital signatures are used to provide data origin authentication and non-repudiation.
- Hash functions are used to build Merkle trees.
- Hash functions are of particular importance in blockchains, as they are key to constructing Merkle trees, which are used in blockchains for the efficient and fast verification of large datasets.
- In distributed systems, a common goal is to achieve consensus (agreement) among nodes on the network even in the presence of faults.
- State machine replication is a standard technique to achieve fault tolerance in distributed systems.
- In an asynchronous environment, the deterministic consensus is impossible.
- Liveness means that the protocol can make progress even if the network conditions are not ideal.
- PBFT (Practical Byzantine Fault Tolerant) provides immediate and deterministic transaction finality. This is in contrast with the PoW protocol, where a number of confirmations are required to finalize a transaction with high probability.
- IBFT (Istanbul Byzantine Fault Tolerant): validators can be added or removed by voting between members of the network.
- Nakamoto consensus, or PoW, is the longest-running blockchain network.
- The PoW is designed to mitigate Sybil attacks.
- A Sybil attack is a type of attack that aims to gain a majority influence on the network to control the network. Its a type of attack where a single adversary creates a large number of nodes with fakes identities on the network, which are used to gain influence on the network. This attack is also prevented in Bitcoin by using PoW, where miners are required to consume a considerable amount of computing power to earn rewards.
- The key idea behind PoW as a solution to the Byzantine generals problem is that all honest generals (miners in the Bitcoin world) achieve agreement on the same state (decision value). Note that this is a probabilistic solution and not deterministic.
- PoS (Proof of Stake) mechanisms generally select a stake holder and grant appropriate rights based on their staked assets.
- Create a system that meets all the requirements without compromising the core safety and liveness properties of the system.
- Bitcoin is quite unstable and highly volatile.
- PoW concept: the money is created by broadcasting the solution to a previously unsolved computational problem. PoW is used to secure the blockchain. This is a proof that enough computational resources have been spent in order to build a valid block.
- The PoW problem, also known as the partial hash inversion problem consumes a high amount of resources, including computing power and electricity. This process also secures the system against fraud and double-spending attacks while adding more virtual currency to the Bitcoin ecosystem.
- Hal Finney was the first person to receive Bitcoin from Satoshi Nakamoto.
- In the Bitcoin network, users have to wait for six blocks, which is equivalent to an hour, to get the right level of confidence that a transaction is final.
- Trustless refers to the distribution of trust between users, rather than a central entity.
- Network is owned collectively by its users instead of a single entity. The more users use the network, the more valuable it becomes.
- The double spending problem arises when a user sends coins to two different users at the same time and they are verified independently as valid transactions. The double spending problem is resolved in Bitcoin by using a distributed ledger (the blockchain) where every transaction is recorded permanently.
- The sender enters the receiver's address.
- The transaction fee is calculated based on the size of the transaction and on the fee rate.
- The higher the transaction fee, the greater the chance that your transaction will be picked up as a priority and included in the block.
- Bitcoin transactions are serialized for transmission over the network and encoded in hex format.
- Public keys can be represented in an uncompressed or compressed format, and are fundamentally x and y coordinates on an elliptic curve.
- Transaction malleability has been solved with the so-called SegWit soft-fork upgrade of the Bitcoin protocol.
- The paper wallets can be stored physically as an alternative to the electronic storage of private keys.
- Transactions are not encrypted and are publicly visible on the blockchain.
- The mining is the process through which the blockchain is secured and new coins are generated as a reward for the miners who spend appropriate computational resources.
- Mining is a process by which new blocks are added to the blockchain. Blocks, once mined and verified, are added to the blockchain, which keeps the blockchain growing.
- Transaction pool, also known as memory pools, are basically created in local memory (computer RAM) by nodes (Bitcoin clients) in order to maintain a temporary list of transactions that have not yet been added to a block.
- The time for transaction confirmation usually ranges from 10 minutes to over 12 hours in some cases.
- Bitcoin uses a simple stack-based language called Script. Scripting is quite limited and can only be used to program one thing: the transfer of bitcoins from one address to other addresses.
- In simple words, locking means providing Bitcoins to somebody, whereas unlocking means consuming the acquired Bitcoins.
- A coinbase transaction or generation transaction is always created by a miner and is the first transaction in a block. It is used to create new coins.
- Nonce is an arbitrary number that miners change repeatedly to produce a hash that is lower than the difficulty target.
- New blocks are added to the blockchain approximately every 10 minutes.
- Miners are rewarded with new coins if and when they discover new blocks by solving the PoW.
- The rate of creation of new bitcoins decreases by 50% every 210000 blocks, which is roughly every four years.
- After 210000 blocks, the block reward halves. In November 2021 it halved down to 25 bitcoins. Currently, since May 2020, it is 6.25 bitcoins per block.
- Mining difficulty increases over time and bitcoins that could once be mined by a single-cpu laptop computer now require dedicated mining centers to solve the hash puzzle.
- The difficulty is calculated every 2016 blocks (around two weeks) and adjusted accordingly.
- The Bitcoins miners have to calculate hashes to solve the PoW algorithm.
- The hash rate basically represents the rate of hash calculation per second.
- As the core principle behind mining is based on the double SHA256 algorithm, over time, experts have developed sophisticated systems to calculate the hash faster and faster.
- ASICs were designed to perform SHA-256 operations.
- Currently mining is out of the reach of individuals due to the vast amount of energy and money needed to be spent in order to build a profitable mining platform.
- Solo mining is not very profitable now.
- Chapter 7: the Bitcoin network and payment
- The Bitcoin network is a peer-to-peer (P2P) network where nodes perform transactions.
- There are different types of nodes on the network. The two main types of nodes are full nodes and simple payment verification (SPV) nodes.
- SPV nodes only download the headers of the blocks while syncing with the network.
- SPV clients are used to verify payments without requiring the download of the full blockchain.
- On a Bitcoin network, there are full clients (nodes), which perform the function of storing a complete blockchain. If you cannot run a full node, then SPV clients can be used to verify that particular transactions are present in the block by only downloading the block headers instead of the entire blockchain. At times, even running an SPV node is not feasible (especially on low-resource devices such as mobile phone) and the requirement is only to send and receive Bitcoin somehow. For tis purpose, wallets (wallet software) are used that do not require downloading even the block headers.
- Since version 0.10.0, the initial block download method named headers-first was introduced. This resulted in major performance improvement, and blockchain synchronization that used to take days to complete started taking only a few hours.
- The wallet software is used to generate and store cryptographic keys. It performs various useful functions, such as receiving and sending Bitcoin, backing up keys, and keeping track of the balance available.
- Private keys are used by wallets to sign the outgoing transactions. Wallet do not store any coins, and there is no concept of wallets storing balance or coins for a user. In fact, in the Bitcoin network, coins do not exist; instead, only transaction information is stored on the blockchain (more precisely, UTXO, unspent outputs), which are then used to calculate the number of bitcoins.
- Paper wallets can be generated on line from various service providers such as https://bitcoinpaperwallet.com or https://www.bitaddress.org/
- Lightning network is a solution for scalable off-blockchain instant payments. It was introduced in early 2016 and allows off-blockchain payments.
- Innovation in Bitcoin: improvement proposals are usually made in the form of Bitcoin Improvement proposals (BIPs).
- Excellent ideas have emerged from research and innovation efforts related to Bitcoin.
- The Bitcoin network can only process approximately three to seven transactions per second which is a tiny number compared to Visa network which can process on average 24,000 transactions per second. PayPal can process approximately 200 transactions per second whereas Ethereum can process up to, on average 20.
- The Segregated Witness (SegWit): the key idea behind SegWit is the separation of signature data from transaction data (that is, a transaction Merkle tree), which results in the size of the transaction being reduced.
- Not only has the original Bitcoin evolved quite significantly since its introduction, but there are also new blockchains that are either forks of Bitcoin or novel implementations of the Bitcoin protocol with advanced features.
- Bitcoin cash (BCH) uses Proof of Work (PoW) as a consensus algorithm, and mining hardware is still ASIC-based.
- Bitcoin Gold is hard fork and uses the Equihash algorithm as its mining algorithm instead of PoW.
- Market orders means that as soon as the prices match, the order will be fulfilled immediately. Limit orders allow for buying and selling a set number of bitcoins at a specified price or better.
- Chapter 8: Bitcoin Clients and APIs
- The Bitcoin client can be installed from https://bitcoin.org/en/download
- A Bitcoin client is a piece of software that is responsible for generating private/public key pairs and facilitates Bitcoin payments using the Bitcoin blockchain.
- The Bitcoin source code can be downloaded and compiled if users wish to participate in the Bitcoin code or for learning purposes.
- Regtest mode (regression testing mode) can be used to create a local private blockchain for testing purposes.
- Using the HTTP REST interface available at https://bitcoincore.org/en/doc/0.19.0/rpc
- Blockchain info: https://blockchain.info/api
- BitPay: https://bitpay.com/api
- Block.io: https://www.block.io
- Chapter 9: Alternative Coins
- Alternative approaches to Bitcoin can be divided broadly into two categories, based on the primary purpose of their development. If the primary goal is to build a decentralized blockchain platform, they are called alternative chains; if the sole purpose of the alternative project is to introduce a new virtual currency, it is called an altcoin.
- Namecoin: the primary purpose is to provide decentralized naming and identity services instead.
- Ethereum classic is the old chain and Ethereum is the new chain after the fork. Such a contentious hard fork is not desirable.
- Altcoins must be able to attract new users, trades and miners.
- Currency gains its value, especially in the virtual currency space, due to the network effect and its acceptability by the community.
- The power is shifting toward miners or mining pools who can afford large-scale ASIC farms. This power shift challenges the core philosophy of the decentralization of Bitcoin.
- PoW does have various drawbacks, and the biggest of all is energy consumption. It is estimated that the total electricity consumed by Bitcoin miners currently is more than that of Greece at 59.61 Terawatt hash (TWh)
- Proof of Stake (PoS): users are required to demonstrate the possession of a certain amount of currency (coins), thus proving that they have a stake in the coin.
- In Bitcoin, the difficulty is adjusted every 2016 blocks.
- Privacy and anonymity: as the blockchain is a public ledger of all transactions and is openly available, it becomes easy to analyze it. This is a big concern from a privacy point of view. Various proposals have been made to address the privacy issue in Bitcoin. These proposals fall into three categories: mixing protocols, third-party mixing networks and inherent anonymity.
- Dandelion is a proposal that aims to make transactions on a Bitcoin network untraceable. The Dandelion protocol is composed of an anonymity phase and a spreading.
- Colored coins: coloring a bitcoin refers colloquially to updating it with some metadata representing a digital asset (smart property). The coin still works and operates as a Bitcoin, but additionally carries some metadata that represents some assets.
- Colored coins can be used to represent a multitude of assets, including, but not limited to, commodities, certificates, shares, bonds and voting.
- Counterparty is another service that can be used to create custom tokens.
- Counterparty works based on the same idea as colored coins by embedding data into regular Bitcoins transactions, but provides a much more productive library and a set of powerful tools to support the handling of digital assets.
- Counterparty allows the development of smart contracts on Ethereum using the Solidity language and allows interaction with the Bitcoin blockchain.
- Development of altcoins: Altcoin projects can be started very quickly from a coding point of view by simply forking the Bitcoin or another coin's source code, but this is probably not enough. Usually, the code base is written in C++, as was the case for Bitcoin, but almost any language can be used to develop coin projects; for example Golang or Rust.
- Reward halving rate: Bitcoin is halved every 4 years and now is set to 12.5 Bitcoin.
- Total supply of coins: this number sets the total limit of the coins that can be ever be generated.In Bitcoin, the limit is 21 million, whereas in Dogecoin, it's unlimited.
- Token versus cryptocurrency: A cryptocurrency is a native coin for a standalone blockchain. In contrast, a token is a representation of the value of some asset.
- Initial Coin Offering (ICO) is a method for crowdfunding. The first successful ICO was that of Ethereum, which raised 18 million USD in 2014. A recent success is Tezos, which made 232 million USD in a few weeks. Another example is Filecoin, which raised more than 250 million USD. A more recent example is EOS, which raised a record of over 4 billion USD.
- Ethereum has become a platform of choice for ICOs due to its ability to create new tokens and with the ERC20 (Ethereum Request for Comments)standard, it has become even more accessible.
- Cryptocurrencies are a very attractive area for research.
- Chapter 10: Smart Contracts
- Smart contracts are now on going and intense area of research in the blockchain space.
- Smart contracts can bring many benefits such ad increased security, cost-saving and transparency to industries (especially the finance industry).
- Nick Szabo forts theorized smart contracts in the 1990's.
- A smart contract is a secure and unstoppable computer program representing an agreement that is automatically executable and enforceable.
- Code is the law.
- Certain inputs that need to be provided by people can and should be also automated. Oracles can be used for that purpose.
- English law recognized crypto assets as traceable property and smart contracts as enforceable agreements. This announcement was made by the UK Jurisdiction Taskforce (UKJT) (https://technation.io/news/uk-takes-significant-step-in-legal-certainty-for-smart-contracts-and-cryptocurrencies)
- If humans and machines can both understand the code written in a smart contract, it might become acceptable in legal situations, as opposed to just a piece of code that no one understands except for programmers.
- Legal Knowledge Interchange Format (LKIF)
- Smart contract have the following properties:
- automatically executable
- enforceable
- deterministic
- semantically sound
- unstop-able
- Ricardian contracts (https://iang.org/papers/fc7.html) fundamental: write a document that is understood and accepted by both a court of law and computer software.
- Consider a smart contract as a standalone entity that is capable of encoding legal prose and code (business logic)
- Solidity is a language that has been introduced with the Ethereum blockchain to write smart contracts.
- Tibco StreamBase product is a Java based system used for building event-driven, high frequency trading systems is an equivalent to DApp (Decentralized App)
- An inherent limitation with smart contracts is that they are unable to access any external data. The concept of oracles was introduced to address this issue. An oracle is an off-chain source of information that provides the required information to the smart contracts on the blockchain.
- The limitation with smart contracts is that they cannot access external data because blockchains are closed systems without any access to the real world.
- An oracle can be defined as an interface that delivers data from an external source to smart contracts.
- TLS notary provides a piece of irrefutable evidence to an auditor that specific web traffic has occurred between a client and a server. In is based on TLS (Transport Layer Security).
- To prove the authenticity of the data retrieved by oracles from external resources, attestation such as the TLSNotary are used.
- Ledger proof, Ledger Nanao S: the primary purpose of these devices is a secure hardware cryptocurrency. These devices run a particular OS called Blockchain Open Ledger Operating system (BOLOS)
- A trusted hardware assisted proof is Town Crier (https://www.town-crier.org) which provides an authenticated data feed for smart contracts. It uses Intel SGX to provide a security guarantee that the requested data has come from an existing trustworthy source.
- Various other blockchain platforms support smart contracts such as Monax, Lisk, Counterparty, Stellar, Hyperledger fabric, Axoni core, Neo, EOSIO and Tezos.
- DAO: Decentralized Autonomous Organization was a smart contract written to provide a platform for investment.
- DAO: due to a bug, called the reentrancy bug, it was hacked in June 2016. An equivalent to approximately 3.6 million ether was siphoned out of the DAO into another account. This incident resulted in a hard fork on the Ethereum blockchain, which was introduced to recover from the attack. Subsequently, resistance against this hard fork resulted in the creation oof Ethereum Classic, where a large number of users decided to keep the mining on the old chain.
- The security of smart contracts is an area of deep interest for researchers.
- Ricardian contracts are concerned with the definition of the contract, whereas smart contracts are geared toward the actual execution of the contract.
- Chapter 11: Ethereum 101
- Ethereum has its own decentralized and distributed ecosystem that uses Swarm for storage and the Whisper protocol for communication.
- USDT token (Tethers) using the ERC 20 standard.
- Merkle-Patricia trees are used in the Ethereum blockchain.
- Ethereum with its Serenity release will soon transition to a PoS based consensus algorithm.
- DeFi
- Des liens nouveaux et intéressants
- Acronymes
- AML: Anti Money Laundering
- BFT: Byzantine Fault Tolerance
- CAP Theorem : Consistency, Availability and Partition
- DAO: Decentralized Autonomous Organization
- EVM : Ethereum Virtual Machine
- ECC: Elliptic Curve Cryptography
- KYC: Know Your Customer
- Nonce: a nonce is a number that is generated and used only once.
- Merkle root: In a blockchain block, it is the combined hash of the transactions in the block
- PBFT: Practical Byzantine Fault Tolerance
- Translation
- escrow: dépôt
- unredeemable: non réclamable
- tumbler: acrobate
Aucun commentaire:
Enregistrer un commentaire