Blockchain technology is widely watched because of the popularity of Bitcoin, where we use Python code to talk about blockchain technology:
Simple description of the principle of blockchain implementation
Blockchain technology as a digital bookkeeping technology, its core is to save the transaction data block, in an encrypted manner, in chronological order chain records. The blockchain itself is a public database in which the newly-created business data is stored in a container called a chunk and added to the chain of existing chunks. A bit like a snake, the more chunks eaten, the longer the snake's body; in the case of Bitcoin, the data is a set of transfer transactions. In the case of a shared bike, the data can be a loan-to-car transaction.
Easy implementation code for blockchain
In the above code, the blockchain core storage data structure is a list, through the New_block () generated by the new block, is constantly added to the end of the blockchain, each chunk of the hash value contains all the data information of the chunk, in the process of calculating the hash value to refer to the previous chunk of the hash value, Therefore, tamper-proof is achieved. The maximum value of a blockchain database is this highly tamper-proof, trusted computing. This has been successfully demonstrated in our simple blockchain implementation. In a commercial-grade blockchain application, the process of creating a new block is called a smart contract, and the blockchain is constantly growing through smart contracts.
The following is the result of the code running, at different times, the results are different.
Run results
To learn more about it technology, go to the 51Testing Software testing network-the spiritual homeland of Chinese Software Testers (http://www.51testing.com).
Logic burn Brain: a simple implementation of Python blockchain