Everyone's account book of blockchain
"Blockchain is equivalent to this account book, and the block is equivalent to a page of this account book. The information carried in the block is the transaction content recorded on this page. The blockchain is block by block, and each block is filled with transaction records and connected together to form a chain, which is called blockchain. "
take bitcoin as an example, there is a "power race" every ten minutes to compete for the right to charge. It's like saying that you have a lot of calculation power, just like your muscles are stronger and more capable of fighting. Everyone will convince you to keep this account, that is, the right to write a block (note that it is not the content in the block) to the general ledger of the blockchain. However, it should be noted that computing power can only determine the probability of winning the competition. For example, there are several lotteries in total, and those with more computing power can buy more to improve the winning probability. However, those who buy more may not win the lottery in the end.
blockchain is a data block chain guaranteed by such computing power. Starting from the first block, each block collects data according to certain rules, and then attaches a value to these data, so that the result of the formed data block after similar one-way function calculation falls into a certain range. By estimating the computing power of the whole network and the size of the control result range, the data blocks that meet the requirements can be found in a long enough time. This calculation result will be included by the next block, and the chain data structure formed in this way is called blockchain
each small ledger is called a block, and each different blockchain protocol (generating different cryptocurrency) will specify the size of each block (the initial bitcoin is 1m). The ledger constitutes a block, the block constitutes a chain list, and the block header contains the hash value of the previous block, which is the blockchain. In this way, no one can modify the content or exchange the order at will. If you do, it means you need to recalculate all the special numbers
regulations allow everyone in the world to build blocks. Every person who builds a new block (finds this special number - sha256 value has 30 zeros) can get a reward. For this part of people (miners) who build a new block:
1. There is no sender information, There is no need to sign
2. Each new block will add a new virtual (encrypted) currency to the whole currency
3. The process of building a new block is also called "mining": it requires a lot of work and can inject new currency into the whole economy
4. The work of mining is: receiving transaction information, building blocks, broadcasting blocks, Then get new money as a reward
for each miner, each block is like a small lottery, and everyone is trying to guess the number quickly until a lucky person finds a special number, so that there are many zeros at the beginning of the hash value of the whole block, and they can get a reward. I remember a Zhihu respondent gave an image analogy. Blockchain is like a king with a beautiful daughter (block). Many young people are looking forward to it. The king's method is to give a very difficult topic for all young people to calculate (learning to change their lives), Who can calculate quickly (or be lucky in the process of calculating the hash value) will be able to win the beauty
for users who want to use this system to collect and pay, they don't need to listen to all the transactions, but just listen to the blocks broadcast by the miners, and then update them to their saved blockchain
"block" can also be imagined as a box, There are some digital currencies and a small note in the block, on which the only transaction information generated in the past ten minutes is recorded, such as "small a transferred to small B100 yuan"; Of course, this piece of information must have been encrypted to ensure that only small a and small B (through the key in their hands) have the ability to interpret the real content
after this magical block was created, it was soon buried underground. Where is it buried? No one does not know that all computer nodes need to participate in digging three feet before it is possible to find (find an effective workload proof). Obviously, this is an event with huge workload and random results. However, for the computer node, once the block is g out from the ground, it will get the valuable digital currency in the block, as well as the tip paid by small a in the process of "small a transferred to small B100 yuan". At the same time, for this node, only he has the right to truly record the contents of the note, which is an honor, while other nodes can only use its , a without digital currency blessing. Of course, there are some other special things about this magical block.
the process of computer nodes digging out blocks from underground is called "mining". As I said just now, this is a huge workload, a lot of luck and a lot of profits. A node on zhangheng road in Pudong New Area of Shanghai, China, suddenly jumped out and said excitedly, "I've g the block! The little notes inside are all valid! The reward belongs to me! ". Although Zhang Heng Road node has got digital currency at the moment, for other computer nodes, because it also involves some other interests, they will not choose to believe what Zhang Heng Road node says by default; Based on the principle that strangers do not trust each other, they take the so-called block () g by Zhang Heng Road node, and start to check whether the small note information in the block is true and effective, etc. In the world of blockchain, nodes check the accuracy of the small note information, or indirectly or directly judge whether the node that successfully digs out the block is lying How to define the true and effective information of a small note will be explained later, but I won't go into details here. In the verification process, each node will directly express their identification (accurate) and attitude towards zhangheng road node through the following two behaviors: stop half or even 80% of the mining process; Add the block () g out by zhangheng road node to the end of its own blockchain. You can be a little confused: if you stop mining, you may have done 80% of the mining work. Then 80% of the previous work is in vain?! Then, what the hell is at the end of the blockchain? For the first puzzle. I want to say that what you said is right, but there is no way. The reality is so cruel. Even if 80% of the work is done, you have to give up. The 80% of the work can be regarded as useless, absolutely damaging the wealth and the masses. The second puzzle is, what is the ghost at the end of blockchain and blockchain? Here, it is not clear in advance, but you can simply imagine: blocks are generated and g out periodically, and a computer node may have executed "take blocks from others" n times in advance; The process of "checking the validity of small notes" must have stored n blocks on its own node, and these blocks will be arranged in a chain in order of time. Yes, this chain is what you always think of as the blockchain. If you still can't understand, it doesn't matter. There will be many opportunities for in-depth study later in the article
go into the more microcosmic world of the block and have a look at what the little note really is, how it came into being and its mission all its life: when initiating a transaction, the initiator will receive a little note, and he needs to write the transaction record, such as "stealing transfer to a piece of RMB 340" on the paper. It's amazing that when it's finished, on the back of the note, the transaction record will be automatically formatted to at least contain the two important fields of "input value" and "output value"“ Input value is used to record the effective source of digital currency, and output value is used to record the object to which digital currency is sent. The newly created note is immediately marked as an "unconfirmed" note. Small pieces of paper that are successfully g out of the ground and eventually connected to the blockchain are initially marked as "valid.". If the valid slip is used as the input value of other transactions, the valid slip will soon be marked as invalid. Due to various reasons, the block is disconnected and discarded from the chain, and the small notes once marked as "valid" in the block will be re marked as "unconfirmed". There is no concept of account balance in the blockchain. The digital asset you really own is actually a piece of transaction information; Get the balance in your digital wallet by simple addition and subtraction. The above 1, 2 and 3 are just the knowledge points forced to you at the beginning. Some of the descriptions may be a bit confusing, which makes you feel confused. Only by understanding the whole blockchain can you have a more comprehensive understanding of the mystery
block capacity. Bitcoin specifies that the block capacity is 1m when it is created, or in the source code. The reason why it was originally designed as 1m is, on the one hand, to prevent DoS attacks. On the other hand, when Zhongben Cong created the blockchain, the capacity was 32m. However, he changed the block capacity to 1m through a humble commit like "clear up". In order to prevent the volume of the blockchain from growing too fast, he added some mystery to the problem of block capacity. The capacity of 1m means that the maximum number of transactions processed by bitcoin is about 2400 (the size of 486882 block 1034.39 is very close)
to put it bluntly, blockchain is a small book for distributed bookkeeping, a tool for bookkeeping, and based on cryptography and cryptography technology, once data transactions are recorded in the book of blockchain, data can not be tampered with and denied. The Internet is the transmission of value, and the blockchain is the transmission of trust. Under the premise of blockchain technology as a credit endorsement, each node in the blockchain changes from a single center to a unified multi center with multi-party participation, which can achieve transaction transmission without the participation of a third party organization and improve the efficiency
blockchain is a distributed shared ledger and database, which has the characteristics of decentralization, distributed storage, encryption algorithm, whole process trace, traceability, collective maintenance, openness and transparency
take taking charge of Department funds as an example, the traditional way is to assign a person in the Department to keep accounts and manage the Department funds. This person can directly manipulate the remaining amount or the amount of each use, and make profits from it by taking advantage of his authority. This is the traditional centralized management
and in the blockchain management mode, , everyone in the Department has a fund use book, which is added by relevant personnel, and synchronized to their own book after other personnel check. Each transaction will record the usage time, user, amount and content of funds, and generate corresponding serial number for marking. The serial number of each transaction will be stored together with the usage of the next transaction. Each bookkeeping will be encrypted, and so on. At the same time, the account book of each person in the Department is visible to everyone outside, and anyone can query the use of each fund through the account book
in the management mode of blockchain, multi person synchronous bookkeeping is "decentralized management"
everyone in the department checks and stores it, which is called "consensus mechanism"
everyone records the use of each fund, which is called "distributed storage"
the serial number generated by the detailed usage of each fund is called "hash value"
store the serial number and the usage of the next fund, which is called "whole evidence chain"
everyone's account book is visible to everyone outside, which is called "openness and transparency"
to query the usage of each fund is called "traceability"
if someone wants to tamper with a certain amount of funds, the serial number of the funds will be changed accordingly, and this person needs to tamper with all subsequent account records on the account book and the account book records of all people. However, this can be realized on the premise that it can crack the encryption processing of everyone's every bookkeeping. Moreover, once the system finds that there is an account book different from everyone's, the blockchain will automatically correct the "wrong" account book. This can fully guarantee the originality and non tamperability of blockchain electronic data
constructor(index,timestamp,data,previousHash=' 39;)< br />{
this.index=index;< br />this.timestamp=timestamp;< br />this.data=data;< br />this.previousHash=previousHash;< br />$this.hash=this.calculateHash();< br />}
calculateHash(){
return SHA256(this,index+this.previousHash+this.timestamp+JSON.stringify(this.data)).tostring();< br />}
}
class Blockchain{
constructor(){
this.chain=[this.createGenesisBlock()];<
}
/ / create a generated information block
creategenesis block() {
return new block (0, & quot; 01/01/2019",& quot; Genesis block", 0);
/ / the date is the user's data. In fact, it is the hash value obtained by adding several values together. Here, the information is encrypted and the picture is encrypted. Then the data is still stored in the database, but all the data are hash values. To get this data, you must know the hash value of the previous data block. Then, if the hacker needs to crack all the nodes, the hash value is decrypted, Then all the blocks from the first node to the last node can be decrypted to get the real data. So the security of data stored in the blockchain depends on whether the data is encrypted. If the plaintext is not encrypted, then it is not a blockchain
}
/ / get the last block
getlatesblock() {
return this.chain [this.chain. Length-1]
}
/ / create block
addblock (newblock) {
newblock. Previoushash = this. Getlatesblock(). Hash< br />newBlock.hash=newBlock.calculateHash();< br />this.chain.push(newBlock);< br />}
}
blockchain technology is considered to be the next generation of disruptive core technology after steam engine, power and Internet. If the steam engine has released people's proctivity, the power has solved people's basic living needs, and the Internet has completely changed the way of information transmission, then the blockchain, as a machine for building trust, may completely change the way of value transmission of the whole human society
first, the essence of blockchain is a distributed public ledger
take a popular example to explain that Mr. w's family, including Mr. W, Mrs. W, Mr. w's grandfather and Mrs. w's grandmother, all record their expenses in their respective books. Because Mr. w's family doesn't trust each other. Mr. W is diligent in raising his wife every month, but Mrs. w may receive 1000 yuan, but she receives 100 yuan. Isn't that a big loss
how to solve this problem with blockchain
if Mr. w gives Mrs. w $1000 one day, he just shouts at the whole family that Mr. w gives Mrs. w $1000. Please write down "Mr. w gives Mrs. w $1000" on their respective account books
so everyone in Mr. w's family becomes a node, and every transaction of Mr. w's family is recorded by everyone (each node)
every night who washes the dishes (proof of workload) can settle the bill in the public ledger, and there is a reward for washing the dishes. A new transaction must be added to the universally recognized ledger of the previous day, and other people will also participate in verifying the transactions of the day
Second, it seems very simple, but blockchain may bring revolutionary changes to human society
1. Machine trust
machine trust is actually trust without trust. For the first time in human history, a large-scale cooperation network unprecedented on earth can be established at near zero cost, which is bound to be a great mass movement
2. Value transfer
the emergence of the Internet has made the means of information dissemination achieve a leap, and information has realized efficient flow, but the efficiency of Internet value transfer is still very slow. At present, e-money on the Internet is still the traditional paper money in essence, and transnational payment is still a big problem
the birth of blockchain is the beginning of human value transmission network. It will enable people to transfer value as conveniently and cheaply as information on the Internet, which can be expressed as capital, assets or other forms
3. Smart contract
smart contract can replace all paper contracts, and more importantly, blockchain can perfectly connect the physical world and virtual world. The perfect combination of blockchain, Internet of things and artificial intelligence makes the imagination more huge
the blockchain itself is actually a super platform. The commercial characteristics of building machine trust, value transfer and smart contract on the blockchain are: ① close to zero trust cost. ② The marginal cost of constructing and trading assets tends to zero
so Mark Anderson, a web browser pioneer, said: in 20 years' time, we will talk about blockchain as we talk about the Internet today.
generally speaking, blockchain technology refers to a way for the whole people to participate in bookkeeping. There is a database behind all the systems. You can think of the database as a big ledger. So it's very important who keeps this account book. At present, whose system will keep accounts, wechat's account book is Tencent's account book, and Taobao's account book is Ali's account book. But now in the blockchain system, everyone in the system can have the opportunity to participate in bookkeeping. If there is any data change in a certain period of time, everyone in the system can conct bookkeeping. The system will judge the person who has the fastest and best bookkeeping in this period, write the content of his records into the account book, and send the content of the account book to all other people in the system for backup. In this way, everyone in the system has a complete account book. This way, we call it blockchain technology
cryptocurrencies such as bitcoin, Puyin, Ethereum and dogcoin are just an application of blockchain.
Ledger is a book with a certain format and several account pages. Based on the accounting documents, it records all economic business in chronological order and classification, which is what we usually call the ledger. Blockchain represents a unique data record format. Blockchain is "block + Chain". The so-called block is the meaning of data block. Each block is connected by a certain mark to form a chain
Super ledger
hyperledger (Chinese name is super ledger, collectively referred to as hyperledger) is an open source project launched by Linux foundation in 2015 to promote blockchain digital technology and transaction verification. The goal of hyperledger is to enable members to work together to build an open platform to meet the needs of various users from different instries, while greatly simplifying the business process. The founding members of hyperedge include IBM, Intel, Cisco and other large companies. By the end of this book, more than 183 organizations and companies have joined hyperedge, and they are growing rapidly
at the beginning of hyperledger project, Linux foundation has received a number of different code bases, including IBM code base (inspired by Ethereum to a certain extent), Dah (bits of proof bitcoin code base) and sockstream code base (an extension of bitcoin code base). In addition, there are digital asset and ripple contributions. With the development of the instry, a single project has been unable to meet the needs of the business, so hyperledger has graally developed from a single project into a project group. At present, hyperledger is not a specific technology, but a set of blockchain technology frameworks. Up to now, the hyperledger project team contains 9 formal projects and more than 50 moles related to these formal projects
the Xueshuo innovation blockchain Technology Workstation of Lianqiao ecation online is the only approved "blockchain Technology Specialty" pilot workstation of "smart learning workshop 2020 Xueshuo innovation workstation" launched by the school planning, construction and development center of the Ministry of ecation of China. Based on providing diversified growth paths for students, the professional station promotes the reform of the training mode of the combination of professional degree research, proction, learning and research, and constructs the applied and compound talent training system