Block chain technology because of the popularity of bitcoin, we use Python code to chat about block chain technology:
Simple description of realization principle of block chain
Block chain technology as a digital accounting technology, its core is to save the transaction data in the block, in the form of encryption, in chronological order chain record. The block chain itself is a public database in which the new business data is stored in a container called a block, and the block is added to the chain of existing blocks. A bit like a greedy snake, the more chunks you eat, the longer the snake's body is; in the case of Bitcoin, the data is a set of transfer transactions. In a shared-bike scenario, the data can be a car-return transaction.
simple implementation Code of block chain
In the above code, block chain core storage of the data structure is a list, through the New_block () generated by the new block, is constantly added to the end of the block chain, each chunk of the hash value contains the block all the data information, in the calculation of the hash value of the process to reference the previous block of the hash value, Therefore, tamper-proof is achieved. And the biggest value of block chain database is this highly tamper-proof trustworthy calculation. This is demonstrated successfully in our simple block chain implementation. In the commercial level block chain application, the new block process is called the intelligent contract, the block chain is through the intelligent contract unceasing growth.
The following is the result of the code running, and the results are different at different times.
Run Results
To learn more about it technology, go to the 51Testing Software Test Network (http://www.51testing.com).