喵 区 blockchain 27 issues | a trick to teach you the fast blockchain hardcore technology "old driver"

Symmetric encryption & asymmetric encryption

First of all, why should we encrypt the data?

For example, Agent A wants to write a letter to Agent B. If it is not encrypted, it will be transmitted directly in clear text. It may be intercepted by a malicious third party during the transmission process. The malicious third party falsified the data, and the B party received the wrong data, causing the agents A and B to die.

Symmetric encryption was born, Agent A intends to encrypt the letter, but Agent B needs to encrypt and decrypt the rules if it needs to be decrypted. This rule is called "key", so Agent A puts the encrypted letter with the key. The transmission has passed, but there is also a problem. The key and the letter are stolen by the bad guys along the way, and the same consequences can be caused.

In view of the drawbacks of the traditional encryption method, we have come up with a new countermeasure, which is asymmetric encryption. Asymmetric encryption is a method of encrypting and decrypting with different keys, or in the original scenario, Agent A wants to send a copy to B. The secret letter, but Agent B, as the recipient, generates a pair of keys, including the public key and the private key. He keeps the private key well and exposes the public key. Everyone can see that Agent A uses B's public key. The secret letter is encrypted, and the encryption is sent to B. If the B decrypts with its own private key, the content of the secret letter can be restored, thus avoiding the transmission and exposure of the private key and ensuring information security.

digital signature

Digital signatures should never be imagined as electronically written signatures. We abstractly understand, what is the process of signatures? Is a process of self-certification, then in the digital world, how do we self-certify?

First, Xiao A wrote a letter to Xiao B. How can I prove that this letter was written by Xiao A? The small A encrypts the summary information of the letter with its own private key and transmits it to the small B together with the letter. The process of encrypting with the private key is the process of digital signature, just as we used to self-certify the identity in the form of a stamp. After receiving the small B, it uses the public key of Xiao A to decrypt it. If the decrypted content is found to conform to the content of the letter, it means that the letter has not been tampered with. It is indeed from the hand of Xiao A. The process of decryption is the process of verifying the digital signature. .

Multi-Signature / Multi-Signatures

Multi-signature means the process of multi-person signature and multi-person private key encryption before the transaction takes place. Multiple signatures increase the security of the cryptocurrency so that one cannot take all of the digital currency without the consent of others.

Hash & hash

A hash function is a very magical function. No matter what the content or size, just a hash operation will generate a fixed-size and unique hash value.

I have seen a very very grounded example of this.

You think of the hash function as a slaughter machine: this machine can make any pig into the same length of sausage, but the patterns are different, so the final product – the same length of sausage with different patterns is Greek value.

Then why might you use hashing? This should be discussed from his traits:

First, irreversible: You can use the hash value to verify whether the original text has been tampered with, but you can't use the hash value to launch the original text, as if you can't guess the original appearance of the pig by observing the texture of the sausage.

Second, the calculation is extremely fast: Hash a 20G HD movie and a 5K text file have the same complexity, the calculation is very small, and the result can be obtained in 0.1 seconds. That is to say, no matter how fat the pig is and how hard the bone is, it takes only a blink of an eye to make the sausage.

This is the meaning of the hash algorithm.

Unspent Transaction Output / Unspent Transaction Output / UTXO

This point is very confusing for newcomers. Bitcoin is not our common account model. Under the common account model scenario, the 100 and 20 blocks I received today will not be counted, but will be directly accumulated into 120. But in the UTXO model, every income and expenditure is independent. For example, I put a 100 yuan in cash and 20 yuan in my wallet. Although the total amount is 120, if I charge 30, I need to put 100 yuan of cash to the other party, the other party gave me back 70 yuan, we can simply understand each banknote, just like a UTXO, UTXO is what you can spend, but has not spent money.

Consensus & Consensus Mechanism

In the traditional accounting system, which is controlled by one person or one subject, there will be no differences in accounting. The biggest difference in the blockchain is that the centralized management organization becomes history. The biggest problem is that there is no leader in the group. Participants in the blockchain network may have differences in the validity of the transaction.

When all participants in the blockchain network agree on the validity of the transaction, the local blockchain status of all participants is the same, which is a consensus.

So what is the consensus mechanism? To understand in a simple sentence, the consensus mechanism is the way and rules for screening the bookkeeper. The rules of the bookkeeper are clear, and the entire system is likely to reach an effective consensus. Our common consensus mechanisms include PoW, PoS, etc. We have already detailed science in the past ignorant videos.

node

A node is a network node in a blockchain distributed system. It is a server, computer, telephone, etc. connected through a network. The way to become a node for different types of blockchains will also be different. In the case of Bitcoin, participation in trading or mining constitutes a node.

The whole node is actually the node that synchronizes all blockchain data, including block headers, block bodies and other information.

