Blockchain who stores records there
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 />}
}
on the other hand, all nodes (computers in short) participating in the network will store one account book, which is updated in real time. Even if one node fails, the blockchain will not be affected.
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.
Blockchain technology is not only the basic technology of bitcoin, but also the core and infrastructure of bitcoin. Bitcoin has never had any centralized organization, operation and management. Later, bitcoin technology was abstracted, called blockchain technology, or distributed ledger technology
{rrrrrrr}
extended data:
the disadvantages of blockchain technology applied to digital currency:
first, there is no circulation management organization for "decentralization". In essence, blockchain technology is a distributed database system, its logical structure is one-way linked list, and its design mode is based on P2P network, which determines that there is no unified virtual currency central control system based on blockchain technology
Second, it is difficult to effectively control the quantity supply. Based on blockchain technology, the virtual currency circulation is fixed. According to Fisher Equation, under a certain price level, there is a certain proportion between the total amount of transactions and the amount of nominal money needed in a certain period of time, and the fixed amount of money obviously can not meet the requirements of the growing total price of social goods Third, it is difficult for "mining mechanism" to create recognized value. Bitcoin itself has no value and no national credit support. Some people think that "by continuously consuming computing power and energy, the value is injected into the virtual currency", but in order to find the hash value that meets the requirements, it is obviously not the most effective choice to spend millions of calculations Fourthly, procers and early holders are easy to get high seigniorage. Any virtual currency based on blockchain technology is held by a few people in the early stage of development. Take bitcoin, for example. At first, bitcoin was just a proct of a few people's games. In May 2010, the first purchase of bitcoin was $25 pizza purchased by 10000 bitcoin, and the first transaction completed in July of the same year was $0.04/bitcoinblockchain is the big ledger of bitcoin network, and each block is equivalent to a page in the ledger. What information is recorded in the "account book"? At present, each block of bitcoin mainly records data such as block head, transaction details, transaction counter and block size
"block header" contains all information except transaction information, mainly including the hash value of the previous block header, which is used to ensure that blocks are connected in sequence; Time stamp: record the generation time of the block; Random number: that is, the answer to the arithmetic problem of PK for all miners in the whole network; Difficulty target: score the difficulty coefficient of the arithmetic problem
"transaction details" records in detail the transferor, income party, amount and digital signature of the transferor of each transaction, which is the main content of each block
"transaction counter" describes the number of transactions contained in each block
"block size" refers to the size of each block data. Currently, each block is limited to 1MB, which does not rule out the possibility of expansion in the future.