Last updated: Sep 9, 2018
To allow peer-to-peer online payments without a trusted third-party by forming a decentralized network of miners, incentivized to maintain an honest chain of transaction blocks.
First block: January 2009
Block explorer: https://blockchain.info
Supply limit: 21,000,000 BTC
Issuance: Block reward
Block confirmation: Proof-of-Work
Mining algorithm: SHA-256
Block size: 1mb
Developments: Replace-by-fee, Segregated Witness, Lightning Network
Bitcoin is a protocol run by a network of computers. They work together to keep track of everyone’s bitcoins and transactions. Bitcoins are stored on a keypair comprised of a public address and private key called a wallet. Users can spend bitcoins by using their private key to broadcast a transaction from their wallet to the Bitcoin network. Computers on the network will receive this transaction and add it to the newest ‘block’ of transactions. A chain of these blocks maintains a record of all transactions, which is where the ‘blockchain’ name comes from. The blockchain is a shared public ledger available to everyone to see. As soon as your transaction is confirmed, it can be seen on the blockchain and traced back to all previous transactions leading up to it since the very beginning.
Wallets are keypairs comprised of two parts: a public address and a private key. The public address is used to receive bitcoin transactions from other users, similar to an e-mail address. The private key is used to send bitcoin transactions to other users, simlar to a password. However, Bitcoin public addresses and private keys are cryptographically generated. A Bitcoin keypair starts off as a private key composed of a 256-bit number string. This number string is cryptographically hashed several times in order to generate the public address. Due to the complexity of the cryptography, the chances of generating the same keypair or reversing the hash to hack the private key is virtually impossible.
Transactions transfer ownership of bitcoins between wallets. The data contained in a transaction helps verify and determine the movement of bitcoins. A transaction’s input data verifies that bitcoins are available to be spent by referencing the output data of a previous transaction. The input data is basically saying, ‘this is where the bitcoins came from and is available to be spent from this address’. Input data also includes a signature from the wallet holder to verify that the user has access to the bitcoins. The output data takes the verified bitcoins and sends it to a new wallet address. When a new transaction is broadcasted to the Bitcoin network, it is considered an ‘unspent transaction’, which enters a memory pool shared amongst the network. An optional transaction fee may be added to the transaction to increase the its priority in the memory pool.
Blocks contain a shortlist of transactions chosen from the unspent transactions memory pool based on their priority. Blocks also contain a hash of the previous block’s data to check for continuity in the blockchain. Computers in the Bitcoin network perform a complicated mathematical calculation to solve this hash. The difficulty of the hash is automatically adjusted to ensure new blocks are added every 10 minutes. Once the hash is solved, all other computers in the network can easily verify the solution, accept the block, and begin working on the next block. Connecting each subsequent block with a hash of the previous block ensures the chronological continuity of blocks called the blockchain. The blockchain records a complete and practically irreversible history of all Bitcoin transactions since the first block.
Nodes are computers that receive transactions from users and propagate the transactions to the rest of the network. Full nodes are also responsible for performing the calculations necessary to solve a block’s hash and confirm those transactions onto the blockchain. This activity is called mining because performing this work yields a block reward. A block reward is comprised of a predetermined amount of bitcoins as well as any transaction fees included in the block. The full node that successfully solves the hash determines the bitcoin address to receive the reward. The first block reward started at 50BTC and is reduced by half every 210,000 blocks. Eventually, the total amount of Bitcoins available will max out around 21,000,000 and the block reward will largely be funded by transaction fees. Nodes also maintain a copy of the distributed blockchain.
Confirmations occur when blocks are mined. A transaction receives its first confirmation when it is included in a newly mined block. Additional confirmations refer to the number of subsequent blocks mined afterwards. A high number of confirmations ensures that a transaction is buried deep enough in the blockchain to be effectively irreversible. The recommended number of confirmations is 6 for a transaction to be considered secure. This does not mean a transaction with 0 confirmations is invalid, rather it is simply less secure because it is sitting in the unspent transaction memory pool. As long as the transaction is broadcasted to the network, it will confirmed eventually.
Current Developments Regarding Scalability
Since all transactions contain a package of data, the current block-size of 1mb can only fit a limited number of transactions at a time. Once a block is filled, subsequent unspent transactions will have stay in the memory pool and wait for the next block. As the unspent transaction memory pool grows, confirmation times and transaction fees increase. Increasing the block-size in order to include more transactions is deemed to be an unsustainable method of scaling by large part of the Bitcoin community. An ever increasing block-size would increase the storage and bandwidth requirements of running a full-node at an exponential rate. Three developments have been introduced to solve Bitcoin’s scalability problem: replace-by-fee, Segregated Witness, and the Lightning Network.
Replace-by-fee allows unconfirmed transactions to be replaced by spending the same bitcoins with a higher transaction fee. The new transaction will take priority due to its higher reward to miners, causing the first transaction to become invalid. This was a quick-fix to overwrite unspent transactions that were stuck in the mempool indefinitely. Since they can be re-written, unconfirmed transactions are not reliable.
Segregated Witness (SegWit) reduces the size of a transaction by segregating the witness data within a transaction. The witness data is necessary to check the validity of a transaction, but not required to complete the transaction. Reducing the data in a transaction allows more transactions to be added to a single block without having to increase the block-size. This is an optional feature to the Bitcoin ecosystem to avoid a hardfork.
Lightning Network (LN) is an off-chain local consensus network allowing users to transfer bitcoins without broadcasting every transaction to the Bitcoin network. Users must open a channel by transferring bitcoins to a shared multi-signature wallet. The amount of bitcoins in the channel is now available to be spent between the two users. Transacting in this channel requires the two users to agree on updating the outgoing transaction of the multi-signature wallet. This changes how much bitcoin each user receives when the channel is closed. Since the outgoing transaction is cryptographically signed by both users, one of the users can decide to close the channel and settle the resulting balance on the Bitcoin blockchain as a single transaction, thereby sending the bitcoins from the multi-signature wallet back to the owners respectively. Open channels can be connected like a web to include all LN users to each other. This development is still a work in progress. For a more comprehensive explanation, you can refer to the whitepaper here.