Teacher Xiao Zhen from Peking University <<Blockchain Technology>> Note 1

course outline

  1. Cryptography Basics
  2. Bitcoin Data Structure
  3. Consensus Protocol and System Implementation
  4. Mining algorithm and difficulty adjustment
  5. bitcoin script
  6. Soft forks and hard forks
  7. Anonymity and Privacy Protection

Ethereum is behind

The first is the learning of the basics of cryptography:

Crypto-currency (virtual currency) is not encrypted, and all teachings on the blockchain are public. Among them are the transfer amount and address.

cryptographc hash function (cryptographic hash function) features

1.collision resistance hash collision (currently unavoidable)

For example: there are two values ​​x and y, where x!=y, but the hashed value H(x)==H(y), this is a hash collision (collision resistance).

There can be many, unlimited, input numeric styles. However, the values ​​​​from the hash function are limited. It can be used to detect whether the data has been changed. If the hash value is changed, it will not match the original value.

There is no efficient way to make artificial hash collisions. If you know a y, there is no specific way to find x so that H(x)==H(y), you can only use brute-force (brute force) to find one by one.

There is currently no hash function that can be mathematically proven to be a hash collision.

But in the past, MD5 was also considered to be a hash collision at the beginning. But then people found a way to artificially collide, so it's not safe.

2. Hiding one-way irreversible

For example: Knowing an x, you can calculate H(x). But knowing H(x) can't calculate x.

Because each of them can be solved by brute force, the space of the input results required for hiding to be established is large enough to ensure that each possibility is roughly the same.

Among them, collision resistance (hash collision) + hiding (one-way irreversible)

A digital commitment (digital entrustment) or a digital equivalent of a sealed envelope (digital equivalent) can be generated , similar to the result that can be placed in a notary in advance, and the result can be compared with it.

In the hash function, the data is encrypted. Because of the nature of hiding , when the data encrypted by the hash function is changed, there is no way to decrypt it to its original form (the collision resistance property is used).

However, if the input data samples are too few, you can add a nonce (random number) after it , so as to increase the input space to ensure the nature of hiding .

3. Hash functions in Bitcoin often have properties 3

3. puzzle friendly (no shortcuts)

It means that if the hash function you want to calculate satisfies certain conditions or is in a certain range, you have no shortcuts, puzzle friendly can only try one by one.

The process of Bitcoin mining is to find a nonce (random number) . The random number and other information in the block header are combined as input, and the obtained hash value should be less than a specific value.

So because of the puzzle friendly nature, there is no shortcut in the process of mining bitcoins, and you can only try one by one.

A proof of work mentioned here means proof of work in mining.

Maybe the first nature and the third nature are easy to confuse

The third property (puzzle friendly) means that it is impossible to artificially obtain a specific (feature value) hash value.

The first property (collision resistance) means that hash collisions cannot be artificially created.

Here is also a sentence difficult to solve, but essay to verify

Although it is difficult to find a nonce that meets the requirements , it is very simple to prove whether it is correct once it is found, and it only needs to be calculated once.

SHA-256

The hash function used by Bitcoin SHA-> secure hash algorithm

Symmetric and Asymmetric Encryption Systems

Symmetry is the same key used for encryption and decryption.

Asymmetric is a pair (public key, private key)

Encryption uses the public key and decryption uses the private key. Note here that both encryption and decryption use the recipient's public key and private key.

bitcoin signature

Because cryptocurrencies are not encrypted, asymmetric encryption is required for signing. It means who initiated the Bitcoin transaction. For example, user A signs the transaction with his own private key, and other users use A's public key to verify the correctness of the signature after getting the transaction information.

The signature in Bitcoin is generally to take a hash of the content first, and then sign it.

Moreover, the probability of duplication of the private key and the public key is extremely low, and it has not appeared at present.

2022.5.29 Summary of Learning Content

Guess you like

Origin blog.csdn.net/qq_45859272/article/details/125038712