Where are the blocks of blockchain stored
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
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/bitcoinin 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.