Blockchain
Learn how new data is stored and written in a blockchain.
We'll cover the following
In the previous lessons, we learned that blockchain is a data structure used to store data in both Bitcoin and Ethereum. Now, we're ready to discuss what a blockchain is, how it's organized, and how it differs from regular databases. We'll also see how data is written to a blockchain.
Data in a blockchain
Before diving into how a blockchain works, let’s step back and think about what the potential design goals of this data structure are. There are at least three:
Decentralized: No actor has admin privileges in the system; all the participants have equal permissions.
Auditable: Everyone can verify that all the changes were performed according to the system rules. A system can have multiple rules, such as a requirement that only an owner can transfer their funds.
Censorship-resistant: No actor in the system can prevent a transaction from happening.
To achieve those goals, data in a blockchain is not organized as a table in a database that can be changed and rewritten. In a regular database, if a value is changed, we usually can’t get the previous versions of the same data or verify that all state changes were done according to the predefined rules.
In contrast, data in a blockchain is organized as a sequence of update operations such as a money transfer, smart contract deployment, smart contract interaction, etc. These operations are grouped into a block.
Each block has a pointer to the previous block that happened before it. These blocks are organized into a chain, which goes on until the very first block (also called genesis) is recorded in the system. Hence, the name of this data structure: blockchain.
Get hands-on with 1400+ tech skills courses.