Simple realization of Python block chain _ block chain

Source: Internet
Author: User

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).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.