区块链技术工作原理图解,区块链技术工作原理图片
请查看相关英文文档
⑴ Illustration of what is blockchain
Blockchain is so popular that it has begun to affect my life. I don’t even want to understand it anymore. Let’s take a look today. What exactly is blockchain.
Structure of this article:
As its name suggests,
A blockchain is a chain composed of a set of blocks.
A block is a block of information that contains information. , the chain also contains information.
Blockchain technology was first developed by a group of researchers in 1991 to time-stamp digital documents so that these documents cannot be tampered with. It essentially played no other role after that, until 2009, when Satoshi Nakamoto used blockchain technology to create the digital cryptocurrency Bitcoin.
A blockchain is a distributed ledger that is completely open to everyone. It has a very interesting property: once certain data is recorded in a blockchain, the data is very It is difficult to change.
Let’s take a look at the composition of a block:
Each block contains some data, the hash value of this block, and the hash value of the previous block. Hope value.
The data saved in the block is related to the type of blockchain. For example, the blocks in the Bitcoin blockchain save relevant transaction information, including sellers, buyers, and transaction Bitcoins. quantity.
Each block contains a hash value. The hash value is used to identify a block and all the content it contains, and it is unique, like a fingerprint. Once a block is created, its hash value is calculated accordingly. If you change something in the block, the hash value will change. If the fingerprint of a block changes, it will no longer be the previous block.
The third element contained in the block is the hash value of the previous block. This element allows links to be formed between blocks and makes the blockchain very secure.
Suppose we have a blockchain containing 3 blocks
Each block contains its own hash value and the hash value of the previous block
No. 3 Block points to block No. 2, and block No. 2 points to block No. 1
Block No. 1 is a bit special, it cannot point to the previous block because it is the first
We put 1 The block number is called the genesis block.
Now suppose we tamper with the second block
This will cause the hash value of the second block to change
This will then cause block 3 and all subsequent blocks connected to block 3 to become illegal
because Now the previous block number they stored has become illegal
So changing one block alone will jointly cause all subsequent contents to become invalid.
But to prevent tampering, hashing is not enough
Because today’s computer computing speed is powerful enough and can calculate thousands of hash values per second
This way You can tamper with a block and recalculate the hashes of other blocks, making your block legal again.
So in order to reduce this risk, the blockchain also uses a technology called proof of work
This is a mechanism that slows down the creation process of new blocks
In the Bitcoin area In the blockchain, it takes about 10 minutes to complete the required proof of work and add a new block to the blockchain
This mechanism makes the tampering of the blockchain more difficult
because once it is tampered Once a block is obtained, the proof of work of all subsequent blocks needs to be recalculated.
Therefore, the security of blockchain technology mainly comes from hash value and workload proof mechanism.
Blockchain also has a mechanism to protect its own security, which is distributed
Compared to using a centralized entity to manage the blockchain network, blockchain uses A peer-to-peer network that anyone can join
When someone joins this network, he will get a copy of the entire blockchain
This person can use this to verify that all The blocks are still legal and untampered, that is, different nodes can use this to verify each other.
When someone creates a new block,
the new block is sent to everyone on the network.
Everyone then verifies the block to ensure that it has not been tampered with.
If everything is verified correct, then everyone can add the new block to their own area. On the blockchain
We can call it that everyone on the network has reached a "consensus".
All nodes in the blockchain network reach a consensus
They agree on which blocks in the network are legal and which are illegal
Those blocks that have been tampered withThe block will be rejected by other users on the network
So, to successfully tamper with a blockchain, you need to tamper with all blocks on the blockchain
Recomplete the proof of work for each block, And control more than 50% of the users in the blockchain network
Only in this way will the blocks you tamper with will be recognized by everyone
It can be said that this is basically impossible to do!
Blockchain technology itself is also constantly developing
For example, a later technological improvement is called smart contracts
Smart contracts are simple programs stored on the blockchain
br /> It can automatically execute based on the conditions recorded in the contract. As long as the conditions are met, transactions will be automatically completed in accordance with the contract
For example, automated Bitcoin transactions can be realized under specific conditions.
Learning materials:
https://www.youtube.com/watch?v=SSo_EIwHSd4
⑵ What are the technical principles of how to implement on-chain acceleration in blockchain games?
Blockchain news, Bitcoin is to the blockchain what email is to the Internet. As we all know, for the first time in the history of human information dissemination and exchange, email has realized the function of sending data to anyone else in the world in a timely, free, and verifiable manner. Both the sender and the receiver can save a copy of the data sent in the email. . However, copies of email data retained by both parties also become an inherent flaw in online value transfers, since both parties own its value. Therefore, there must be a third-party institution that ensures that the value is not credited by double spending, for example, a bank, stock exchange, clearing center or notary. As an Internet protocol, Bitcoin allows transaction parties to transfer value to each other instantly and securely without the need for the existence of intermediary organizations such as credit third parties, thus reducing transaction costs and improving transaction efficiency. The editor now compiles a schematic diagram of the principles of blockchain technology and related technical principles for everyone.
Literally, the blockchain is a distributed ledger system composed of a series of data blocks generated using cryptographic methods. Each data block contains a large amount of transaction information and is used to verify its information. validity and generate the next block. These blocks are arranged one after another in the order of generation, and each block is a node.
The distinctive feature of the blockchain is that there is no third-party supervision as a central server, and the transaction information in the block cannot be changed. The information contained in a block can be a financial transaction or any other digital transaction, including documents. The Internet business model that has long dominated the business world of human society relies on its success as a credit-granting third-party financial institution that processes and mediates electronic transactions. The role of the credit-granting third party is to verify, protect and save transaction records.
Despite this, fraudulent online transactions still exist in large numbers, requiring mediation by a credit-granting third party, resulting in higher transaction costs. Bitcoin, based on blockchain technology, uses cryptographic proof rather than a credit third party, so that all parties willing to trade can achieve online transactions through the Internet.
Every transaction can be protected by a digital signature and sent to the recipient's "public key" that is digitally signed using the sender's "private key". Owners of Bitcoin, the cryptocurrency, need to prove ownership of their “private keys” in order to spend and trade online. The party receiving digital currency uses the sender's "public key" to verify the digital signature on the transaction, i.e., ownership of the other party's "private key".
Every transaction is broadcast to every node in the Bitcoin network and recorded in the public ledger after verification. Moreover, before each transaction is recorded in the public ledger, its validity needs to be verified. Therefore, the verification node needs to ensure two things before recording each transaction: namely,
(1 ) The consumer has signature authentication for his encrypted electronic currency;
(2) There is sufficient encrypted electronic currency in the consumer's account.
Figure 1 shows the transaction process and principle based on blockchain technology.
I hope this answer will be helpful to you
⑶ What is blockchain technology? What exactly is blockchain?
1. The so-called zone Blockchain technology, referred to as BT (Blockchain technology), also known as distributed ledger technology, is an Internet database technology that is characterized by decentralization, openness and transparency, allowing everyone to participate in database records.
Explain in layman’s terms: If we assume that the database is a ledger, reading and writing the database can be regarded as an accounting behavior. The principle of blockchain technology is to find out the accounting information within a period of time. The fastest and best person will keep accounts, and then send this page of information to everyone else in the entire system.
2. Blockchain is a new application model of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
Blockchain is an important concept of Bitcoin. It is essentially a decentralized database. At the same time, as the underlying technology of Bitcoin, it is a series of cryptographic methods related to each other. Each data block generated contains a batch of Bitcoin network transaction information, which is used to verify the validity of the information (anti-counterfeiting) and generate the next block.
(3) Extended reading of the working principle diagram of blockchain technology:
The blockchain system consists of data layer, network layer, consensus layer, and incentive layer , contract layer and application layer. Among them, the data layer encapsulates the underlying data blocks and related basic data and basic algorithms such as data encryption and timestamps; the network layer includes distributed networking mechanisms, dataData dissemination mechanism and data verification mechanism, etc.; the consensus layer mainly encapsulates various consensus algorithms of network nodes.
The incentive layer integrates economic factors into the blockchain technology system, mainly including the issuance mechanism and distribution mechanism of economic incentives; the contract layer mainly encapsulates various scripts, algorithms and smart contracts, and is the The basis of the chain's programmable features; the application layer encapsulates various application scenarios and cases of the blockchain.
⑷ What exactly is blockchain? Decrypt the concept of blockchain
⑸ What is the technical principle of blockchain
The key points involved in blockchain technology include: Decentralized, Trustless, Collectivelymaintain, ReliableDatabase, Timestamp, and AsymmetricCryptography wait.
Blockchain technology redefines the way credit is generated in the network: In the system, participants do not need to know the background information of other people, nor do they need to rely on guarantees or guarantees from third-party institutions. Blockchain Technology ensures that the system records, transmits, and stores value transfer activities, and the final result must be credible.
(5) Extended reading of the working principle diagram of blockchain technology
The source of the principle of blockchain technology can be summarized as a mathematical problem: the Byzantine Generals Problem . The Byzantine Generals Problem extends to Internet life, and its connotation can be summarized as: in the context of the Internet, when it is necessary to conduct value exchange activities with unfamiliar counterparties, how can people prevent themselves from being deceived by malicious saboteurs? Be confused and make wrong decisions.
Further extending the Byzantine Generals Problem to the technical field, its connotation can be summarized as: in the absence of a trustworthy central node and a trustworthy channel, the problems distributed in the network How should each node reach consensus. Blockchain technology solves the long-known Byzantine Generals Problem by providing a way to create a consensus network without trusting individual nodes.
⑹ What is the principle of blockchain technology development?
In a narrow sense, blockchain is a combination of data blocks that are connected sequentially in chronological order. A chained data structure, and an untamperable and unforgeable distributed ledger guaranteed by Midanhuai wide cryptography.
Broadly speaking, blockchain technology uses block chain data structures to verify and store data, uses distributed node consensus algorithms to generate and update data, and uses cryptography to ensure data transmission and access. It is a new distributed infrastructure and computing method that uses smart contracts composed of automated script codes to program and operate data securely.
Working Principle
The blockchain system consists of data layer, network layer, consensus layer,It consists of incentive layer, contract layer and application layer. Among them, the data layer encapsulates the underlying data blocks and related data encryption and timestamps and other basic data and basic algorithms; the network layer includes distributed networking mechanisms, data dissemination mechanisms and data verification mechanisms; the consensus layer mainly encapsulates Various consensus algorithms of network nodes; the incentive layer integrates economic factors into the blockchain technology system, mainly including the issuance mechanism and distribution mechanism of economic incentives; the contract layer mainly encapsulates various scripts, algorithms and smart contracts, and is the area The basis of the programmable features of the blockchain; the application layer encapsulates various application scenarios and cases of the blockchain. In this model, the chain block structure based on timestamps, the consensus mechanism of distributed nodes, economic incentives based on consensus computing power, and flexible and programmable intelligent contract signing are the most representative innovations of blockchain technology. .
⑺ [In-depth knowledge] Illustration of the encryption principle of the blockchain (encryption, signature)
First put an architecture diagram of Ethereum:
In The learning process mainly uses a single module to learn and understand, including P2P, cryptography, network, protocols, etc. Let’s start with the summary directly:
The problem of secret key distribution is also the problem of secret key transmission. If the secret key is symmetric, then the secret key can only be exchanged offline. If the secret key is transmitted online, it may be intercepted. Therefore, asymmetric encryption is used, with two keys, one private key is kept privately, and the other public key is made public. Public keys can be transmitted over the Internet. No offline transactions required. Ensure data security.
As shown in the figure above, node A sends data to node B, and public key encryption is used at this time. Node A obtains the public key of node B from its own public key, encrypts the plaintext data, and sends the ciphertext to node B. Node B uses its own private key to decrypt.
2. Unable to solve message tampering.
As shown in the figure above, node A uses B's public key to encrypt, and then transmits the ciphertext to node B. Node B uses the public key of node A to decrypt the ciphertext.
1. Since A’s public key is public, once an online hacker intercepts the message, the ciphertext will be useless. To put it bluntly, this encryption method can be decrypted as long as the message is intercepted.
2. There is also the problem of being unable to determine the source of the message and the problem of message tampering.
As shown in the figure above, before sending data, node A first encrypts it with B's public key to obtain ciphertext 1, and then uses A's private key to encrypt ciphertext 1 to obtain ciphertext 2. After node B obtains the ciphertext, it first uses A’s publicDecrypt it with the key to get the ciphertext 1, and then use B's private key to decrypt it and get the plaintext.
1. When data ciphertext 2 is intercepted on the network, since A's public key is public, you can use A's public key to decrypt ciphertext 2 and obtain ciphertext 1. So this seems to be double encryption, but in fact the private key signature of the last layer is invalid. Generally speaking, we all hope that the signature is signed on the most original data. If the signature is placed later, the signature lacks security since the public key is public.
2. There are performance issues. Asymmetric encryption itself is very inefficient, and two encryption processes are performed.
As shown in the figure above, node A is first encrypted with A's private key, and then encrypted with B's public key. After receiving the message, node B first uses B's private key to decrypt it, and then uses A's public key to decrypt it.
1. When ciphertext data 2 is intercepted by a hacker, since ciphertext 2 can only be decrypted using B’s private key, and B’s private key is only owned by node B, others cannot keep it secret. Therefore, the safety is the highest.
2. When node B decrypts and obtains ciphertext 1, it can only use A’s public key to decrypt it. Only data encrypted by A's private key can be successfully decrypted with A's public key. Only node A has A's private key, so it can be determined that the data was transmitted by node A.
After two asymmetric encryptions, the performance problem is serious.
Based on the above problem of data tampering, we introduced message authentication. The encryption process after message authentication is as follows:
Before node A sends a message, it first performs a hash calculation on the plaintext data. A digest is obtained, and then the illumination and original data are sent to Node B at the same time. When node B receives the message, it decrypts the message. Parse out the hash digest and original data, then perform the same hash calculation on the original data to obtain digest 1, and compare the digest and digest 1. If they are the same, they have not been tampered with; if they are different, they have been tampered with.
As long as ciphertext 2 is tampered with during the transmission process, the resulting hash will be different from hash1.
The signature problem cannot be solved, that is, both parties attack each other. A never acknowledges the message he sent. For example, A sends an error message to B, causing B to suffer losses. But A denied that he did not send it himself.
In the process of (3), there is no way to solve the problem of mutual attacks between the two interacting parties. What does that mean? It may be that the message sent by A is not good for node A, and later A denies that the message was not sent by it.
In order to solve this problem, signatures were introduced. Here we combine the encryption method in (2)-4 with the message signature and design it inTogether.
In the above figure, we use node A's private key to sign the summary information sent by it, then add the signature + original text, and then use B's public key to encrypt. After B obtains the ciphertext, he first uses B's private key to decrypt it, and then uses A's public key to decrypt the digest. Only the content of the two digests is compared to see if they are the same. This not only avoids the problem of anti-tampering, but also circumvents the problem of attacks from both parties. Because A signed the information, it cannot be repudiated.
In order to solve the performance problem when asymmetrically encrypting data, hybrid encryption is often used. Here we need to introduce symmetric encryption, as shown below:
When encrypting data, we use a symmetric secret key shared by both parties to encrypt. The symmetric secret key should not be transmitted on the network to avoid loss. The shared symmetric key here is calculated based on one's own private key and the other party's public key, and then the symmetric key is used to encrypt the data. When the other party receives the data, it also calculates the symmetric secret key and decrypts the ciphertext.
The above symmetric secret key is unsafe because A's private key and B's public key are generally fixed in the short term, so the shared symmetric secret key is also fixed. To enhance security, the best way is to generate a temporary shared symmetric key for each interaction. So how can we generate a random symmetric key during each interaction without transmitting it?
So how to generate a random shared secret key for encryption?
For the sender node A, a temporary asymmetric secret key pair is generated every time it is sent, and then a symmetric secret key can be calculated based on the public key of node B and the temporary asymmetric private key. (KA algorithm-Key Agreement). The symmetric secret key is then used to encrypt the data. The process here for the shared secret key is as follows:
For node B, when receiving the transmitted data, the random public key of node A is parsed. Then the symmetric secret key (KA algorithm) is calculated using the random public key of node A and the private key of node B itself. The data is then encrypted using a symmetric key.
For the above encryption methods, there are still many problems, such as how to avoid replay attacks (adding Nonce to the message), and problems such as rainbow tables (refer to the KDF mechanism to solve). Due to limited time and ability, I will ignore it for now.
So what kind of encryption should be used?
Mainly alsoIt is considered based on the security level of the data to be transmitted. Unimportant data can actually be authenticated and signed, but very important data needs to use an encryption scheme with a relatively high security level.
Cipher suite is a concept of network protocol. It mainly includes algorithms for identity authentication, encryption, message authentication (MAC), and secret key exchange.
During the entire network transmission process, algorithms are mainly divided into the following categories according to cipher suites:
Secret key exchange algorithms: such as ECDHE, RSA. Mainly used for authentication when the client and server handshake.
Message authentication algorithm: such as SHA1, SHA2, SHA3. Mainly used for message summarization.
Batch encryption algorithm: such as AES, mainly used to encrypt information flow.
Pseudo-random number algorithm: For example, the pseudo-random function of TLS 1.2 uses the hash function of the MAC algorithm to create a master key - a 48-byte private key shared by both parties in the connection. The master key serves as a source of entropy when creating session keys (such as creating a MAC).
In the network, a message transmission generally needs to be encrypted in the following four stages to ensure safe and reliable transmission of the message.
Handshake/network negotiation phase:
During the handshake phase between both parties, link negotiation is required. The main encryption algorithms include RSA, DH, ECDH, etc.
Identity authentication phase:
In the identity authentication phase, the source of the sent message needs to be determined. The main encryption methods used include RSA, DSA, ECDSA (ECC encryption, DSA signature), etc.
Message encryption stage:
Message encryption refers to encrypting the sent information flow. The main encryption methods used include DES, RC4, AES, etc.
Message identity authentication phase/anti-tampering phase:
Mainly to ensure that the message has not been tampered with during transmission. The main encryption methods include MD5, SHA1, SHA2, SHA3, etc.
ECC: Elliptic Curves Cryptography, elliptic curve cryptography. It is an algorithm that generates public and private keys based on point multiple products on ellipses. Used to generate public and private keys.
ECDSA: used for digital signatures and is a digital signature algorithm. A valid digital signature gives the recipient reason to believe that the message was created by a known sender, so that the sender cannot deny that the message has been sent (authentication and non-repudiation), and that the message has not been altered in transit. The ECDSA signature algorithm is a combination of ECC and DSA. The entire signature process is similar to DSA., the difference is that the algorithm used in the signature is ECC, and the final signed value is also divided into r, s. Mainly used in the identity authentication phase.
ECDH: It is also a Huffman tree secret key based on the ECC algorithm. Through ECDH, both parties can negotiate a shared secret without sharing any secrets, and this shared secret key is the current The communication is temporarily generated randomly, and the secret key disappears once the communication is interrupted. Mainly used in the handshake negotiation phase.
ECIES: is an integrated encryption scheme, also known as a hybrid encryption scheme, which provides semantic security against selected plaintext and selected ciphertext attacks. ECIES can use different types of functions: key agreement function (KA), key derivation function (KDF), symmetric encryption scheme (ENC), hash function (HASH), H-MAC function (MAC).
ECC is an elliptical encryption algorithm, which mainly describes how the public and private keys are generated on the ellipse, and is irreversible. ECDSA mainly uses the ECC algorithm to make signatures, while ECDH uses the ECC algorithm to generate symmetric keys. All three of the above are applications of the ECC encryption algorithm. In real-world scenarios, we often use hybrid encryption (a combination of symmetric encryption, asymmetric encryption, signature technology, etc.). ECIES is a set of integrated (hybrid) encryption solutions provided by the underlying ECC algorithm. This includes asymmetric encryption, symmetric encryption and signature functions.
<meta charset="utf-8">
This precondition is to ensure that the curve does not contain singular points .
Therefore, as the curve parameters a and b continue to change, the curve also shows different shapes. For example:
All the basic principles of asymmetric encryption are basically based on a formula K = k G. Among them, K represents the public key, k represents the private key, and G represents a selected base point. The asymmetric encryption algorithm is to ensure that the formula cannot be inverted (that is, G/K cannot be calculated). *
How does ECC calculate the public and private keys? Here I describe it according to my own understanding.
I understand that the core idea of ECC isIt is: select a base point G on the curve, then randomly pick a point k on the ECC curve (as the private key), and then calculate our public key K based on k G. And ensure that the public key K is also on the curve. *
So how to calculate k G? How to calculate k G to ensure that the final result is irreversible? This is what the ECC algorithm is supposed to solve.
First, we randomly select an ECC curve, a = -3, b = 7 and get the following curve:
On this curve, I randomly select two points. How to calculate the multiplication of points? We can simplify the problem. Multiplication can be expressed by addition, such as 2 2 = 2+2, 3 5 = 5+5+5. Then as long as we can calculate addition on the curve, we can theoretically calculate multiplication. Therefore, as long as addition calculations can be performed on this curve, multiplication can be calculated theoretically, and the value of expressions such as k*G can also be calculated theoretically.
How to calculate the addition of two points on the curve? Here, in order to ensure irreversibility, ECC has customized an addition system on the curve.
In reality, 1+1=2, 2+2=4, but in the ECC algorithm, the addition system we understand is impossible. Therefore, it is necessary to customize a set of addition systems suitable for this curve.
The definition of ECC is to randomly find a straight line in the graph and intersect the ECC curve at three points (or possibly two points). These three points are P, Q, and R respectively.
Then P+Q+R = 0. Among them, 0 is not the 0 point on the coordinate axis, but the infinity point in ECC. In other words, the infinity point is defined as point 0.
Similarly, we can get P+Q = -R. Since R and -R are symmetrical about the X-axis, we can find their coordinates on the curve.
P+R+Q = 0, so P+R = -Q, as shown in the figure above.
The above describes how addition operations are performed in the world of ECC curves.
As can be seen from the above figure, there are only two intersection points between a straight line and a curve, which means that the straight line is the tangent line of the curve. At this time, P and R coincide.
That is, P = R. According to the above-mentioned ECC addition system, P+R+Q = 0, it can be concluded that P+R+Q = 2P+Q = 2R+Q=0
So we get 2 P = -Q (is it consistent with ourThe formula for asymmetric algorithms K = k G is getting closer).
So we come to the conclusion that multiplication can be calculated, but it can only be calculated at the tangent point, and it can only be calculated by 2.
If 2 can be turned into any number for multiplication, then it means that multiplication can be performed in the ECC curve, then the ECC algorithm can meet the requirements of an asymmetric encryption algorithm.
So can we calculate the multiplication of any random number? The answer is yes. That is the dot product calculation method.
Choose a random number k, then what is k * P equal to?
We know that in the computer world, everything is binary. Since ECC can calculate the multiplication of 2, we can describe the random number k as binary and then calculate it. Suppose k = 151 = 10010111
Since 2 P = -Q, so k P is calculated. This is the dot product algorithm. Therefore, multiplication can be calculated under the ECC curve system, so this asymmetric encryption method is feasible.
As for why this calculation is irreversible. This requires a lot of deduction, and I don't understand it either. But I think it can be understood this way:
Our watches usually have time scales. Now if we take 0:00:00 on January 1, 1990 as the starting point, and if we tell you that a full year has passed until the starting point, then we can calculate the current time, that is, we can calculate it on the watch. The hour, minute and second hands should point to 00:00:00. But conversely, I said that the hour, minute and second hands on the watch are now pointing to 00:00:00. Can you tell me how many years have passed since the starting point?
The ECDSA signature algorithm is basically similar to other DSA and RSA, both using private key signature and public key verification. It’s just that the algorithm system uses the ECC algorithm. Both parties interacting must adopt the same set of parameter systems. The signature principle is as follows:
Select an infinite point on the curve as the base point G = (x, y). Randomly pick a point k on the curve as the private key, and K = k*G to calculate the public key.
Signature process:
Generate a random number R and calculate RG.
According to the random number R, the HASH value H of the message M, and the private key k, Calculate the signature S = (H+kx)/R.
Send the message M, RG, S to the receiver.
Signature verification process:
Receive message M, RG, S
Calculate HASH value H based on the message
Calculate HG based on the sender's public key K /S + xK/S, compare the calculated result with RG. If equal, the verification is successful.
Formula inference:
HG/S + xK/S = HG/S + x(kG)/S = (H+xk)/GS = RG
< p> Before introducing the principle, explain that ECC satisfies the associative law and the commutative law, that is to say, A+B+C = A+C+B = (A+C)+B.Here is an example on WIKI to illustrate how to generate a shared secret key. You can also refer to the example of Alice And Bob.
For Alice and Bob to communicate, both parties must have public and private keys generated by ECC based on the same parameter system. So there is a common base point G for ECC.
Secret key generation stage:
Alice uses the public key algorithm KA = ka * G, generates the public key KA and the private key ka, and makes the public key KA public.
Bob uses the public key algorithm KB = kb * G, generates the public key KB and the private key kb, and makes the public key KB public.
Calculation ECDH stage:
Alice uses the calculation formula Q = ka * KB to calculate a secret key Q.
Bob uses the calculation formula Q' = kb * KA to calculate a secret key Q'.
Shared key verification:
Q = ka KB = ka * kb * G = ka * G * kb = KA * kb = kb * KA = Q'
Therefore, the shared secret keys calculated by both parties do not need to be disclosed before they can be encrypted using Q. We call Q the shared secret key.
In Ethereum, other contents of the ECIEC encryption suite used:
1. The HASH algorithm uses the most secure SHA3 algorithm Keccak.
2. The signature algorithm uses ECDSA
3. The authentication method uses H-MAC
4. The ECC parameter system uses secp256k1, others Please refer to the parameter system here
The whole process of H-MAC is called Hash-based Mmessage Authentication Code. Its model is as follows:
In Ethereum's UDP communication (RPC communication encryption methods are different), the above implementation method is adopted and expanded.
First of all, the structure of Ethereum's UDP communication is as follows:
Among them, sig is the signature information encrypted by the private key. mac can be understood as a summary of the entire message, ptype is the event type of the message, and data is the RLP-encoded transmission data.
The entire encryption, authentication, and signature model of UDP is as follows:
⑻ What is blockchain technology? What is the core composition of blockchain technology
From a technical perspective and an architectural perspective, I would like to share with you some of my understanding of blockchain in layman’s terms.
What exactly is blockchain? Block chain, in a word, blockchain is a storage system, and the storage system is more detailed. Block chain is a distributed storage system without an administrator, and each node owns all data.
What do common storage systems look like?
First, let’s take a look at how to ensure high availability?
Ordinary storage systems usually use "redundancy" to solve high availability problems. As shown in the figure above, if the data can be copied into several copies and redundantly spread to multiple places, high availability can be ensured. If the data in one place is down, there will still be data in another place. For example, the master-slave cluster of MySQL has this principle, and the RAID of the disk also has this principle.
Two points that need to be emphasized here are: data redundancy often causes consistency problems
1. For example, in the master-slave cluster of MySQL, there will actually be a delay in reading and writing. Sometimes, it actually means that there is inconsistency between reading and writing for a short period of time. This is a side effect of data redundancy.
2. The second point is that data redundancy often reduces writing efficiency, because data synchronization also consumes resources. If you look at single-point writing, if two slave libraries are added, the writing efficiency will actually be affected. Ordinary storage systems use redundancy to ensure high data availability.
Then the second question is, can an ordinary storage system perform multiple writes?
The answer is yes, for example, take this picture as an example:
In fact, MySQL can do a master-slave synchronization of dual masters, a master-slave synchronization of dual masters, and two nodes. , and can be written at the same time. If you want to build a multi-machine room and multi-active data center, in fact, multi-machine room and multi-active data center also requires data synchronization. What I want to emphasize here is to write moreInputs often cause consistency issues of write-write conflicts. Taking MySQl as an example, assuming that the attribute of a table is an auto-increment ID, then the data in the database is now 1234, then one of the nodes writes and inserts a piece of data. Then it may become 5, and then these 5 pieces of data are synchronized to another master node. Before the synchronization is completed, if another writing node also inserts a piece of data, a piece of data with an auto-incrementing ID of 5 is also generated. The data. Then, after it is generated, it is synchronized to another node, and then when the synchronized data arrives, it will conflict with the two local 5s, and the synchronization will fail, which will cause write consistency conflicts. This problem will occur if there are multiple writes.
How to ensure consistency when writing multiple points?
Weixin's "Swan Master Class" gives you more technical work
- 上一篇: 糖果区块链手机,糖果区块链挖矿手机
- 下一篇: 区块链与维基的关系,维基百科对区块链的定义