web3 takes everyone to easily establish the concept of blockchain

Above the concept of Web3.0 we briefly talked about the concept of web3.
Many people may still feel that it is too conceptual.
In this article, we will learn more about the blockchain
because one of the foundations of web3.0 is that the blockchain
has blocks . The chain has derived many things behind
Decentralized identity Decentralized application dapp

In fact, the ultimate goal is to lead everyone to build their own virtual currency virtual exchange
. Then you have to write the codes that make up these logics. We must understand the blockchain.

This article of mine is just like a guide, I will let everyone have a basic blockchain concept foundation,
but if you want to fully understand the blockchain after reading this article, it is obviously impossible,
but with this foundation, you will After doing blockchain development, when you come back and look at these, you will find that it is true.

Then I will describe what kind of scenario we will manage data after we have the blockchain,
and then study how to realize this kind of thing

So let's first think about how data is managed under an existing closed system?
Let’s take an example here, such as our Douyin,
insert image description here
we upload the videos we make, and we
earn a certain amount of income from the live broadcast on Douyin.
The data of our income and output videos
are controlled by executing the back-end code on a server of Douyin. The entire rules of the platform
, such as the normal platform to extract profits, these operations will be completed here
, and the data will also be stored in the Douyin database.

After all, it is impossible for such a large Internet company to run away, but if it is replaced by a smaller platform, there is a risk of data loss caused by malicious attacks,
etc. Once the data is lost, the money is gone directly.
insert image description here
This is what we believe in the current centralized system. This third-party middleman is controlled by the Internet platform we usually use.
So what we see These money and other data are just data to them

Therefore, the Internet platforms here need to maintain their own systems for a long time
. Of course, for large Internet companies, there is no need to worry about this problem. The overview is also very small
insert image description here
. reduce the probability of this event

Then the blockchain concept is to replace the third-party platform and replace the control with a set of computer programs that we say we trust. We will have a consensus mechanism here. Each of our
blockchain nodes will have a copy of the program. Our copy will be Write clearly one of his specific rules, the code in which is open and transparent

If in the future we also have rules for building such a smart contract that can upload videos, control income, and perform currency exchange, all the codes are open and transparent,
but the specific values ​​will not be disclosed,
because this openness and transparency will cause people to worry about your everything. If it is open and transparent, my income information needs to be protected. This seriously violates the user's data security. Note that the openness here refers to how the
code logic is written. Everyone is engaged in code. When I say public and private, everyone should have a concept. A concept of public and private. Private fields are definitely protected, so you will still be protected in this environment. It will be under the privacy algorithm. Encrypted, without a middleman, the computer controls the rules, and then we write smart contracts, so that each of our blockchains will have data backups, and there will be a program backup that is very transparent and will not cause data differences.




insert image description here

For example, someone has the ability to tamper with the data of one of the nodes and change the income from 100 to 1000,
but if you want to change a data in a blockchain, the previous transactions must be modified, and the amount of calculation will be very large.

Here we can only say that everyone does not have to worry about security issues. According to the question, you still need to write code to understand this concept.
In the future, it will be an automated program to manage the contract instead of relying on the server and database of the middleman.

The blockchain is composed of three parts. It is a network, a computer, or a database.
For example, it is a network. We used to register an account if we wanted to access a website, and then the account was stored in the database of the third-party platform. In this way, we must pass in Users created under other databases can operate under the website products of this Internet company,
but if the blockchain is built, you only need to register a personal information key, which will allow you to freely operate all platforms, which is equivalent to a public ID card on the Internet
insert image description here
Then the concept of the database is that if we don't use a third-party database, where does the data exist?
Then the blockchain obviously needs to have the ability to store information, and this kind of information will not be changed once it is stored.
We store a data in a node of the blockchain, and the information obtained by other nodes is the same. This is a copy
. If you change the backups of other nodes on other nodes, it doesn’t change, so if you want to modify this, you have to change all other backups,
insert image description here
but there is also a private key leak, which is still very dangerous. Later, you will use other tools to manage private keys.
Moreover, it is necessary to store data and also need to be able to execute official calculation logic, so this is a smart contract, which is equivalent to executing js logic,
and variables can also be defined. For the blockchain, as long as we store this variable in it, it will always exist in this blockchain. bingo

Whether it is private or not is set in the blockchain

According to our previous logic, it is not important to use react/vue for front-end operations, then send network requests to send data to the back-end server, and then the back-end code deployed on the server will execute the logic to process the data and write it into the database using sql

So there will be third-party background code and database developers who can easily get all our data

And now your front-end code does not need to be changed, but you do not need to send axios or ajax, but directly use json
or a webjs library provided to me through the blockchain. This interface is directly linked to our blockchain
so that we can Data in the blockchain can be written or read via web3

At this time, all of our data is recorded in a blockchain

Ok, then in this process we start the development based on react. In this process, you can’t even see a line of back-end code. It is to introduce the web3 library through its interface to access its Ethereum-deployed blockchain to obtain a wallet
. Data, etc.
can be deployed on our smart contract program
insert image description here
. So what language is the smart contract written in? It is a language similar to js, ​​so if you learn it as a front-end identity, it is actually more advantageous,
but it’s okay for everyone to learn it later.

There are multiple virtual machines in our Ethereum. We know that the blockchain is a block and then connected together. It is
also a bit like a distributed storage.

It is equivalent to that we have a public ledger and every transaction will be recorded on this ledger, but everyone cannot directly access this ledger, because if multiple people directly access the same file, there will definitely be problems. One of our blockchains is
in After processing a transaction, he will initiate a notification and all blockchains will calculate it. Only when all blockchains agree will the information be recorded and the data will be
recorded in the public ledger, and then all blockchains will obtain the block. A copy of the chain ledger
This is roughly a consensus mechanism

So finally let's talk about the business that blockchain is suitable for

The first is crowdfunding, such as love donations, and some third-party platforms will still draw some profits. If we can control this transaction process through smart contracts and blockchains, it will be much more transparent. The notarial certificate is also the company’s equity and other information. Once entered, it is very difficult to
tamper
with
. Avoid a lot of controversies and problems

Guess you like

Origin blog.csdn.net/weixin_45966674/article/details/131214680