With blockchain technology taking over the network, users still find it challenging to understand the difference between traditional network technology and web3 technology.
In this article, we will decompose the location of the blockchain, the storage location of the blockchain, and how the data is processed in it.
Blockchain Technology Basics
Simplely put, blockchain is a database that is shared and synchronized between multiple computers in the network. In blockchain, transactions are securely stored in a peer-to-peer computer network, also known as nodes. It uses a hash, which is an unchangeable encrypted signature. Hash converts each type of data into a unique set of characters, improving the integrity of the blockchain. The key characteristics of blockchain technology are transparency, security and immutability. This means that once a transaction is recorded, it cannot be changed or deleted.
To clearly understand where blockchain is stored, we must first clearly understand how traditional networks store and process information.
traditional storage method
In the traditional web, the computer stores data in a centralized database with tables, rows and columns. database administrator can read, write, update or delete this data.
Centralized database is easier to manage and highly scalable; however, it lacks transparency, security and integrity. This is very different from a transparent and immutable blockchain network.
How transactions occur in the blockchain
To trade in the blockchain, there must be three components of the blockchain: nodes, blocks and miners.
1. Node
node can be any computer connected to a blockchain network to verify and relay transactions. All nodes on the blockchain are linked together, and they often exchange the latest data with each other to ensure that all nodes are up to date. The three main roles of the
node are: verifying transactions on the blockchain and accepting or rejecting transactions based on authenticity. Store block transactions on the blockchain. Share transaction information with other nodes on the blockchain.
2. Block
In the blockchain, blocks are a single and unique transaction record unit. block can be distinguished according to their roles in the network.
- • Genesis block : The founding block in the network. In other words, the first block in the blockchain. This block makes the network immutable by allowing the creation and linking of subsequent blocks.
- • valid block : A block that has been mined and is now part of the blockchain. A valid block contains transactions that have been verified/verified by the miner.
- • Orphan : Blocks that no longer belong to the blockchain network. Orphaned blocks are rejected blocks created when multiple blocks are mined at the same time but not added to the blockchain.
- • The process of miner
Adding new transactions on the blockchain is called Mining . The miner verifies/verifies the transaction and then adds it to the blockchain. How to happen
transactions
Blockchain transaction life cycle is divided into three stages: authentication, authorization and Proof of Work (PoW).
1. Authentication
Before any transaction is made, the user must successfully verify his identity using the private key of the wallet. The most popular method of authentication is to use mnemonic words.
seed phrase is a randomly selected set of words representing a long list of random numbers and letters (your private key).
private key is as follows:
0C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D
This is a bit difficult to remember, so we use such mnemonic words:
spare government hawk eternal decline session load grace peasant west bargain always meadow ensure quality hill neglect hand toss lyrics stereo call snap about 16
Usually, it is easier to access your wallet using mnemonics than to use your private key because it is easier to remember. Seed phrase authentication enhances the anonymity and privacy of blockchain transactions because there is no central organization managing identity authentication.
2. Authorization
Authorization means that each node on the network agrees with each other to approve the transaction. In other words, in blockchain, consensus must be reached to verify transactions. Once the standards set by the smart contract are met, the node will approve the transaction. After the
transaction is approved, it will be stored on the blockchain. Once the transaction is stored on the blockchain, it cannot be changed.
3.Proof of Work (PoW)
In short, proof of work is a complex algorithm used by cryptocurrency miners to verify transactions. Using this algorithm, you can confirm transactions to create new blocks in the blockchain.
miners compete with each other to complete this complex algorithm because they get financial compensation every time they add a new block to the chain. This is because solving these complex algorithms requires a lot of computing power.
Proof of Stake (PoS): Proof of Stake is an alternative consensus mechanism used in blockchain. Through proof of stake, members holding the most network native currency have the greatest power to verify transactions.
How data is stored in the blockchain
In the blockchain, the data is accessed, verified and recorded by all nodes in the network. So what is the actual content of the block and what types of data are stored in the blockchain? The
block has two parts: the title and the body. The header is part of a block that contains information used to identify the block, and the body is the part of the block that contains data (transactions).
block header
block header contains metadata associated with the block.
metadata is:
- • block version . A 4-byte field containing the block version number. The version number of the block specifies the rules for verifying the block. For example, in Bitcoin, there are 4 block versions, each of which is an improvement to the previous block rule.
- • hash of the previous block . The identity of the block. It is a unique set of strings that identifies a specific block and associates it with the next block to form a blockchain. In other words, each new block is generated from the hash of the previous block.
- • time. Timestamp when the block is hashed.
- • Merkel tree . The Merkle tree is a data structure algorithm in which each node is marked with a cryptographic hash of the block. The Merkle tree uses the Merkle root mathematical formula to verify data in the network. This is to verify data efficiently and securely in blockchain.
- • bit . Store the difficulty target, which is a 4-byte file that specifies the difficulty of mathematical problems that miners solve in order to verify transactions.
- • random number . A random number (number used once) is a random number that gets the hash value of a block. Positioning random numbers is what a miner does when validating a block. The difficulty target must be equal to or less than the random number of the block to be verified.
This metadata is public in the Bitcoin network and can always be further explored and viewed using blockchain browsers such as Etherscan[1] or Blockchair[2].
block
block is the main body of the block that stores all transactions. This is the case with a block that can accommodate up to 500 transactions, and this is the case with the Bitcoin network. The larger the size of the block, the faster the transactions in the blockchain.
The type of blockchain and its way of storing data
Different blockchains have different data structures. Let's review the structure of data in the Bitcoin and Ethereum networks.
Bitcoin
Bitcoin is the first cryptocurrency and the first practical application of blockchain technology. Transactions in Bitcoin can be modeled using unused transaction outputs (UTXO). UTXO refers to the amount of Bitcoin remaining after the transaction occurs.
UTXO The database stores changes from Bitcoin transactions. The initial state of this database is 0. As the number of transactions increases, the database is filled with change entries from multiple transactions. Any output that has not been used until the transaction is completed will be stored back to the database as input for use in subsequent transactions.
The following metadata is provided in each Bitcoin transaction:
- • tx_in count: The total number of transaction inputs.
- • tx_ins: Save the list of all transaction inputs.
- • tx_out count: Total number of transaction outputs.
- • tx_outs: List of all transaction outputs.
- • script witness : This file contains serialization of all SegWit transaction witness data.
- • lock time : Specify when transaction when can be included in the blockchain. It is a 4-byte value that specifies the block number or timestamp of the transaction until it is locked. It is usually set to 0, which means that the transaction takes effect immediately after the block is completed.
Ethereum
The main limitation of Bitcoin is scalability, which means that a single block in the Bitcoin network can only hold 1MB of data. The Ethereum network is built using the trie data structure to solve the performance and scalability challenges faced by the Bitcoin network.
trie, commonly known as a number tree, is a data structure method that contains a set of strings connected through links between nodes. There are four attempts to the Ethereum network: state, storage, transaction and reception attempts.
- • State trie: Store temporary network data, such as account key, transaction quantity, address and account balance. As the transaction occurs, the data of the state tree continues to be updated. Basically, the status tree maps the address to the account state.
- • Storage trie: Store smart contract data. It saves account data, such as account balance and the number of transactions associated with the account. Each Ethereum account has its own storage attempt.
- • transactiontri: The transaction tree is specific to each block. Transaction trie captures transaction request vectors such as gas value, transaction value, gas limit, receiver and nonce.
- • Receipt trie: Save post-transaction data, such as the amount of gas used, post-transaction status and transaction log.
Conclusion
In this article, we break down how transactions occur in the blockchain network and the components it needs to work. We also explore the types of blockchains and how they store data.
reference link
[1] Etherscan: https://etherscan.io/
[2] Blockchair: https://blockchair.com/