Two core tasks of developing blockchain in China
what is centralization
the so-called centralization means "ownership" or ownership by the company. For example, Tencent's q-coin, which is issued by Tencent, is a kind of centralized electronic currency, including the total amount and the issuing method, is supervised and controlled by Tencent. You can use it, trade and go shopping, but you always have to operate in the framework of Tencent, and the final right of interpretation belongs to Tencent
the issuing mode of bitcoin is preset by the program and encryption algorithm, and runs on multiple nodes all over the world. No one or organization can modify it (everyone has his own account book, so it is impossible for one person to control everyone's account book at the same time. If there is such a technology, why should it be so complicated, If you want to blackmail money into your account, you will be the richest man in the world. There is no one left, And it is not controlled by any single person or organization
take an example: for example, Lao Zhang borrows 100 yuan from Lao Li, but Lao Li is afraid that he will default, so he asks the village head to do notarization and write down the account. This is called centralization. But if you don't find the village head, you can use the loudspeaker to shout in the village: "I Lao Li lent Lao Zhang 100 yuan! Please put it in the account book. "We all put this account in our own account book. This is called decentralization
anyone who transfers money between them will release information through loudspeakers. After receiving the information, everyone will record the transaction in their own account book. With distributed ledgers, it doesn't matter if Lao Zhang or Lao Li's ledgers are lost, because Lao Zhao, Lao Ma, Lao Wang and other families have ledgers
the main advantages of blockchain are that it does not need intermediary participation, the whole process is open and transparent, and the cost is low, and the data security is high
at present, blockchain is in a stage where everyone talks about blockchain, but can't perceive its actual technical charm. Since 2017, it has graally come into our sight, and we have graally realized that bitcoin is more fierce than real estate speculation (the price of mining machinery has skyrocketed! The news is on the screen But I still don't know
so, in which fields can blockchain be applied, what kind of changes will it bring to our future life
the core key: everyone has an account book, everyone has an account book, and the information recorded in each person's account book is consistent and synchronous, and the information is completely transparent. If it is fake, it will be the public enemy of the whole people, which greatly increases the cost of data fraud
core key 2: decentralization, which does not need a central system to manage data, prevents some people from changing data and damages the interests of the majority of people
Application:
1. Account security and privacy protection: currency transfer, exchange, payment system. Blockchain can help prevent data manipulation and fraud, prevent distributed denial of service attacks (DDoS), and effectively protect users' network privacy. Key words: anti counterfeiting, anti-counterfeiting, loan payment
2. Copyright regulation and interest disputes: for example, when a song is downloaded, from the author to the procer and then to the singer, they can get payment in real time through the blockchain, without having to wait for a long time like the traditional way, or even get no reward e to right disputes. Instead of waiting for publishers to provide royalty checks, creators can freely control the process from publishing to payment through blockchain application. Key words: real time receipt, no property dispute
3. Internet of things + artificial intelligence: the intelligent devices in the Internet of things based on the blockchain will be used to monitor the real-time situation of urban infrastructure such as bridges, roads, power grids, etc. the blockchain can connect these intelligent devices together for unified management to help them monitor more efficiently. This will help people better understand how to build a smart city in the future. Key words: unified monitoring, intelligent city
4: proof of existence: in life, once you are asked to prove that you are you, that your mother is your mother, that you have never been married, that the house belongs to you, and so on, things seem very simple. Once it falls on you, it is a great trouble. The application of blockchain technology can perfectly solve the above embarrassment. At that time, all the information that belongs to you will be recorded accurately and can not be tampered with. No one has the right to change it. When the technology develops to a certain stage, birth certificate and marriage certificate may be recorded on the blockchain. Keywords: no keywords
in addition to the application scenarios mentioned above, blockchain technology can also be applied to e-commerce, data storage, logistics and other fields. As long as we grasp the characteristics of blockchain technology, it will become easy to understand.
From the perspective of technology and architecture, I will tell you my understanding of blockchain in common language
what is blockchain? In a word, blockchain is a storage system. To be more specific, blockchain is a distributed storage system without an administrator and each node has all the data
What are the common storage systems like
first, how to ensure high availability
the common storage system usually uses "rendancy" to solve the problem of high availability. As shown in the figure above, if the data can be copied into several copies and rendant to multiple places, high availability can be guaranteed. The data in one place is hung, and there is data in other places. For example, the master-slave cluster of MySQL is the same principle, and the raid of disk is also the same principle
two points need to be emphasized in this place are: data rendancy often leads to consistency problems
1. For example, in the master-slave cluster of MySQL, there is actually a delay in reading and writing, which means there is a inconsistency in reading and writing in a short period of time. This is a side effect of data rendancy
The second point is that data rendancy often reces the efficiency of writing, because data synchronization also consumes resources. If you add two slave libraries, the write efficiency will be affected. The common storage system is to use rendancy to ensure the high availability of dataso the second question, ordinary storage system, can write more
the answer is yes, for example, take this graph as an example:
in fact, MySQL can do a master-slave synchronization of al masters, master-slave synchronization of al masters, two nodes can be written at the same time. If you want to do a multi room multi live data center, in fact, multi room multi live data synchronization. What we should emphasize here is that multi-point writing often leads to the consistency problem of writing conflicts. Take MySQL as an example, suppose that the attribute of a table is self incrementing ID, then the data in the database is 1234 now. If one of the nodes writes and inserts a piece of data, it may become 5, and then these 5 pieces of data are synchronized to another master node, Before synchronization, if another write node inserts a piece of data, a piece of data with self incrementing ID of 5 will be generated. Then, after the generation, synchronize to another node, and the synchronized data will conflict with the two local 5's after it arrives, which will lead to synchronization failure and write consistency conflict. This problem will occur in the case of multi-point writing
how to ensure consistency in multi-point writing
the reform "Swan class" gives you more technical work
1. Blockchain links
as the name suggests, blockchain is a chain composed of blocks. Each block is divided into block head and block body (including transaction data). The block head includes the prevhash value (also known as hash value) of the previous block used to realize the block link and the random number (nonce) used to calculate the mining difficulty. The hash value of the previous block is actually the hash value of the head of the previous block, and the random number calculation rule determines which miner can obtain the right to record the block
2. Consensus mechanism
blockchain is accompanied by the birth of bitcoin, which is the basic technology architecture of bitcoin. Blockchain can be understood as an Internet-based decentralized accounting system. A decentralized digital currency system like bitcoin requires the consistency of accounting of honest nodes without a central node, which needs blockchain to complete. Therefore, the core of blockchain technology is a consensus mechanism to reach a consensus on the legitimacy of transactions between indivials without mutual trust without central control
there are four main types of consensus mechanisms in blockchain: pow, POS, dpos and distributed consistency algorithm
3. Unlocking script
script is an important technology to realize automatic verification and contract execution on blockchain. Every output of every transaction does not point to an address in the strict sense, but to a script. A script is like a set of rules that constrain how the receiver can spend the asset locked on the output
the validation of transactions also depends on scripts. At present, it depends on two kinds of scripts: Lock script and unlock script. Locking script is a condition added to the output transaction, which is realized by a script language and located in the output of the transaction. The unlocking script corresponds to the locking script. Only when the conditions required by the locking script are met can the assets corresponding to the script be spent, which is located in the input of the transaction. Many flexible conditions can be expressed by script language. Interpretation script is similar to the "virtual machine" in our programming field, which runs in every node of the blockchain network in a distributed way
4. Transaction rules
blockchain transaction is not only the basic unit of a block, but also the actual effective content recorded by the blockchain. A blockchain transaction can be a transfer, or the deployment of smart contracts and other transactions
as far as bitcoin is concerned, a transaction refers to a single payment transfer. The transaction rules are as follows:
1) the input and output of the transaction cannot be empty
2) for each input of a transaction, if its corresponding utxo output can be found in the current transaction pool, the transaction will be rejected. Because the current transaction pool is the transaction not recorded in the blockchain, and each input of the transaction should come from the confirmed utxo. If it is found in the current trading pool, it is Shuanghua trading
3) for each input in a transaction, the corresponding output must be utxo
4) each input unlocking script must verify the compliance of the transaction together with the corresponding output locking script
5. Transaction priority
the priority of blockchain transaction is determined by the blockchain protocol rules. For bitcoin, the priority of a transaction to be included in a block is determined by the time when the transaction is broadcast to the network and the amount of the transaction. With the increase of transaction broadcast time on the network and the increase of transaction chain age, the priority of transaction will be improved and eventually be included by the block. For Ethereum, the priority of the transaction is also related to the transaction fee that the publisher is willing to pay. The higher the transaction fee that the publisher is willing to pay, the higher the priority that the transaction is included in the block
6. Merkle proof
the original application of Merkle proof is bitcoin, which was described and created by Satoshi Nakamoto in 2009. Bitcoin blockchain uses Merkle proof to store transactions in each block. So that the transaction can not be tampered with, but also easy to verify whether the transaction is included in a specific block
7. RLP
RLP (recursive length prefix) is one of the main encoding methods of object serialization in Ethereum. Its purpose is to encode the sequence of arbitrary nested binary data.
blockchain is essentially a distributed ledger database, it is a series of data blocks generated by cryptography Association, and each data block contains effective confirmation information of multiple bitcoin network transactions
Statistics show that in 2017, China's e-invoice circulation reached 1.31 billion, and it is expected to reach 54.55 billion by 2022, maintaining an average annual growth rate of more than 100%. Recently, when talking about blockchain invoice, people's daily stressed that electronic invoice should be added with "lock", and blockchain's open consensus, decentralization, non tampering, distributed consistency and privacy protection are the "lock" of electronic invoicefinally, I repeat my idea: blockchain gives us freedom, and freedom will bring a lot of innovation. Innovation will eventually bring us wealth. I believe blockchain will have a similar development path. The core task of blockchain is to stabilize the value, establish a trust system with almost zero cost, and release the energy of indivials in pursuit of wealth preservation and appreciation
2. The state should strengthen scientific macro-control, comprehensively use economic and other means to support and guide the development of blockchain technology
3. The state should implement the new development concept, strengthen the supply side structural reform, vigorously develop the real economy, and promote the deep integration of big data, blockchain and the real economy. Build advanced manufacturing instry.
blockchain has the characteristics of decentralization, point-to-point transmission, transparency, traceability, non tampering, data security, etc., which can be used to solve some pain points of existing business and realize the innovation of business model. In essence, blockchain is a robust and secure distributed state machine. The typical technical components include consensus algorithm, P2P communication, cryptography, database technology and virtual machine. Its five essential core capabilities are data storage, shared data, distributed, tamper proof and privacy protection, and digital contract
the number of blockchain projects established in China has increased year by year since 2013, and decreased in 2017 e to policy supervision and other reasons, but the number of investment and average integration amount have graally increased.