How to store blockchain in the end
Blockchain is a kind of technology, which solves the core "trust" problem in the market economy and reces the trust cost between strangers to a very low level
there is one crucial thing in the market economy, which is "trust". Without trust, no deal can be established. When you go to LAICHANG to buy vegetables, if you don't believe that the pesticide content in vegetable is up to the standard, you won't trade with that dealer; If you buy a bottle of water in a small shop, the clerk will not sell you the water if he doesn't believe that the money you give is real
the traditional small-scale peasant economy is acquaintance economy, and the transaction scale is limited to people who are familiar with each other nearby. If an acquaintance deceives you, he will lose your social relationship and damage his reputation in the whole circle of acquaintances. We believe that acquaintances are less likely to cheat us than strangers
therefore, once we are beyond the scope of acquaintances, we need to use a high cost to identify whether a stranger will cheat me and how to avoid the risk of being cheated. This situation will hinder the transaction and restrict the transaction
in addition, different races, nationalities, cultures, religious beliefs and so on will naturally have this kind of trust problem
in the market economy, why can there be so many transactions between strangers? Because of the birth of a new mechanism to solve the problem of trust in strangers
so far, the most important mechanism to solve the trust problem is the "trust intermediary" organization and mode
as long as you and strangers trust a third-party organization, the trust problem between you can be solved through this third-party organization
this third-party organization, we call it trust intermediary. Both the government and the bank are trust intermediaries
you can sell the goods you have worked hard to proce to a stranger in exchange for a stack of RMB banknotes. It's because the credit of the note issuing bank and the guarantee of the authority of the government guarantee the currency value and effectiveness of the banknotes. Otherwise, sell things, in exchange for a few ordinary paper, who would like to
in the era of global village and Internet, the people who buy your things may be strangers who will not meet and thousands of miles away. Trust is lower, so Alipay assumes the role of trust intermediation. Buyers first pay the goods to Alipay's account. When they receive the goods, they confirm that they are OK, then they agree to sell the goods to the seller. Taobao and other e-commerce have been booming rapidly in just over ten years
trust intermediary is in a central position in the transaction system. All transactions should solve the trust problem through it
However, the cost of trust intermediary itself is often hugeas a trust intermediary, how much transaction tax does the government charge each year? What is the most profitable instry? Financial services. The annual profits of Alipay's ant suit are over ten billion. p> What does this mean? Both sides of the market actually pay a huge trust cost
if there is any way to cancel or greatly rece the trust cost, the transaction cost of the general public can be reced, and the profits can be greatly increased
so in the Internet era, blockchain technology is on the stage
it allows the trading party to get rid of the intermediary, solve the problem of trust among strangers, and greatly rece the cost of trust
the blockchain can be expanded on a large scale, the data is open and transparent, the data of each client is consistent, and even if some clients are destroyed, the data security will not be affected. These highly reliable technical features can solve the trust problem of strangers with low cost
this technology can be extended to all fields that can be digitized, such as digital currency, payment and clearing, digital bills, proof of rights and interests, credit reference, government services, medical records, etc
in the medium and long term, blockchain will be a revolutionary technology, which will bring about great social changes like the existing Internet, and has great investment value and money making opportunities
in the future, the companies that can combine blockchain with different scenarios to promote applications may be the next group of bat, the next Google, Microsoft and apple
as the first practical application of blockchain technology, bitcoin has been widely accepted and used all over the world. Millions of users and tens of thousands of merchants have accepted the payment of bitcoin as a digital currency, and the exchange value of bitcoin as a currency is growing. Even e to the consensus that the total amount is fixed and the long-term value is bullish, bitcoin has become a hedge asset similar to gold, and the price has skyrocketed
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 />}
}
generally, the blockchain platform will provide corresponding interfaces, such as RPC, json-rpc, HTTP, etc. of course, the platforms are not the same, and the degree of friendliness is different
some companies specializing in API, such as blockcypher, can provide friendly calling interfaces, and it is not very convenient to write answers on the mobile phone, Search below
as for the storage content, add a point: in addition to the conventional cloud storage, file entities on the file hash record chain also have blockchain based storage schemes, such as IPFs, storej and so on
first, data security: blockchain makes data flow "at ease"
with its trustworthiness, security and non tamperability, blockchain liberates more data. A typical case is used to illustrate how blockchain promotes the generation of big data for gene sequencing. Blockchain sequencing can use the private key to limit access rights, so as to avoid the legal restrictions on indivial access to gene data, and use distributed computing resources to complete the sequencing service at low cost. The security of blockchain makes sequencing an instrialized solution, realizing global scale sequencing, thus promoting the massive growth of data< Second, data open sharing: blockchain guarantees data privacy
the government has a large number of high-density and high-value data, such as medical data, population data, etc. The opening of government data is the general trend, which will have an inestimable impetus to the development of the whole economy and society. However, the main difficulty and challenge of data opening is how to open data while protecting personal privacy. Data desensitization technology based on blockchain can ensure data privacy and provide a solution for data opening under privacy protection. Data desensitization technology mainly uses hash processing and other encryption algorithms. For example, enigma based on blockchain technology can protect the privacy of data and eliminate information security problems in data sharing by computing data without accessing the original data. For example, employees of a company can safely open the path to access their salary information and jointly calculate the average salary within the group. Each participant can know his or her relative position in the group, but he or she knows nothing about the salaries of other members< The schematic diagram of data hash desensitization processing
3. Data storage: blockchain is a kind of database storage technology that can not be tampered with, full history, strong endorsement
blockchain technology, through all nodes in the network participate in the calculation together, and verify the authenticity of their information to achieve the consensus of the whole network, it can be said that blockchain technology is a specific database technology. So far, our big data is still in a very basic stage. The data based on the consensus of the whole network and the reliable blockchain data are tamperable and historical, which makes the quality of the data gain unprecedented strong trust endorsement, and also makes the development of the database enter a new era< Data analysis: blockchain ensures data security
data analysis is the core of realizing data value. In data analysis, how to effectively protect personal privacy and prevent core data leakage has become the primary consideration. For example, with the application of fingerprint data analysis and the popularization of genetic data detection and analysis, more and more people worry that once personal health data is leaked, it may lead to serious consequences. Blockchain technology can prevent this kind of situation through multi signature private key, encryption technology and secure multi-party computing technology. When the data is hashed and placed on the blockchain, the use of digital signature technology can enable those authorized people to access the data. The private key not only ensures the privacy of data, but also can be shared with authorized research institutions. The data is stored on the decentralized blockchain and analyzed without accessing the original data. It can not only protect the privacy of the data, but also provide it to the global scientific research institutions and doctors for sharing. As the basic health database of all mankind, it will bring great convenience to solve the sudden and difficult diseases in the future
v. data circulation: blockchain protects the rights and interests related to data
for valuable data assets of indivials or institutions, blockchain can be used to register them. Transaction records are recognized, transparent and traceable throughout the network, making clear the source, ownership, use right and circulation path of big data assets, which is of great value to data asset transaction
on the one hand, blockchain can break the threat of intermediary ing data, which is concive to the establishment of a trusted data asset trading environment. Data is a very special commodity, which is essentially different from ordinary commodities. It is mainly characterized by unclear ownership and "being owned after seeing and ing", which also determines that the traditional commodity intermediary transaction method can not meet the needs of data sharing, exchange and transaction. Because the intermediary center has the conditions and the ability to and save all the flowing data, it is extremely unfair to the data procers. This threat can not be eliminated only by commitment, and the existence of this threat has become a huge obstacle to the flow of data. Based on the decentralized blockchain, it can break the threat of ing data in the intermediary center and protect the legitimate rights and interests of data owners
on the other hand, blockchain provides a traceable path, which can effectively solve the problem of data right confirmation. Through multiple nodes participating in the calculation in the network, blockchain can participate in the calculation and recording of data together, and verify the effectiveness of their information. It can not only carry out information anti-counterfeiting, but also provide a traceable path. The transaction information of each block is strung together to form a complete detailed list of transactions. The context of each transaction is very clear and transparent. In addition, when people have doubts about the "value" of a block, they can easily trace back the historical transaction records, and then judge whether the value is correct, and identify whether the value has been tampered or recorded incorrectly
with the protection of blockchain, big data will naturally become more active
the tokens of crowdfunding projects on coin Ying China platform are all developed based on blockchain technology, and relevant information will be recorded on the blockchain.
in fact, only high-level security data can be used for blockchain development, and most companies do not have this requirement. It can be understood that there are so many companies in the world, only a small part needs to use big data technology, and a smaller part needs to use blockchain technology. These two parts can intersect but do not include
for companies that normally use big data, there are non relational databases like HBase, mongodb, hive, Mr, spark and so on in terms of storage and processing, which have nothing to do with blockchain.