The oldest, most well known and arguably the symbol of crypto buzz is based on a few concepts that have been around for some time. The ledger has been around for a few centuries. Gold is popular as medium of transaction and store of value for thousands of years. It is not by coincidence that gold attained that position. Gold does not oxidized or rust, gold heavier than all readily available metals hence impossible to fake, gold is hard to destruct, requires aqua regia — a very potent mixture of nitric and hydrochloric acid, etc. The advances in Internet, cryptography and computing made it possible to implement these ideas eventually in a novel way in the past couple of decades.
The first or genesis block |
Main concepts:
The following are the major concepts used in bitcoin.
- Ledger — block chain
- Immutability and durability— block chain and hash
- Trust — Proof of Work and consensus
- Reward and fees — coinbase and satoshi
- Transaction and script — Authentication and authorization
- Information sharing — peer-to-peer network
- Mempool — store of all unconfirmed or not blocked transactions
- Wallets — addresses and accounting
The ledger is the database or the place where all transactions are recorded. In that way it is no different from a physical ledger book. Just like a physical ledger is divided into pages, bitcoin ledger in also divided into blocks. Each block can contain 0 to many transactions. A transaction has 0 or more inputs and 1 or more outputs.
The ledger is a chain or a list of connected blocks. Once blocks are added/written to the chain, they are immutable as each block contains reference to the previous block. A block can only be added if they meet certain requirements, most important of which being Proof of Work (PoW). Very simply put, PoW is the compute needed to find a proper hash of the header part of the block. Hash produces an (almost) unique signature. There is an extremely small probability that hash of two block is same, chaining makes that even more unlikely. The spending of resources to produce a proper hash is the PoW. The willingness to spend resources to produce a good hash is part of the trust mechanism.
Per transaction fees are charged by the entity (called miner) that adds the transaction to a block of ledger. Reward is an additional amount offered to the miner for verifying a block and adding it to the ledger. This is an extra incentive paid to the miner to encourage take up of bitcoin and added to a block by a unique transaction, called coinbase, that has no input. Currently reward at 6.25 btc is far higher than fees. The reward value halves every 4 years. Hence eventually in 100+ years, reward will become 0. But well before that, mining may become a low margin business, when resources needed to produce a block becomes close the reward and fees.
For example, on November 15, 2021, miners earned $47.47 m in total reward, of that only about $0.54 m was from transaction fees. About 1130 bitcoins were mined. Considering about $10,000 for cost to mine a bitcoin (see below in the stats section), total mining cost was about $11.3 m. Using bitcoin value of about $42,000, cost roughly was 1/4 th of value. With the current reward at 6.25 bitcoins, that is 1/25 th of reward . Hence just 5 halving (1/32) in reward would be enough for cost to be more than reward — that is 20 years away. Of course, the simplistic analysis assumes bitcoin price and mining cost remain constant. If bitcoin price goes down or cost increases, break even time will come sooner. On the other hand, if bitcoin price goes up and cost of mining decreases, then the break even day recedes further out into the future. The bitcoin hashing difficulty would also be reduced if block creation time slows, hence reducing cost and making mining more viable.
Unconfirmed transactions, ones not yet in the block chain, are kept in something called mempool. A mining node grabs transactions from the mempool for creating a block.
Every transaction [12, 13] except for coinbase transaction, contains a set of inputs and outputs. The difference between the sum of inputs and output becomes the fee. Every input refers to a transaction with unspent transaction output (UTXO) that has a positive amount of satoshis. Every input contains a script that unlocks the amount in the referred UTXO. The unlocking is essentially done by having a signature in the script created by the private key of the address that the UTXO was addressed to. Outputs of a transaction refers to a script and an amount. The script verifies the hash of the public key and signature of the transaction. This achieves the properties needed for a valid transaction — authentication, authorization, non-repudiability, and durability.
Bitcoin addresses are 160 bytes long hash of the public part of the Elliptic Curve Digital Signature (ECDS) [4]. The private part is kept securely in a wallet. A wallet keeps track of all transactions involving its own address and maintains the balance — the ledger only records transactions, it does not track account balances.
Bitcoin script [14] is a simple and stack-based language. It is processed from left to right, is not Turing-complete and has no loops. Addresses and signatures are only used through script.
Every full node in the Bitcoin network follows a number of rules that checks that each transaction, blocks , etc are indeed correct. At any point of time each mining node’s view of the chain can be slightly different. Blocks can be simultaneously mined by a number of miners. Depending on how nodes are connected to peers, different nodes get to see different new blocks. Eventually all mining nodes agree on the longest or the most difficult chain [2, 25]. Given the widely distributed nature of the network, the final settling of a block in the chain may take hours. Unfortunately, some blocks may never get settled into the main chain, in that scenario all the PoW effort of miner gets wasted. These blocks are often called orphan or stale blocks.
Limits :
- Number of bitcoins — 21 million.
- Rate of block creation — about 1 per 10 minutes . Adjusted to remain around 10 minutes every 14 days or 2016 blocks by changing the difficulty of hash.
- Smallest part of bitcoin is a satoshi — 1 bitcoin is 100,000, 000 satoshis.
- End of reward — about 2137 , when reward for creating a block becomes 1 satoshi. After that miners will only earn fees.
- Maximum block size — 4 byte number, hence 4 GB
Bitcoins are created only by mining or creating a valid new block. The 21 million limit is set by 4 design choices — rate of block creation (6 bitcoins /hour), smallest unit (1 satoshi), starting reward (50 bitcoins), and reward having every 210,000 blocks (or 4 years). It is not clear why these particular choices were made by Nakamoto Satoshi.
The maximum block size is set in 4 bytes , hence 4 GB. The current biggest block sizes are far smaller — in 1 MB range. One way to increase bitcoin transaction speed is to create very large blocks in the 10 minutes required to create one block.
The choice of limiting the rate of bitcoin/block creation is understandable as otherwise miners would create them as fast as possible and hence would exhaust the supply quickly. Although, the block creation rate is throttled, there appears to be no minimum number of transactions in a block. Early on there were very few transactions, hence not setting a limit at that phase made sense. However, at a more mature stage, like the present, this loophole could be exploited by miners to just include a small number of transactions or none. On the positive side, the main cost of mining comes from many trial and error of finding the right nonce to produce the appropriate hash, rather than hashing the transactions and creating the transaction merkel tree.
Statistics:
- Largest block [1] — 1.471 MB on 12/27/2021
- Smallest block [1]— ~0 MB from 1/16/2009 to 6/09/2010
- Quickest block [1]— ~ 3.367 min on 9/7/2019
- Slowest block [1]— ` 28.95 min on 06/12/2012 and 08/21/2017
- Most transactions in a block [1] — ~ 2713 on 3/31/2019
- Highest per transaction fee [1]— $59.858 on 04/19/2021
- Lowest per transaction fee [1] — $0 — from 1/16/2009 to ~ 03/19/2011
- Highest transactions per sec [1]— 7.733 on 04/16/2019
- Lowest transactions per sec [1]— 1.25 on 06/21/2018
- Number of wallets with 1000+ BTC [3] — 2258 with 7.9 million BTC,
- Number of individuals with 1000+ BTC [3] — 1013
- Most bitcoin in a wallet [5] — 252,597 belongs to Binance
- Number of unique wallets [1] — 80 million
- Number of nodes in bitcoin network [6] — about 15, 000
- Cost of mining 1 bitcoin [7] — about $10,100.00 for RIOT
- Number of big miners [10, 11] — about 12 pools and 6 public companies
- Most prolific miner [10, 11] — FoundryUSA Pool (750), RIOT (458)
- Number of orphaned blocks [26] — probably below 10 per day.
Technologies:
- SHA256 hashing [4]
- Elliptic Curve Digital Signature Algorithm (ECDSA) public key [4]
- Secp256k1 — parameters of elliptic curve used in Bitcoin’s public-key cryptography [4]
- Merkel Tree [15]
- Schnorr signature — new in the recent Taproot update
- TCP/IP based peer-to-peer network [8]—
- C++ based software [8] —
The recent Taproot [16] upgrade ( supported by 90% of miners and was activated in block 709,632 on 11/14/2021) to Bitcoin brings 3 salient features. One is Schnorr signature. Each node has to verify each ECDSA signature of each transaction in a block one by one. Schnorr is linear and hence a proper aggregation of many signature allows verification of just the aggregated signature versus every signature of the aggregate one by one. Schnorr also reduces compute for multi-signature transactions similarly by creating just one public key that can be used by all the private keys of a multi-sig transaction. The linearity property of Schnorr signature by its very nature can hide individual wallet public keys, hence providing privacy.
Merkelized Alternative Script Tree (MAST) [ 17, 18], is a tree structured program/script that uses a Merkle tree to encode mutually exclusive branches in a script. Only one leaf node of the MAST is executed. This structure enables more complex redemption conditions that were not possible. Also improves privacy by hiding unexecuted script or leaf nodes.
Tapscript removes 10,000 lines and fixed set of opcodes limits of original Bitcoin scripts.
Lightning network [20, 21] is a layer 2 overlay on the base bitcoin network/ledger. A channel is created between two transacting peers. Channel is a two-party transaction in which parties can make or receive payments from each other. Only the creation and closure of the channel is recorded in the bitcoin ledger. Thus freeing the channel to conduct many transaction at high speed. There are several implementations available [22, 23, 24] .
References:
- Bitcoin chain explorer, https://www.blockchain.com/explorer?view=btc
- Book, https://www.oreilly.com/library/view/mastering-bitcoin, https://github.com/bitcoinbook/bitcoinbook
- Blockchain Analysis of the Bitcoin Market, https://www.nber.org/papers/w29396
- Elliptic Curve Digital Signature, https://en.bitcoin.it/wiki/Elliptic_Curve_Digital_Signature_Algorithm
- Richest bitcoin addresses, https://bitinfocharts.com/top-100-richest-bitcoin-addresses.html
- Node count, https://bitnodes.io/
- Riot Corporate Presentation Updated January 14, 2022, https://d1io3yog0oux5.cloudfront.net/_f380ae3466e909021a4ffb0240eec459/riotblockchain/db/447/4156/pdf/RIOT+Corporate+Deck+011421.pdf
- Code repository, https://github.com/bitcoin
- Bitcoin wiki, https://en.bitcoin.it/wiki/Main_Page
- Bitcoin mining pools, https://btc.com/btc/insights-pools
- Most crypto miners’ bitcoin production grew in January as network difficulty hits new high, https://seekingalpha.com/news/3796143-most-crypto-miners-bitcoin-production-grew-in-january-as-network-difficulty-hits-new-high
- Transaction, https://developer.bitcoin.org/examples/transactions.html
- Transaction format, https://developer.bitcoin.org/reference/transactions.html#:~:text=Bitcoin%20transactions%20are%20broadcast%20between,part%20of%20the%20consensus%20rules.
- Script , https://en.bitcoin.it/wiki/Script
- Merkel tree — https://en.bitcoinwiki.org/wiki/Merkle_tree
- Taproot, https://en.bitcoin.it/wiki/BIP_0341
- Merkelized Abstract Syntax Trees, https://www.mit.edu/~jlrubin/public/pdfs/858report.pdf
- Merkelized Abstract Syntax Tree, https://en.bitcoin.it/wiki/BIP_0114
- Taproot script, SIGHASH_ANYPREVOUT for Taproot Scripts, https://en.bitcoin.it/wiki/BIP_0118
- Lightning network, https://cointelegraph.com/bitcoin-for-beginners/what-is-the-lightning-network-in-bitcoin-and-how-does-it-work
- Lightning network, https://lightning.network/
- Lightning network, https://github.com/lightningnetwork/lnd
- Lightning network, https://github.com/ElementsProject/lightning
- Lightning network, https://github.com/lightning/bolts/blob/master/00-introduction.md
- Block Chain, https://developer.bitcoin.org/devguide/block_chain.html
- Orphan blocks, https://www.blockchain.com/charts/n-orphaned-blocks
Comments
Post a Comment