it:blockchain
Table of Contents
blockchain, cryptocurrencies, bitcoin
see also:
blockchain technology
- a linked chain of secured, immutable transaction records distributed in a peer-to-peer (P2P) network
- blockchains can be used to protect the order and integrity of any type of transaction.
- each transaction is stored in a “block” which holds the following information:
- a Block hash = SHA256(BlockID + PrevBlockID + PrevBlockHash+UnderlyingDataHash)
- the block ID as an encrypted key:
- a Cryptographic Hash (specifically SHA256) which outputs a totally different, random looking signature for even a single bit change, is fast to compute, free of collisions (2 different inputs giving the same output), and non-reversible (can’t determine the input form the output)
- a public key signature or or Asymmetric Key Cryptography
- these are validated by using a Merkle Tree which is a binary tree of hashes, the leaves being data blocks, allowing you to check quickly if a certain leaf is valid even if there are many leaf nodes
- the PREVIOUS block's ID as an encrypted hash key
- hash version
- the transaction data such as:
- buyer's ID
- seller's ID
- transaction amount in cryptocurrency
- creation date and time
- *what makes the system secure and immutable (not able to be retrospectively modified or hacked)
- if the contents of a block is changed, the hash key changes and thus the block is no longer the same block
- for a hacker to do this, they would either:
- make all subsequent blocks in the chain void as they would then have invalid previous block IDs - hence the P2P would detect this and invalidate the hacker's changes
- use a super computer to recalculate the previous block hash ID for each subsequent block
- BUT this is effectively prevented by the Proof of Work technology (using brute force to determine the noonce integer to “mine” the hash key to get to the smallest possible hash key) which requires each blockchain modification to await 10 minutes to be validated, thus the P2P network would detect and prevent hackers from being able to change all the subsequent blocks
- in Bitcoin the target time between additions of blocks is 10 minutes. If miners regularly beat that time (using a 2 week moving average) the difficulty goes up (the number of zeroes required at the start of the hash/signature goes up) and if they lag behind the difficulty is reduced. When you add the next block you get a reward which decreases over time but is currently around 13 bitcoins in addition to a small transaction fee added to each transaction to entice miners to add it to their current block. There’s a reason Bitcoin mining uses more electricity than many small countries!
- the creators of a blockchain lay down the rules of how it works, for example, the Bitcoin blockchain protocol lays out:
- how large a block is in megabytes
- the number of transactions that can be processed per second
- how fees are calculated
- what rewards “miners” get (users who allow their computer to be part of the P2P network which then provides computational power to contribute to the P2P network to maintain blockchain)
- HOWEVER, users could decide to change the protocol to improve it by creating a “Hard Fork” which is then incompatible with the prior version but which would still inherit prior transactions (see https://youtu.be/XCo6yyutYAM), an example is in August 2017 when Bitcoin Cash hard fork was commenced after disagreement arose from how large the blocks should be as many wanted the block to be increased from 1Mb
- a soft fork is similar to a hard fork but is compatible with the prior version
issues with blockchains
- transaction capacity per second
- Bitcoin's 1Mb blocks allow only 7 transactions per second! - thus to address this, a “Lightning Network” (https://www.youtube.com/watch?v=rrr_zPmEiME) was established to allow small transactions to be stored “off-chain” and not stored within the main chain, while only the main payment channel between a vendor and buyer is stored on the main chain in a similar way to having a debit account - this means only 2 transactions are required on the main blockchain - one to open the “account” and another to close it and distribute the money remaining in there to each party
- transaction validation duration
- to avoid the need to download the whole transaction for each block in a chain, Merkle Trees are used to prove the validity of blocks -for example, if there are 420,000 blocks in a chain containing 75Gb of transactional data, you only need to download 13Mb to validate every transaction, and in Bitcoin, the header data (all the important information about the block) and the transaction data (all the actual transactions, the bulk of the data) are separate. Ethereum uses 3 sets of Merkle Patricia Trees 1)
- perhaps the biggest problem with blockchains are the size of the blockchain as it grows and how long it takes to download the whole chain to a computer so peers can validate a transaction by end of 2017, bitcoin was taking 4hrs to validate a transaction at a cost of $US40, while Ethereum's transaction time was severely slowed by an app, cryptokittens which was uploaded and just allows users to create and draw pictures of cute kittens but on the same chain as the Ether currency
- the Infinite Scaling Deletable Blockchain to the rescue
- PascalCoin was developed in 2016 and introduced the innovation of the Molina-SafeBox model which uses a hash to contain previous block information and can then allow deletion of a blockchain after 100 blocks yet retain the cryptographic security of the entire blockchain. This allows for much smaller and faster downloads of the blockchain and far better scalability.
smart contracts
- smart contracts is the blockchain terminology for immutable, distributed, programmed transactional algorithms which can control whether or not a block's transaction goes ahead or is wound back based on conditions being met
- Ethereum is an example of a blockchain which uses smart contracts programmed using Solidity and is designed for sales of music, etc under a digital copyright
cryptocurrency exchanges
it/blockchain.txt · Last modified: 2017/12/23 16:29 by gary1