Bitcoin blockchain is a distributed event flow log

Jiedao jdon 2021-05-06 00:33:14 阅读数:735

本文一共[544]字,预计阅读时长:1分钟~
bitcoin blockchain distributed event flow
Bitcoin's blockchain mechanism is actually a distributed event flow log , This event stream records all the bitcoin transactions .

Bitcoin is a virtual currency , We know that we can set up our own machine to specially mine , That is to say “ Free of charge ” Get bitcoin , But this “ Free of charge ” It's not really free , Your computer will come at the cost of computing power and workload , In fact, your computer is participating in a global distributed system .

Although the computer system is distributed , But all of bitcoin's transactions need to be recorded together , There are two ways to solve this record problem :

The first is the simplest way , Set up a central repository , All transaction in and out data is sent to this central repository , This is a common feature of database centric software systems , The problem with this pattern is that there is a central database , And the bitcoin system itself is distributed , There's no center , Therefore, this kind of central database mode is obviously not suitable for bitcoin's accounting management mode ;

The second is to use the distributed mode to complete the business, which requires centralized accounting management , in other words , Bitcoin transactions of servers all over the world must be recorded in a unified running book , It's just that this unified running book doesn't correspond to a central repository to store it , Instead, a copy of the unified daily account is kept on each machine . This is very similar to the read-write operation in the distributed system , Each machine is free to read the data of this unified running account book , But if you need to write the bitcoin transaction data in your machine into this daily account , Then you need to have write permission , In fact, it is similar to the power of log addition , We know that the normal log is appended append Just open the log file , Add a new line to the last line of the file , The unified daily account is similar to this file , First , You need to find the last line of the Journal , As you line up , You need to be at the end of the line , But you don't need to know the whole team , You just have to figure out which ass you need to follow , That is to say, you can just follow the person in the line .

A block is a data block with a unique identifier , The unique ID, that is, the primary key, is a 256 Bit hash number , Generated using a network uniform algorithm , Each block contains a head , The primary key hash number pointing to the previous block , Just as the foreign key of a data table points to the primary key of another table , Every block except the head , And the content of the deal , That's the bitcoin transaction data that happened . Multiple blocks are connected in series like this, with head information pointing to another block , Like a chain , It's called blockchain .

Obviously , This kind of blockchain is like Stream, It's a flow of trading Events , Just as the event log stores the flow of transaction events .

Blockchain is composed of a series of transaction events “ Laundry list ”, It's distributed , Can be shared in different servers , Be able to modify based on the consensus of most participants ( Like distributed Paxos Raft Algorithm is the same ), Once the transaction event data is added, it will never be deleted ( Logs can only be used forever append add to ), Bitcoin's blockchain contains every transaction that happened in the past for each bitcoin .

therefore , If you have Event Sourcing And distributed knowledge background , Have some knowledge of data consistency , Then it will be very easy to understand bitcoin's blockchain .

The most important core of blockchain is how to solve the problem of competitive additional data , in other words : Multiple machines need to write transaction events at the same time , There must be a queue , Technically, we use a centralized message system to queue write events , But in a fully distributed system , It's impossible to set up a centralized messaging system , therefore , Multiple concurrent machines need to campaign .

Bitcoin's blockchain designs competitive accounting and incentive mechanisms , Each computer competes with its own computing power , Those with high computing power are more likely to win bookkeeping , Once you get the bookkeeping power , And get a certain amount of bitcoin rewards . High computing power is measured and compared by open quantitative indicators such as workload .

Bitcoin's blockchain mechanism is based on the natural law of freedom , Every server, like every creature, is free to maximize its own interests , Finally, the invisible hand forms a natural evolutionary ecosystem with positive feedback .

The core idea of bitcoin blockchain mechanism is distributed + Event flow log , This core idea can be more widely used in the business field . Such as digital publishing Music distribution and many other network applications .

A blockchain is a distributed, concurrency safe, eventually consistent stream of transactions (ownership changed events) #EventSourcing --Danny Zamorano

版权声明:本文为[Jiedao jdon]所创,转载请带上原文链接,感谢。 https://netfreeman.com/2021/05/20210506003011613c.html