Looking at the initial chain from the development process of blockchain
This article mainly introduces the relevant knowledge of blockchain in 200 lines of code. It is very good and has reference value. Friends who need it can refer to it
Recently, the topic of blockchain has been speculated It’s very hot. People who understand technology pay attention to the chain, while those who don’t understand technology care about the currency price. In short, blockchain is a new decentralized economic organization model implemented by a series of technologies. In fact, blockchain technology appeared as early as 2007. With years of improvement and perfection, we have the btc, eth, eos, and true we see now. In short, blockchain is a new decentralized economic organization model implemented by a series of technologies. This article aims to conduct some research from the perspective of consensus algorithms of blockchains in different periods.
1 POW represented by btc: Proof of Work, proof of work.
Bitcoin uses the POW mechanism in the Block generation process. A Block Hash that meets the requirements consists of N leading zeros. The number of zeros depends on the difficulty value of the network. To obtain a reasonable Block Hash requires a lot of trial and error calculations, and the calculation time depends on the hashing speed of the machine. When a node provides a reasonable Block Hash value, it means that the node has indeed undergone a large number of attempted calculations. Of course, the absolute value of the number of calculations cannot be obtained, because finding a reasonable hash is a probabilistic event. When a node has n% of the computing power of the entire network, the node has a probability of n/100 to find the Block Hash.
Advantages: safe, resistant to forks, the POW consensus currency represented by Bitcoin has been in existence for 9 years, and its security has been tested by time.
Disadvantages: Waste of electricity, not energy-saving, a large amount of electricity and computing power are used to compete for Bitcoin’s accounting rights, without making any contribution to the real society. According to incomplete statistics, the electricity required for Bitcoin mining now exceeds the average level of 180 countries. It is precisely because of this that POS appeared
2: POS: Proof of Stake, proof of equity.
POS: Also known as proof of equity, it is similar to property stored in a bank. This model will allocate corresponding interest to you based on the amount and time you hold digital currency.
Operating mechanism: The nodes in the network put the digital currency in the node into the POS mechanism, and the identity is changed into a verifier. The POS mechanism randomly selects one of these verifiers as the generator of the block. Of course, this randomness and input The number of digital currencies is related. The probability of being selected is higher if you invest more coins than if you invest less, which is basically proportional to the quantity ratio. Of course, within a certain period of time, if the generator selected by POS does not generate a block, then the next validator will be selected again. As for the effective chain, this follows the longest chain principle of the blockchain. Since in the POS consensus mechanism, there are tokens as collateral, when the system finds that the node is suspected of committing evil, the mortgaged tokens can be destroyed. Therefore, in the POS consensus mechanism, the security of the system is not provided by the competition of hardware computing power outside the system, but by the hardware computing power competition outside the system. Is based on collateralized tokens as a guarantee of honest nodes.
3 PBFT: Practical Byzantine Fault Tolerance, practical Byzantine fault tolerance algorithm. See the previous introduction to the Byzantine Fault Tolerance algorithm.
PBFT is a state machine replica replication algorithm, that is, the service is modeled as a state machine, and the state machine replicates replicas on different nodes in the distributed system. Each copy of the state machine saves the state of the service and also implements the service's operations. The set of all replicas is represented by a capital letter R, and an integer from 0 to |R|-1 is used to represent each replica. For the convenience of description, assume |R|=3f 1, where f is the maximum number of replicas that may fail. Although more than 3f1 replicas can exist, the additional replicas do not improve reliability other than reducing performance.
Chulian is the world’s earliest hybrid consensus public chain, which is characterized by combining pbft and pow consensus. Use the former to ensure performance and the latter to ensure decentralization. To put it simply, it is based on POW, and then the PBFT backbone node is elected on this node. Personally, I feel that integrating two different consensus algorithms is a very innovative idea. First select the main node based on POW to avoid excessive centralization, similar to the EOS super node, and then operate it under several main nodes later. Although it seems to be contrary to decentralization, this is also the efficiency at this stage. , a better solution that takes into account both performance and decentralization.
Recently, the topic of blockchain has been very hot. Those who understand the technology will follow the chain, and those who do not understand the technology will follow the chain. Pay attention to currency prices. In short, blockchain is a new decentralized economic organization model implemented by a series of technologies. In fact, blockchain technology appeared as early as 2007. With years of improvement and perfection, we have the btc, eth, eos, and true we see now. In short, blockchain is a new decentralized economic organization model implemented by a series of technologies. This article aims to conduct some research from the perspective of consensus algorithms of blockchains in different periods.
1 POW represented by btc: Proof of Work, proof of work.
Bitcoin uses the POW mechanism in the Block generation process. A Block Hash that meets the requirements consists of N leading zeros. The number of zeros depends on the difficulty value of the network. To obtain a reasonable Block Hash requires a lot of trial and error calculations, and the calculation time depends on the hashing speed of the machine. When a node provides a reasonable Block Hash value, it means that the node has indeed undergone a large number of attempted calculations. Of course, the absolute value of the number of calculations cannot be obtained, because finding a reasonable hash is a probabilistic event. When a node has n% of the computing power of the entire network, the node has a probability of n/100 to find the Block Hash.
Advantages: safe, resistant to forks, the POW consensus currency represented by Bitcoin has been in existence for 9 years, and its security has been tested by time.
Disadvantages: Waste of electricity, not energy-saving, a large amount of electricity and computing power are used to compete for Bitcoin’s accounting rights, without making any contribution to the real society. According to incomplete statistics, the electricity required for Bitcoin mining now exceeds the average level of 180 countries. It is precisely because of this that POS appeared
2: POS: Proof of Stake, proof of equity.
POS: Also known as proof of equity, it is similar to property stored in a bank. This model will allocate corresponding interest to you based on the amount and time you hold digital currency.
Operating mechanism: The nodes in the network put the digital currency in the node into the POS mechanism, and the identity is changed into a verifier. The POS mechanism randomly selects one of these verifiers as the generator of the block. Of course, this randomness and input The number of digital currencies is related. The probability of being selected is higher if you invest more coins than if you invest less, which is basically proportional to the quantity ratio. Of course, within a certain period of time, if the generator selected by POS does not generate a block, then the next validator will be selected again. As for the effective chain, this follows the longest chain principle of the blockchain. Since in the POS consensus mechanism, there are tokens as collateral, when the system finds that the node is suspected of committing evil, the mortgaged tokens can be destroyed. Therefore, in the POS consensus mechanism, the security of the system is not provided by the competition of hardware computing power outside the system, but by the hardware computing power competition outside the system. Is based on collateralized tokens as a guarantee of honest nodes.
3 PBFT: Practical Byzantine Fault Tolerance, practical Byzantine fault tolerance algorithm. See the previous introduction to the Byzantine Fault Tolerance algorithm.
PBFT is a state machine replica replication algorithm, that is, the service is modeled as a state machine, and the state machine replicates replicas on different nodes in the distributed system. Each copy of the state machine saves the state of the service and also implements the service's operations. The set of all replicas is represented by a capital letter R, and an integer from 0 to |R|-1 is used to represent each replica. For the convenience of description, assume |R|=3f 1, where f is the maximum number of replicas that may fail. Although more than 3f1 replicas can exist, the additional replicas do not improve reliability other than reducing performance.
Chulian is the world’s earliest hybrid consensus public chain, which is characterized by combining pbft and pow consensus. Use the former to ensure performance and the latter to ensure decentralization. To put it simply, it is based on POW, and then the PBFT backbone node is elected on this node. Personally, I feel that integrating two different consensus algorithms is a very innovative idea. First select the main node based on POW to avoid excessive centralization, similar to the EOS super node, and then operate it under several main nodes later. Although it seems to be contrary to decentralization, this is also the efficiency at this stage. , a better solution that takes into account both performance and decentralization.
Related recommendations:
200 lines of code to implement blockchain Detailed explanation of blockchain examples
Bitcoin’s blockchain api friends who are familiar with it will give advice one time
The above is the detailed content of Looking at the initial chain from the development process of blockchain. For more information, please follow other related articles on the PHP Chinese website!

