Merkle tree algorithm in blockchain
In today's era of high development of the Internet, we are using the Internet more and more frequently, which has become an indispensable and important tool in our life. In particular, the mobile phone used for Internet communication has been used as a medium. In today's era, we are using mobile payment more and more, There are more and more ways to move. So what is digital currency? What do you know about it{ But generally speaking, it is a form of money< p> Finally, for such a form of transaction, it's all for the convenience of our daily life, and it's also for serving our own broad masses of people, so we don't have to worry about the advantages and disadvantages of digital currency and mobile payment
Generally speaking, Merkel tree is a way to hash a large number of "chunks" of data. It depends on splitting these data "chunks" into data chunks with smaller units (buckets). Each bucket block contains only a few data "chunks", and then takes each bucket unit data chunk for hashing again to repeat the same process, Until the remaining total number of hashes is only 1: root hash
the most common and simplest form of Merkel tree is binary mekle tree, in which the data block of a bucket unit always contains two adjacent blocks or hashes. Its description is as follows:
decent, bitcoin and Ethereum smart contract are all this structure
distributed
git ensures that each code warehouse maintains a complete project library locally, not just the branch in which it works and its own submission history. At the same time, it also keeps all the snapshot and index information after the latest pull
on the blockchain, each node keeps a complete database locally, not just its own transaction information
traceability
in Git commit chain, each commit object contains a parent object (the object of the last commit, except the first commit), which can trace all the previous records
on the blockchain, each block contains the index of the previous block (except the genesis block), which can trace all valid transactions before<
tamper proof
in Git's commit chain, each object itself calculates a checksum before storing, and then references it with a checksum. Once modified, the checksums will not be correct, which means that it is impossible to change the contents of any file or directory without git's knowledge< The mechanism used by git to calculate the checksums is called SHA-1 hash. This is a string composed of 40 hexadecimal characters (0-9 and A-F), which is calculated based on the content or directory structure of the file in GIT. SHA-1 hash looks like this:
in the blockchain, each block contains the last block ID, and this block ID has two SHA-256 hashes, which are calculated based on the block content. Once the content is modified, the hash will change, which is inconsistent with the chain of other nodes and cannot be added to the longest chain, so the content cannot be tampered with< 2. Difference
collective consensus and central node will: 1 - blockchain merges based on collective consensus (POW / POS) to form the longest chain, which is the main chain
2 - in Git system, when multi node cooperation is carried out through the warehouse hosting platform, it is the manager of the platform project who controls the power of merge, which reflects the will of the central node<
cryptography
1 - in bitcoin blockchain, cryptography mainly uses the following methods
in the whole system of bitcoin blockchain, a large number of public encryption algorithms are used, such as Merkle tree hash number algorithm, elliptic curve algorithm, hash algorithm, symmetric encryption algorithm and some coding algorithms. The functions of various algorithms in bitcoin blockchain are as follows:
A) hash algorithm
the two hash functions used in bitcoin system are: 1. SHA-256, which is mainly used to complete pow (proof of workload) calculation; 2. Ripemd160, mainly used to generate bitcoin address
b) Merkle hash tree
binary tree or multi tree based on hash value. In the computer field, Merkle tree is mostly used for integrity verification. In the distributed environment, integrity verification can greatly rece the complexity of data transmission and calculation<
C) elliptic curve algorithm
in bitcoin, the public key cryptography algorithm based on secp256k1 elliptic curve mathematics is used for signature and verification. On the one hand, it can ensure that the user's account is not replaced by an impostor, on the other hand, it can ensure that the user can not deny the signed transaction. The private key is used to sign the transaction information, and the user's public key is used to verify the signature. If the verification is passed, the transaction information will be recorded and the transaction will be completed
d) symmetric encryption algorithm
the official bitcoin client uses AES (symmetric block cipher algorithm) to encrypt the wallet file. After the user sets the password, the private key of the wallet is encrypted by the user set password through AES to ensure the security of the private key of the client
e) base58 encoding
base58 is a unique encoding method used in bitcoin. It is mainly used to generate the wallet address of bitcoin, which is similar to the permutation algorithm mechanism in classical cryptography. Its purpose is to increase the readability of bitcoin and change the binary hash value into the address we see
2 - git: SSH key is mainly used for remote login verification, SHA-1 is used for code content checking sum<
SSH is the abbreviation of secure shell, developed by IETF's network working group. It is a protocol designed to provide security for remote login sessions and other network services. SSH protocol can effectively prevent information leakage in the process of remote management< The process of SSH transmission is as follows: (1) the remote host receives the user's login request and sends its public key to the user 2) The user uses the public key to encrypt the login password and send it back 3) The remote host uses its own private key to decrypt the login password. If the password is correct, the user is allowed to log in.
capital monopoly
SPV refers to "payment verification", not "transaction verification"
SPV node: supports the use of Bloom filter to quickly retrieve and return relevant data
or thin client? Central business figures?