A blockchain is formed when transactions are verified on the bitcoin network after they have been completed. Until this is not done, the transaction is neither verified nor considered legitimate for all uses or purposes. Not to worry though, considering how, on average after every ten minutes or so a new block, complete with all the transactions maintained in the last block, is formed, blockchains are a common enough occurrence in the bitcoin network.
The new transactions also consistently keep on flowing into the network. They are carried out via various applications as well as from users’ wallets. They are then identified by ‘nodes’ present in the bitcoin network whereupon they are added to a ‘pool.’ This pool consists mainly of unidentified transactions that have been maintained by the various nodes in the network. To build a new block, miners then use the database of unverified transactions from the available pool and add it to form the new block. They must then face the task of proving the validity of this new block so that it may become part of the blockchain.
There is a specific order in which transactions must be added to the new block. This mainly consists of keeping in view certain criteria including, but not limited to highest-fee transactions that must come first, while the rest of the transactions follow in a descending order. It is more in the nature of a game, where the miners are like the players in the network, pitted against each other. Every miner begins the process of mining for a new block immediately upon reception of the transactions that have been placed in the previous block. As soon as they receive this information from the network they start off on their task of building a new block.
It is important they lose no time in doing so because they are already aware that they have lost the previous round of the competition. To keep earning in the bitcoin network, it is essential to keep on successfully building blocks that will help miners successfully mine for bitcoins. The new blocks that are created are not only filled with unverified transactions from the pool but also the fingerprint of the last block that had been created (on average) ten minutes before. The miners then begin to calculate the Proof-of-Work for this newly created block. At the end of this whole process, each miner also adds a unique transaction to their block. The purpose of this is to pay an award of freshly created bitcoins to their own bitcoin address. If they have found a solution that validates their block, they have won this award as their block has now been added to, and become a part of the global blockchain. The successful miner’s reward transaction is now included in their hoard of bitcoins and they may spend it as and when they wish.
The Reference Client Bitcoin Core, also known as the “Satoshi client”, is also available for downloading, from bitcoin.org. This reference client is also designed to implement all the different aspects of the bitcoin system, inclusive of wallets, the transaction verification engine and a copy of the entire transaction ledger (blockchain) as well as a full network node in the peer-to-peer bitcoin network.
For its part, a blockchain data structure is an account of all the transaction locks that have been formulated. This orderly, back-linked list of transaction blocks may be stored either as a flat file, even in the form of a simple database. Using a Google LevelDB database, a core client can store all the metadata that went into the formation of a blockchain. In doing so what basically happens is that blocks are all simply linked “back”, with each block referring to the previous one in the blockchain via the signature of the previous block that has been placed on it. To comprehend the whole idea of the blockchain even better, it would be a good idea to consider it like a vertical stack: the new blocks are all layered on top of the previous ones while the first ever block is the foundation on which this blockchain has been built. This visualization now brings another idea to the forefront; ‘height’ or rather the height to which these blockchains may extend as well as the distance between the first and the last-placed block, or the ‘top’ or ‘tip’ as it is often called.
The different blocks within a particular blockchain can be identified using a (#) hash. This is generated by making use of the SHA256 cryptographic hash algorithm which can be placed on the header of any given individual block. The previous block, also referred to as the ‘parent’ block, is referenced by the new block. This is done by using a “previous block hash” field in the block header. As a result, every newly created block also holds the hash of its parent block within its own header. When they are all taken together, we have a sequence of hashes, each one of them linking back to its parent and in doing so creating a chain that goes back all the way to the first ever created block, the Genesis block.
Each block has just the one parent, but the same does not necessarily hold true for the child block. One parent block can potentially have multiple children, although this is just a temporary situation. Each of these ‘offspring-blocks’ tag the same block as its parent, and by using this hash in their header, pose as multiple children of a single, parent block. This situation only occurs when different miners simultaneously discover different ‘child-blocks.’ However, this ‘fork’ situation cannot continue indefinitely. A single child block is chosen and used to continue the chain while the rest of the child blocks are refuted and resolved. As a result of this method of choosing only a single block to continue the chain, it is ensured that a newly created block can only have a single parent. The rest of the blocks that had been simultaneously created and included in the ‘block-fork’ have now been eliminated and one chosen block alone can become part of the blockchain.
The block hash of the previous block, contained as it is in the header of the current block also controls the way in which a block may be identified: if the header of the previous block is changed, the header of the current block will change likewise. This means that as this train of changes continue, it will affect all the ‘children-blocks’ down the generations for any single parent block. To avoid this domino-style affect from occurring is a concern which commands the attention of all bitcoin miners because of the implications involved otherwise. The recalculations alone would need a lot of computation. Since a long blockchain would require all that much more work being s=done to make the slightest of changes, would require enormous computation, the existence of a long chain of blocks makes the blockchain’s history virtually immutable. This can now become a key feature of bitcoin’s security. The most recent blocks may obviously be revised, especially if recalculations may need doing because of discrepancies caused by a blockchain.
The block is like a container full of data structures that will go on to aggregate transactions that will eventually be included in the public ledger. The block header is estimated at 80 bytes, average transactions are 250 bytes while average blocks host over 500 transactions. A complete block, inclusive of all its transactions may be estimated as being one thousand times bigger than the header.