The main difference between Python and JavaScript is the type system and application scenarios. 1. Python uses dynamic types, suitable for scientific computing and data analysis. 2. JavaScript adopts weak types and is widely used in front-end and full-stack development. The two have their own advantages in asynchronous programming and performance optimization, and should be decided according to project requirements when choosing.

Whether to choose Python or JavaScript depends on the project type: 1) Choose Python for data science and automation tasks; 2) Choose JavaScript for front-end and full-stack development. Python is favored for its powerful library in data processing and automation, while JavaScript is indispensable for its advantages in web interaction and full-stack development.

Python and JavaScript each have their own advantages, and the choice depends on project needs and personal preferences. 1. Python is easy to learn, with concise syntax, suitable for data science and back-end development, but has a slow execution speed. 2. JavaScript is everywhere in front-end development and has strong asynchronous programming capabilities. Node.js makes it suitable for full-stack development, but the syntax may be complex and error-prone.

JavaScriptisnotbuiltonCorC ;it'saninterpretedlanguagethatrunsonenginesoftenwritteninC .1)JavaScriptwasdesignedasalightweight,interpretedlanguageforwebbrowsers.2)EnginesevolvedfromsimpleinterpreterstoJITcompilers,typicallyinC ,improvingperformance.

JavaScript can be used for front-end and back-end development. The front-end enhances the user experience through DOM operations, and the back-end handles server tasks through Node.js. 1. Front-end example: Change the content of the web page text. 2. Backend example: Create a Node.js server.

Choosing Python or JavaScript should be based on career development, learning curve and ecosystem: 1) Career development: Python is suitable for data science and back-end development, while JavaScript is suitable for front-end and full-stack development. 2) Learning curve: Python syntax is concise and suitable for beginners; JavaScript syntax is flexible. 3) Ecosystem: Python has rich scientific computing libraries, and JavaScript has a powerful front-end framework.

The power of the JavaScript framework lies in simplifying development, improving user experience and application performance. When choosing a framework, consider: 1. Project size and complexity, 2. Team experience, 3. Ecosystem and community support.

Introduction I know you may find it strange, what exactly does JavaScript, C and browser have to do? They seem to be unrelated, but in fact, they play a very important role in modern web development. Today we will discuss the close connection between these three. Through this article, you will learn how JavaScript runs in the browser, the role of C in the browser engine, and how they work together to drive rendering and interaction of web pages. We all know the relationship between JavaScript and browser. JavaScript is the core language of front-end development. It runs directly in the browser, making web pages vivid and interesting. Have you ever wondered why JavaScr


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 English version
Recommended: Win version, supports code prompts!

SublimeText3 Linux new version
SublimeText3 Linux latest version
