How the blockchain works
A blockchain is a database encompassing a physical chain of fixed-length blocks that include 1 to N transactions, where each transaction added to a new block is validated and then inserted into the block. When the block is completed, it is added to the end of the existing chain of blocks. The only two operations are add transaction and view transaction. So the basic blockchain processing consists of the following steps:
- Add new and undeletable transactions and organize them into blocks.
- Cryptographically verify each transaction in the block.
- Append the new block to the end of the existing immutable blockchain.
More comprehensively, a blockchain is also a distributed database that maintains a doubly linked list of ordered blocks. Each block averages 1 megabyte and contains control data of approximately 200 bytes, such as a timestamp, a link to a previous block, some other fields, and 1 to N transactions as can fit in the remaining space.
The blocks once recorded are designed to be resistant to modification. Through the use of a peer-to-peer network and a distributed timestamping server, a public blockchain database is managed autonomously. Blockchains are an open, distributed ledger that can record transactions between two parties efficiently and in a verifiable and permanent way.
The ledger itself can also be programmed to trigger transactions automatically. Blockchains are secure by design and an example of a distributed computing system of interactive consistency, of decentralized consensus. These features make blockchains ideal for recording events, medical records, identity management, transaction processing, and a host of emerging applications.
The public blockchain is also a peer-to-peer program with one very important difference: not only does it move files (data) from peer to peer, it also ensures that all the peers have the same exact data. It enforces this. If the data changes on one machine, it changes on all the machines. There are rules specifying exactly how a change can be made, and if someone doesn’t follow them and modifies their copy illegally, they’re ignored.
As noted, the way current public blockchains like Bitcoin and Ethereum work is that new data is just appended onto the old. Data is only written, never deleted. This is how it gets the name blockchain, because new data is added in batches, or blocks, and appended to the existing blocks, forming a chain of blocks.
Not only does everyone have the same database (blockchain), but everyone gets a locker within the blockchain that only they can access. Normally, exclusive access to something is managed with usernames and passwords. The public blockchain has no central authority to manage usernames and passwords, so instead it uses cryptography.
Each user is able to generate a locker address and a private key code that allows them to unlock the locker. The locker is only an analogy, of course. In reality it’s just an ID number (referred to as an address), which is tagged to a user’s data. The private key is a code that allows the user to prove they’re the creator (or owner) of that address. Only the person who generated the address would have the private key, and no one can ever determine what the private key is from the address alone.