Consensus
Now that you know the basic concepts of the blockchain and how blocks are linked together, it is time to look at the mechanism that secures the blockchain and its transactions.
When comparing a blockchain with a traditional database that is based on trust, a traditional database is operated by a single entity, or operator, and it requires a user-controlled access system. Thus, it is crucial for the single entity operating it to be a trustworthy individual. On the other hand, most blockchains (or distributed databases) are operated by unknown entities, which can be an individual, an organization, or even a computer that automatically operates it. So, with this lack of trust, how can we be certain that the data is not compromised?
The trust aspect of the blockchain lies in the way that consensus is reached. In a blockchain, an entity (individual or organization) can submit information that they wish to add to the distributed database. Submitting information results in a transaction, but, compared to a traditional database, it is not immediately committed. As you read previously, a blockchain runs on a peer-to-peer network, and after submission, these transactions are distributed to all nodes in the network. Before transactions can be committed or permanently incorporated into the blockchain, distributed operators, or "miners," who are part of the network need to evaluate and agree on all additions. All transactions must be reviewed and confirmed, so that "consensus" is reached before the transactions are accepted.
Let's review what you have learned up to this point. Transactions represent data or assets that are transferred from one entity, or "peer," to another entity in the network. In a blockchain, this transaction is broadcast to every active node in a peer-to-peer network. These transactions are then validated and put into blocks, where each block represents a page in a ledger. Blocks are then secured by solving a mathematical puzzle, or nonce, which generates the block hash. In a blockchain, you can have nodes dedicated to do the evaluation, or "solving," but in most public blockchains, specifically cryptocurrencies, everybody can help evaluate transactions.
After evaluation, the block hash and nonce become part of the block's header, which also includes the hash of the previous block. When a new block is created, it is just like a transaction and it is broadcast to all active nodes in the network. Other nodes validate the block by checking to see whether the given nonce solves to the correct hash based on the transactions listed in the block's data. Once the majority of the nodes positively validate and accept the block, consensus is reached.