The technical cornerstones of blockchain mainly include ：
Public key cryptography
Workload certification mechanism
The core hash algorithm used by blockchain is SHA256, The calculated value cannot be decrypted back to the original content , It's one-way , And no matter how much of the original content , The length of the result is fixed , for example ：
You can see , Even if the difference in the original content is very small , The results are very different .
SHA256 It can be collision free , That is, no input
SHA256 There will be 2^256 Seed output , If we do 2^256+1 Time input , Then there must be a collision , We can calculate that , Suppose a computer runs at a rate of 10000 Time to hash , To pass 10^27 Years to complete 2^128 Secondary hash , So the chance of a collision is extremely small .
（2） Public key cryptography
This encryption technology helps users create a public key and a private key , Public key can be shared with others , The private key needs to be kept in secret .
If Chandler to Joey Transfer some bitcoin , This deal will include 3 Some information ：
Joey My bitcoin address （Joey The public key ）
The number of bitcoins traded
Chandler My bitcoin address （Chandler The public key ）
All of this data and encrypted digital signatures are sent over the network for verification . The digital signature is Chandler His bitcoin address and his joey The combined hash value of the number sent , This digital signature is encrypted by the private key .
When the miners receive this data , He'll verify it , Will do two jobs at the same time ：
Put all unencrypted data （ Transaction amount 、 Two people's public keys ） Put it in the hash algorithm , Get a hash value （ Such as Hash1）
Use Chandler The public key decrypts the digital signature , Get a hash value （ Such as Hash2）
If Hash1 And Hash2 identical , So it's a legal deal .
（3） Proof of workload
Everyone in the blockchain owns the ledger equally , So who will add blocks to the blockchain ？ How to trust this person ？
So , With Proof of workload POW The concept , It can be understood as solving a complicated problem , It takes a lot of calculation , The people who do this work are called “ The miners ”. The job of these miners is to validate transactions and solve complex mathematical problems associated with creating blocks .
Each block has a hash value , It's a combination of data , Include ：
Hash value of the previous block
Hash value of transaction data
The final hash value must be in the specified number of 0 At the beginning .
for instance , Given a basic string Hello, world!, Our workload requirement is ： You can add a string called nonce The integer value , Modify the changed string SHA256 Hash operation , If you get a hash result （ With 16 In the form of base ） In order to "0000" At the beginning , Then the verification is passed .
In order to achieve this goal of workload proof . We need to keep increasing nonce value , To get a new string for SHA256 Hash operation . According to this rule , We need to go through 4251 It takes two calculations to find just before 4 Position as 0 Hash of .
Who found this first nonce Who is the winning miner , You can add his blocks to the blockchain , Everyone can verify it , If it's right, update their blockchain , Continue to calculate the next block .
I hope that through the above brief introduction , It can give you a general understanding of blockchain technology , After that, the application details of blockchain technology will be introduced in detail .