The so-called light node only needs to store the blockchain header, and does not store the full amount of transaction lists and other information.

Mining difficulty

Bitcoin mining difficulty is a dynamically adjusted value. Many newcomers will think that the higher the bitcoin power, the faster the block rate will be. This can be said to be right, it is tricky. Bitcoin's block rate is 10 minutes per block. Once the power is increased or decreased, it will directly affect the time of the block. However, after every 2016 block (about 14 days), the difficulty of mining will be Automatically make adjustments based on the actual excavation time of the 2016 blocks.

The specific formula is as long as this:

New difficulty value (TARGET) = old difficulty value * (2016 * 10 minutes / previous 2016 block total block time)

Therefore, the longer the total block time of the 2016 block, the new difficulty value will decrease, and the shorter the total block time, the new difficulty value will rise, thus maintaining a dynamic balance of almost 10 minutes.

More detailed content about mining:

喵 区 blockchain 04 | Bitcoin mining, you are the closest to wealth!

Block Height / Block Height

The height of a block is the number of blocks between it and the creation block in the blockchain.

51% attack

Bitcoin's mining probability is directly proportional to the power, so if someone masters more than 50% of the computing power, he can find random numbers faster than others, create blocks faster, and thus modify past books. Record and even control the entire chain.

Double Flower / Double Spending

Double flower means that a sum of money has been spent twice or more. For example, Xiao A bought a package with Xiao B, and paid the fee. After getting the package, Xiao A sent the same payment and sent the same UTXO to himself. Xiao A excludes the transaction sent to Xiao B for mining (accounting process). If Xiao A has more than 50% of the calculation power, then the chain that Xiao A has dug will be the longest chain and is recognized by everyone. The chain, but the original small A to small B transfer record is excluded from this version of the book, so the small A successfully achieved a double flower.

Zero Knowledge Proof / Zero-Knowledge Proof

It refers to the certifier being able to believe that a certain assertion is correct without providing any useful information to the verifier.

This is very interesting.

How do you do that?

For example, A wants to prove to B that he owns the key to a certain room. If you use the zero-knowledge proof thinking method, then you can solve it:

B. Determine that there is an object in the room. A opens the door of the room with the key he owns, and then takes the object out and presents it to B, proving that he does have the key to the room.

The advantage of this is that B can't always see the key in the whole process of proof, thus avoiding the leakage of the key.

So what scenario can this be applied to? Blockchains such as Bitcoin, all transaction records are publicly visible, and according to certain networks, it is possible to trace the individual's assets, etc., which is clearly contrary to the rigid need for privacy protection. Zero-knowledge proof can enhance privacy protection, neither telling you the specifics of the transaction, but also proving the legitimacy of the transaction. More zero-knowledge proofs, anonymous coin topics, we will talk later.

Ethereum blockchain vs Ethereum virtual machine vs smart contract

I use an example to explain these three concepts in succession.

For example, Xiao A took a look at the large amount of American B drama resources library. For Xiao B, I will give you 10 ethers. You sold the resources to me, so Xiao A gave the small B's Ethereum address 10 Ethers. Ethereum blockchain transfer, and bitcoin transfer and so on are not much different.

But B is not bad, I feel that buying and selling is not interesting. He said to Xiao A, I will give you 100 online questions and answers. If you can answer all the questions, I will share the resources for you free of charge. This is a smart contract. When a pre-programmed condition (100 correct test questions) is triggered, the smart contract will immediately execute the corresponding contract terms (free delivery of the resource library), which works like if-then of a computer program. Statement.

You will find that the implementation of this smart contract is not directly in the Ethereum blockchain, because each segmentation scenario can create a lot of different smart contracts, so everyone puts this execution rule in the Ethereum virtual In the machine. Each time an account wants to execute a smart contract, a transfer occurs and the nodes in the network execute specific rules through the Ethereine virtual machine to run specific code. The virtual machine not only ensures the intelligence of the network, but also isolates it from the rest of the main network. The operation does not affect the operation of the main blockchain.

Turing complete

Turing Complete means that all computable problems can be solved. Bitcoin's scripting system is Turing's incomplete, and Ethereum's smart contract system is Turing-complete. Turing's completeness and Turing's incompleteness have their own advantages. Turing's incompleteness will be safer, and Turing's completeness will be more intelligent.

Decentralized Application / Decentralized Application / DApp

A DApp is a software application that runs publicly on the network. This technology is maintained by many people, not by an organization.

There are also some common technical terms "Byzantine General Problem / Fragment / Lightning Network / Isolation Witness / Side Chain / Cross-chain / Impossible Triangle", if you still have questions, you can view the ignorant blockchain video, we Have done a separate detailed introduction

I am a fat little man who doesn’t rely on his talents. We will see you next time.

If you are interested in our program, please scan the QR code below and add me to WeChat~

end