In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Today, I would like to share with you the relevant knowledge about the characteristics of the network and blockchain in Bitcoin. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can learn something after reading this article. Let's take a look at it.
Brief introduction
At the bottom of Bitcoin is the blockchain technology, which is also well known because of Bitcoin. What are the characteristics of Bitcoin's blockchain compared with other blockchain technologies? As the ancestor of the de-blockchain, what are the distinctive characteristics? Come and have a look with us.
Bitcoin network
Bitcoin uses a P2P (peer-to-peer) network, this P2P is not the other P2P, this is a peer-to-peer network architecture, not a person-to-person lending model.
P2P means that every computer in the same network is equal to each other, each node provides network services together, and there are no "special" nodes. Each network node is connected to each other in a "flat" topology. There is no server, centralized service, or hierarchical structure in P2P networks.
The traditional network structure is the client-server mode, and all client interacts with server to obtain information. As long as server is dead, client is useless.
In P2P networks, there is no concept of server, each node can be used as a server. In contrast, the stability of P2P network is much more stable than that of Cmurs architecture.
Network discovery and synchronization
Since it is a P2P network, then the question is, how is this P2P network established? How is it found between nodes?
Students who have done P2P downloading should have heard of the concept of seed, which contains the addresses of other active nodes. The corresponding nodes can be connected by downloading the seeds.
And each node keeps the recently connected or active nodes, thus forming a huge P2P network.
Similarly, the same is true of Bitcoin's P2P networks.
How does the new node discover its peers in the network? Although there are no special nodes in the Bitcoin network, the client maintains a list of nodes that are stable for a long time. Such nodes are called "seed nodes" (seed nodes).
The node must continue to do two things: to discover a new node when an existing connection is lost, and to help other nodes when they start up.
SPV node
As we explained earlier, there are neither accounts nor balances in the world of Bitcoin, only UTXO (Unspent Transaction Outputs) scattered in the blockchain.
So if you want to verify the transaction, you need to find all the transactions related to the transaction from the historical transaction, so as to carry out complete and comprehensive verification.
The problem with this is that if you download all the history, you need hundreds of gigabytes of hard disk space, which is unthinkable for mobile phones or other lightweight clients.
So SPV showed up. The full name of SPV is Simplified payment verification, which is called simple authentication payment.
SPV does not save the whole blockchain, but the header of the blockchain, because each blockchain header is only 80 bytes, so even if all the blockheads are downloaded and saved, it will not be very large.
Block chain head
The block head consists of three sets of block metadata. The first is a set of data that references the hash value of the parent block, and this set of metadata is used to connect the block to the previous block in the block chain.
The second set of metadata, namely difficulty, timestamp and nonce, is related to mining competition.
The third set of metadata is the merkle tree root (a data structure used to effectively summarize all transactions in a block).
The Nonce, difficulty target, and timestamp are used in the mining process, and the Merkle root is used to index and organize all transaction information in the block.
The picture above is a chain consisting of a block chain head.
Merkle Tree
Merkle Tree is a kind of tree (the tree in the data structure), which is mostly called Merkle Hash Tree on the Internet, because all the nodes of the Merkle Tree it constructs are hash values. Merkle Tree has the following characteristics:
It is a kind of tree, which can be a binary tree or a multi-forked tree. No matter how many trees it is, it has all the characteristics of the tree structure.
The value on the leaf node of the Merkle tree is specified by you, which mainly depends on your design. For example, Merkle Hash Tree will take the hash value of the data as the value of the leaf node.
The value of a non-leaf node is calculated according to all the leaf node values below it, and then calculated according to a certain algorithm. For example, the calculation method of the non-leaf node value of Merkle Hash Tree is to combine all the child nodes of the node, and then calculate the hash value by hash.
With Merkle Tree, we only need to know the information in the other Merkle Tree related to the transaction to be validated, and we can calculate the value of the entire Merkle Tree, so that we can directly use the header information for verification. This is how SPV works.
Blockchain in Bitcoin
A blockchain is a data structure that is sequentially linked from back to front by blocks containing transaction information. It can be stored as flat file (a file that contains no relative relational records) or in a simple database.
The Bitcoin core client uses Google's LevelDB database to store chunk chain metadata.
It consists of a block containing metadata followed by a long list of transactions that form the body of the block. The block size is 80 bytes, while the average per transaction is at least 250 bytes, and the average block contains at least 500 transactions.
Block identifier
How do you represent a block? We use block markers.
The block primary identifier is its encrypted hash value, a digital fingerprint obtained by the secondary hash calculation of the block head by the SHA256 algorithm. The resulting 32-byte hash is called the block hash, but the more accurate name is: the block head hash, because only the block head is used for calculation.
The second way to identify a block is by its position in the block chain, that is, "block height (block height)". The first block whose block height is 0 differs from the block hash value in that the block height is not a unique identifier. Although a single block always has a clear and fixed block height, the reverse is not true. A block height does not always identify a single block. Two or more blocks may have the same block height and compete for the same position in the block chain.
Genesis block
The first block in the block chain was created in 2009 and is called the Genesis Block. It is the common ancestor of all the blocks in the blockchain, which means that you go back from any block, and you will eventually reach the Genesis block.
Because Genesis blocks are programmed into bitcoin client software, each node starts with a chain of blocks containing at least one block, which ensures that Genesis blocks will not be changed. Each node "knows" the hash value, structure, time when it was created, and a transaction in the creation block. Therefore, each node takes the block as the first block of the block chain, thus building a secure and trusted root of the block chain.
The hash value of Genesis Block is 0000000000 19d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f.
The Genesis block contains a hidden message. Include the phrase "The Times 03/Jan/2009 Chancellor on brink of second bailout forbanks." in the input to its Coinbase transaction. This sentence, which was the headline of the Times's front-page article that day, is not only an explanation of when the block was born, but also a half-joking reminder of the importance of an independent monetary system. at the same time, it tells people that with the development of Bitcoin, an unprecedented worldwide monetary revolution is about to take place. The message was embedded in the creation block by Satoshi Nakamoto, the founder of Bitcoin.
The value of coinbase is: 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73
The decoding method is as follows:
Under python shell:
"04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73" .decode ('hex')
Output:
'\ x04\ xff\ xff\ x00\ x1d\ X01\ x04EThe Times 03/Jan/2009 Chancellor on brink of second bailout for banks'
That's all of the article "what are the characteristics of the network and blockchain in Bitcoin?" Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.