What Is Bitcoin BTC?
The banking crisis of late 2000s had many deleterious economic effects but it also sowed seeds for a new economic system without banks. In his seminal paper which was emailed to the Cryptography mailing list (a group of cypherpunks), the pseudonymous founder, Satoshi Nakamoto proposed Bitcoin as a “new electronic cash system that's fully peer-to-peer, with no trusted third party.”
“A purely peer-to-peer version of electronic cash would allow online payments to be sent directly from one party to another without the burdens of going through a financial institution. Digital signatures provide part of the solution, but the main benefits are lost if a trusted party is still required to prevent double-spending. We propose a solution to the double-spending problem using a peer-to-peer network. The network timestamps transactions by hashing them into an ongoing chain of hash-based proof-of-work, forming a record that cannot be changed without redoing the proof-of-work. The longest chain not only serves as proof of the sequence of events witnessed, but proof that it came from the largest pool of CPU power. As long as honest nodes control the most CPU power on the network, they can generate the longest chain and outpace any attackers. The network itself requires minimal structure. Messages are broadcasted on a best effort basis, and nodes can leave and rejoin the network at will, accepting the longest proof-of-work chain as proof of what happened while they were gone.”
The proposal was initially met with much skepticism, with fellow cypherpunks raising concerns over scalability and centralization risk, among other things. Nonetheless, it was the first digital cash system to solve the double-spending problem and thus, a revolution was born.
What Is A Blockchain?
A blockchain is an immutable, distributed public ledger consisting of a chronological sequence of data sets (blocks) shared by every node (computer) on the network. It is at the core of the bitcoin network and stores all transactions made on the network. Since every node possesses a copy of the blockchain, no single node or a group of nodes is in control and the data cannot be retroactively falsified.
A Bitcoin public address represents the destination of a bitcoin payment, consisting of 26-35 alphanumeric characters. They begin with either the number 1 or 3 – P2PKH address formats begin with 1 and the newer P2SH formats begin with 3.
Addresses are case-sensitive and cannot include uppercase letter “O”, uppercase letter “I”, lowercase letter “l”, and the number “0” to prevent ambiguity.
The private key is a 256-bit hexadecimal number used to spend bitcoins from a public address. While a public address is visible to anyone on the network, the corresponding private key is known only to the owner of a wallet. Knowing the private key to an address allows anyone to spend bitcoins from that address and is therefore imperative that private key be kept secret and secure.
All transactions are stored on the blockchain through one-way encryption using a mathematical algorithm (hash function) which maps data to a bit string (hash). Hash is a string of numbers and letters that serves to verify data validity without explicitly revealing the data.
Bitcoin transactions have inputs and outputs. Input is the bitcoin address, corresponding hashed signature (using private key) and the amount of bitcoin contained within an address. Output consists of the amount of bitcoin being sent to the recipient's address and UTXO (unspent transaction output) which is returned to the sender's wallet and can be used as an input in a new transaction. Each transaction references previous transaction output as the new input.
For a transaction to become valid on the bitcoin network, it requires confirmation through a process known as Proof of Work (PoW). After a transaction is broadcast to the network, it is included in a block by miners who verify the authenticity of the data. A block is generated roughly every 10 minutes.
When a transaction is included in a block, it is said to have one confirmation. With each further block built on top of the block containing a transaction, the number of confirmations increase by one. Transactions with more than 2 confirmations are said to be sufficiently secure from attacks altering the course of the blockchain.
Proof of Work (PoW)
In order to prevent tampering with the blockchain/ledger, Bitcoin uses a protocol known as Proof of Work (PoW) to achieve consensus. This requires nodes on the network known as miners to generate a corresponding hash function for a set of transactions below a given target. The hash is a one-way function: it cannot be used to obtain the original data, only to check that the data that generated the hash matches the original data. Even the slightest change to a set of data drastically changes resulting hash function.
Bitcoin network calibrates the difficulty for finding the target to ensure that a new block is generated roughly every 10 minutes. The lower this target, fewer the valid hashes and higher the difficulty of finding a valid hash. The SHA-256 hashes begin with a string of zeros. For miners, computing a valid hash entails a trial and error process of adding an integer value called a nonce to the base string and incrementing it each time. Once a miner computes a valid hash, it is broadcast to the network and the generated block is added to the blockchain.
Miners are rewarded for their work with both the transaction fees contained within the block and newly generated bitcoins known as block reward. Block reward halves every 210,000 blocks (roughly every 4 years). At this rate, all 21 million bitcoins will be released by 2140, after which miners' reward for securing the network will consist exclusively of transaction fees.
Formulated by Dr. Pieter Wuille, Segregated Witness (SegWit) is an implementation which changed the transaction format for bitcoin transactions by removing signature data from the original portion and appending it as a separate structure at the end. As the signature data accounts for 65% of space in a transaction, this increases the space available for transactions within a block, thereby allowing transactions to be processed faster. Bitcoin blocks are 1 mb in size. SegWit effectively increases the size four-fold.
In addition, Segwit also addresses transaction malleability, which is an exploit where a receiver could intercept and modify the sender’s transaction ID in a bid to get more coins from the sender. With the signature data removed from the input, it is impossible for an unscrupulous party to modify the transaction ID.
Blockchains are inherently difficult to scale on-chain. The means to scalability has been a contentious point of debate for a few years within the bitcoin community. Off-chain state channels offer the most secure and sustainable solution.
Lightning Network allows users on the network to make numerous transactions without broadcasting on the blockchain via state channels on the secondary layer. Opening a payment channel, however, requires a funding transaction which is performed on the blockchain.
Once a channel is open, any number of transactions can occur between participants, with each transaction updating the state or allocation of funds. Only the most recent state is valid.
Payment on the Lightning Network is secured using smart-contract scripting which is enforceable on the blockchain. Uncooperative participants are penalized using time-locked smart contract functionalities.