The principle of blockchain accounting

Blockchain (1.0) is a distributed ledger based on cryptographic security, which is a book that is easy to verify and cannot be tampered with.
It is generally considered that the blockchain combined with smart contracts is blockchain 2.0. For example, Ethereum is a typical blockchain 2.0.
Many people only know about Bitcoin and do not know about blockchain. Bitcoin is actually a blockchain that uses a block The application of blockchain technology is just that Bitcoin is currently too hot, covering up the light of blockchain technology. Blockchain is the future, and I hope that developers care less about currency prices and more about technology.
This article will explain how blockchain 1.0 technology is implemented.

hash function

Before talking about blockchain accounting, let’s first explain the hash function.
Hash function: Hash (original information) = summary information
The original information can be any information, and a short summary information will be obtained after hashing

Hash functions have several characteristics:

  • The same original information can always get the same digest information with the same hash function
  • Any slight change in the original information will hash out the unrecognizable digest information
  • The original information cannot be reversely deduced from the summary information

For example:
Hash (Zhang San lent Li Si 1 million, the interest is 1%, the principal and interest will be repaid after 1 year...) = AC4635D34DEF
is recorded in the account book of AC4635D34DEF.

It can be seen that the hash function has 4 functions:

  • Simplified information
    is easy to understand, and the hashed information is shortened.
  • The identification information
    can use AC4635D34DEF to identify the original information, and the summary information is also called the id of the original information.
  • The hidden information
    ledger is a record such as AC4635D34DEF, and the original information is hidden.
  • Verification information
    If Li Si cheated and said that Zhang San only lent Li Si 100,000 yuan, both parties can use AC4635D34DEF to verify the original information

These four functions of the hash function are widely used in blockchain technology.
(Hash function is a set of functions or algorithms, and I will post an article dedicated to hashing in the future)

Blockchain accounting method

Suppose there is an account page transaction record with an account page serial number of 0 as follows:

account account bill balance instruction manual
King two 100 190 Received payment from xxx
Zhang San 100 30 xxxx
Li Si 120 90 170 xxxx

The accounting time is: 2017-10-22 10:22:02

The blockchain will take the account page information (including serial number, accounting time, transaction record) as the original information for hashing, and get a hash value, such as: 787635ACD, which is expressed as a function:

Hash(序号0、记账时间、交易记录) = 787635ACD

The combination of the account page information and the Hash value constitutes the first block.

In the Bitcoin system, the account is recorded every 10 minutes, that is, the generation time of each block is about 10 minutes apart.

When recording the second account page, the hash value of the previous block and the current account page information will be hashed together as the original information, namely:

Hash(上一个Hash值、序号1、记账时间、交易记录) = 456635BCD

In this way, the second block not only contains the information of this account page, but also indirectly contains the information of the first block. If the accounting is continued in this way, the latest block always indirectly contains all the previous accounting page information.

All these blocks are combined to form a blockchain, which constitutes a blockchain that is easy to verify (as long as the hash value of the last block is verified, it is equivalent to verifying the entire ledger), which cannot be changed (any transaction information The change will cause the hash value of all subsequent blocks to change, so that the general ledger cannot be passed during verification.

There is a cost to bookkeeping. To understand why nodes need to book accounts, please read this: How to mine Bitcoin (mining principle) - Proof of Work

☛ Explain the blockchain in simple terms - systematically learn blockchain and create the best blockchain technology blog.

☛ My knowledge planet answers blockchain technology questions for you, welcome to join the discussion.

☛ Follow the official account "Blockchain technology in simple terms" to get information about blockchain technology as soon as possible.

The principle of blockchain accounting

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326364558&siteId=291194637