区块链随机散列函数是什么,区块链随机散列函数怎么求
区块链随机散列函数是一种在区块链系统中用来实现安全认证的散列算法。它能够将任意长度的输入,通过一个固定长度的输出,可以有效地防止被第三方篡改。本文将介绍区块链随机散列函数的基本概念,以及拓展出3个相关关键词:数字签名、加密算法、椭圆曲线算法。
数字签名是一种用于确认数据完整性和身份验证的技术。它通过使用散列函数,将消息的原文转换成一个固定长度的数字摘要,然后通过私钥加密,将摘要转换成数字签名,以确保消息的完整性和发送者的身份。由于数字签名是由私钥加密的,只有私钥的持有者才能够生成和验证数字签名。数字签名在区块链系统中起着重要的作用,能够有效地防止数据被篡改。
加密算法是一种用于保护数据安全的算法,它能够将明文转换成密文,以保护数据不被未经授权的第三方访问。加密算法可以分为对称加密算法和非对称加密算法。对称加密算法是一种只需要使用一个密钥就可以进行加密和解密的算法,而非对称加密算法则需要使用两个密钥,一个用来加密,一个用来解密。在区块链系统中,加密算法起到了重要的作用,能够有效地保护数据安全。
椭圆曲线算法是一种基于椭圆曲线的密钥交换算法,用于实现两个实体之间的安全通信。它通过使用一组椭圆曲线上的点,来生成一对密钥,一个用来加密,一个用来解密。椭圆曲线算法在区块链系统中起到了重要的作用,能够有效地保护数据安全,防止数据被第三方篡改。
以上就是有关区块链随机散列函数以及拓展出的3个相关关键词:数字签名、加密算法、椭圆曲线算法的介绍,希望能够帮助大家更好地理解区块链系统中的安全认证技术。
请查看相关英文文档
Ⅰ [In-depth knowledge] Illustration of the encryption principle of the blockchain (encryption, signature)
First, let’s put an architecture diagram of Ethereum:
In the learning process, we mainly use 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 decrypts it using A's public key to obtain ciphertext 1, and then decrypts it using B's private key to obtain 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 firstEncrypt with A's private key, then encrypt 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.
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 sides. 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 you need to introduce symmetric encryption, as shown below:
When encrypting data, we use a symmetric secret key shared by both parties. 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 key is unsafe because A's private key and B's public key are generally fixed in the short term, so the shared symmetric 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 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 and 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), keyDerivation 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 is to 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 based on k G K. 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 is bothIt 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 theoretically be calculated, and the value of an expression such as k*G can theoretically be calculated.
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 getting closer to the formula K = k G of our asymmetric algorithm?).
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, allThey are all 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 the HASH value H according to the message
According to the sender For the public key K, calculate HG/S + xK/S, and 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 a WIThe examples on KI 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 The parameter system can be found here
The whole process of H-MAC is called Hash-based Message Authentication Code. Its model is as follows:
In Ethereum's UDP communication (RPC communication encryption methods are different), then The above implementation method is adopted and extended.
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 isIt is the transmitted data after RLP encoding.
The entire encryption, authentication, and signature model of UDP are as follows:
II Do you know the three important stages in the history of blockchain development?
Follow As blockchain technology becomes increasingly mature, blockchain technology has achieved significant results in the financial field. Whether they are investors, practitioners in related financial fields, or technology practitioners, they are all very concerned about blockchain. Many people or platforms have begun to devote themselves wholeheartedly to it, using blockchain technology to create a new financial system, and have achieved impressive results.
If you have studied blockchain, maybe you have a deeper understanding of blockchain. Since the birth of blockchain, in terms of applications, It has gone through three stages of change. There have been important developments and inventions at every stage of blockchain technology, and blockchain technology has only existed for a small portion of the Internet's time, so there are likely still important developments to come.
The first technical stage
Bitcoin has been running since 2019. The main technology supporting the Bitcoin system includes hashing Technologies such as functions, distributed ledgers, blockchain, asymmetric encryption, and workload proof constitute the initial version of the blockchain.
At present, blockchain technology is not yet mature, the conservative tendency within many organizations is still obvious, and the use of centralized technology and processes in the market to make profits Intermediaries that collect revenue, equipment providers are also hyping up the concerns it may bring.
Second market phase
In early 2013, the price of Bitcoin began rise. In November of the same year, a U.S. Senate hearing clarified the legality of Bitcoin, and the price of Bitcoin rose sharply. But at this time, the blockchain has not yet reached the mainstream social and economic foundation, but its price has risen beyond expectations. At this time, the market opened up the visibility of Bitcoin and blockchain, but despite this, they still did not gain universal acceptance to a certain extent.
The third mainstream stage
Bitcoin, which is an alternative to the mainstream economy, began to recover. Market demand increased and transaction scale expanded rapidly. It also opened up the bull market of 2016-2017. . The enrichment effect of Bitcoin and the spillover effect caused by the congestion of the Bitcoin network have led to the explosive and crazy growth of other virtual currencies and various blockchain applications. At this time, it triggered a crazy global pursuit to make Bitcoin and blockchain a complete global vision.
In 202In 2000, although the epidemic dealt an important blow to our economy, the fervent development of Bitcoin and blockchain tells us that they are creating opportunities and driving related development. Just like the recent price of Bitcoin is close to 30,000 US dollars, such a market has brought surprises to many people, and it has also promoted the development of exchanges. After all, exchanges are the only way to buy Bitcoins. Its popularity is also It has brought good profits to exchanges, such as Huobi and Saturn Exchange, which have refreshed their historical trading volumes many times due to this bull market. In fact, no matter which industry develops, it will always drive multiple industries. After all, many things are always closely related.
Ⅲ What are the core technologies of blockchain system development-blockchain transaction system development-
Blockchain technology is an emerging technology today, but it is not This is too appropriate, because this technology was born with the emergence of Bitcoin ten years ago, but it is no problem to say that it is a very hot technology now. After 10 years of continuous updates, blockchain technology has finally seen relevant applications in the past two years, and has entered the blockchain 3.0 era. In the next 3-5 years, I believe there will be more fields that require blockchain Chain system to support. Below, the editor of blockchain system development loopodo will take you to take a look at several core technologies for blockchain system development.
1. Hash algorithm
Hash algorithm is the most commonly used algorithm in the development of blockchain systems. Hash function is also called hash function or hash function. The hash function can convert data of any length into a set of fixed-length codes through the Hash algorithm. The principle is based on a cryptographic one-way hash function. This function is easy to verify, but difficult to crack. Usually, the industry uses y =h (x) to represent it. This hash function implements operations on x to calculate a hash value y.
2. Asymmetric encryption algorithm
Asymmetric encryption algorithm is a secret key method. Asymmetric encryption algorithm requires two keys: public key and private key. . The public key and the private key are a pair. If the public key is used to encrypt data, it can only be decrypted with the corresponding private key. Because encryption and decryption use two different keys, this algorithm is called an asymmetric encryption algorithm
3. Consensus Mechanism
The so-called "consensus mechanism" is through the voting of special nodes. The verification and confirmation of the transaction can be completed in a very short time; for a transaction, if several nodes with unrelated interests can reach a consensus, we can think that the entire network can also reach a consensus on it.
Today’s blockchain consensus mechanisms can be divided into four major categories: Proof of Work (PoW), Proof of Stake (PoS), Delegated Proof of Shares (DPoS) and Pool verification pool.
4. Smart contracts
Smart contracts are traditional contractsDigital online version of the covenant. They are computer programs that run on the blockchain and can execute themselves when conditions written in the source code are met. Once a smart contract is written, it can be trusted by users and the terms of the contract will not be changed. Therefore, the contract is immutable and cannot be modified by anyone.
Developers write code for smart contracts, which are used for transactions and any exchange between two or more parties. The code will contain some conditions that trigger automatic execution of the contract. Once written, the smart contract is automatically uploaded to the network. Once the data is uploaded to all devices, users can come to agreement with the results of executing the program code.
5. Distributed Storage
Distributed storage uses the disk space on each machine in the enterprise through the network, and combines these dispersed storage resources into a virtual storage device, and the data is distributed in Every corner of the enterprise. Massive data is divided according to the degree of structure, and can be roughly divided into structured data, unstructured data, and semi-structured data.
Lupda Network Technology focuses on blockchain system development, Ethereum development, blockchain transaction system development, virtual currency platform development, currency transaction system development, and digital currency wallet system development
Ⅳ What is the proof of work in blockchain mining?
The spelling of POW is Proof of Work. To put it simply, it is a work model that requires a lot of hard work to get relatively good pay.
When miners mine a new block, they must operate on the SHA-256 cryptographic hash function. The random hash value in the block starts with one or more 0s. As the number of zeros increases, the amount of work required to find this solution will increase exponentially, and miners find this solution through repeated attempts.
The first miner to calculate the correct answer can obtain the accounting rights of the current block and receive rewards for newly issued Bitcoins. Theoretically speaking, the greater the computing power (strength), the faster the calculation (moving), and the higher the profit value. You should be able to understand this, POW means distribution according to work, the more work, the more reward. At present, Bitcoin, the big brother in the currency world, and Ethereum, the second brother now, all have this model.
IV Blockchain Technology
Background: After the birth of Bitcoin, it was discovered that the technology was very advanced, and blockchain technology was discovered. Bitcoin and blockchain technology were discovered at the same time.
1.1 The purpose of the birth of Bitcoin:
①Currency transactions have records, that is, ledgers;
②The disadvantages of centralized institution accounting - it can be tampered with; Yi Chaofa
Bitcoin solves the first problem: anti-tampering - hash function
1.2 hash function (encryption method)
① Function: convert any A string of length, converted to a fixed-length (sha256) output. The output is alsoCalled hash value.
② Features: It is difficult to find two different x and y such that h(x)=h(y).
③Application: md5 file encryption
1.3 Blockchain
①Definition
Block: Split the general ledger into zones Block storage
Blockchain: On each block, add a block header. It records the hash value of the parent block. By storing the hash value of the parent block in each block, all blocks are connected in order to form a blockchain.
②How does the blockchain prevent transaction records from being tampered with?
After the blockchain is formed, tampering with any transaction will cause the hash value of the transaction block to be different from that of its sub-blocks. , tampering was discovered.
Even if you continue to tamper with the hash value in the sub-block header, the hash value in the sub-block will be different from that in the grandchild block, and the tampering will be discovered.
1.4 The essence of blockchain
①The essence of Bitcoin and blockchain: a big ledger visible to everyone, only recording transactions .
②Core technology: Through cryptographic hash function + data structure, it ensures that the ledger records cannot be tampered with.
③Core function: Create trust. Fiat currency relies on government credibility, and Bitcoin relies on technology.
1.5 How to trade
①To conduct transactions, you need an account number and password, corresponding to the public key and private key
Private key: a string of 256-bit binary numbers , you don’t need to apply for it, you don’t even need a computer, you can generate the private key by tossing a coin 256 times
The address is converted from the private key. The address cannot reverse the private key.
The address is the identity, which represents the ID in the Bitcoin world.
After an address is generated, it can only be known by everyone if it enters the blockchain ledger.
②Digital signature technology
Signature function sign (Zhang San’s private key, transfer information: Zhang San transfers 10 yuan to Li Si) = signature of this transfer
< p> Verify Korean verify (Zhang San’s address, transfer information: Zhang San transfers 10 yuan to Li Si, signature of this transfer) = TrueZhang San uses his own signature function sign() The private key signs this transaction.
Anyone can verify whether the signature was issued by Zhang San himself who holds Zhang San's private key by verifying the Korean vertify(). It returns true, otherwise it returns false.
sign() and verify() is cryptographically guaranteed not to be cracked. ·
③Complete the transaction
Zhang San will provide the transfer information and signature to the entire network. Under the premise that the account has a balance, after verifying that the signature is true, it will be recorded in the blockchain ledger. Once recorded, Zhang San's account will be reduced by 10 yuan, and Li Si's account will be increased by 10 yuan.
Supports one-to-one, one-to-many, many-to-one, and many-to-many transactions.
In the Bitcoin world, private keys are everything! ! !
1.6 Centralized Accounting
① Advantages of Centralized Accounting:
a. No matter which center keeps accounts, don’t worry too much
< p> b. Centralized accounting, high efficiency②Disadvantages of centralized accounting:
a Denial of service attack
b Stop service after getting tired
p>c Central institutions are vulnerable to attacks. For example, destroying servers and networks, committing self-intrusion, legal termination, government intervention, etc.
All attempts at confidential currencies with centralized institutions in history have failed.
Bitcoin solves the second problem: how to decentralize
1.7 Decentralized accounting
①Decentralization: Everyone can keep accounts. Everyone can keep a complete ledger.
Anyone can download open source programs, participate in the P2P network, monitor transactions sent around the world, become an accounting node, and participate in accounting.
② Decentralized accounting process
After someone initiates a transaction, it is broadcast to the entire network.
Each accounting node continues to monitor and continue transactions across the entire network. When a new transaction is received and the accuracy is verified, it is put into the transaction pool and continues to be propagated to other nodes.
Due to network propagation, the transactions of different accounting nodes at the same time are not necessarily the same.
Every 10 minutes, one person is selected from all accounting nodes in a certain way, and his transaction pool is used as the next block and broadcast to the entire network.
Other nodes delete the transactions that have been recorded in their own transaction pool based on the transactions in the latest block, continue accounting, and wait for the next selection.
③ Features of decentralized accounting
A block is generated every 10 minutes, but not all transactions within these 10 minutes can be recorded.
The accounting node that obtains the accounting rights will be rewarded with 50 Bitcoins. Every 210,000After a block (approximately 4 years), the reward is halved. The total amount is about 21 million, and it is expected to be mined in 2040.
Recording the reward of a block is also the only way to issue Bitcoin.
④ How to allocate accounting rights: POW (proof of work) method
Compete for accounting rights by calculating mathematical problems on several accounting points.
Find a random number that makes the following inequality true:
There is no other solution except traversing the random numbers starting from 0 and trying your luck. The process of solving the problem is also called mining.
Whoever solves the problem correctly first will get the accounting rights.
If a certain accounting node finds the solution first, it will announce it to the entire network. After other nodes verify that it is correct, a new round of calculation will start again after the new block. This method is called POW.
⑤ Difficulty adjustment
The generation time of each block is not exactly 10 minutes
As Bitcoin develops, the computing power of the entire network does not increase.
In order to cope with changes in computing power, the difficulty will be increased or decreased every 2016 blocks (about 2 weeks), so that the average time for each block to be generated is 10 minutes.
#欧易OKEx# #BTC[超话]# #digital currency#
VI How is Ethereum mined?
The proxy of Ethereum Coins are generated through the mining process, with a mining rate of 5 Ethereum per block. The mining process for Ethereum is almost the same as for Bitcoin, for each transaction, miners use computers to run the block's unique header metadata through a hash function, guessing the answer repeatedly and quickly until one of them wins.
Many new users believe that the only purpose of mining is to generate ether in a way that does not require a central issuer (see our guide "What is Ether?"). This is real. Ethereum tokens are generated through the mining process, with a mining rate of 5 Ethereum per block. But mining has a role that is at least as important. Typically, banks are responsible for keeping accurate records of transactions. They ensure that funds are not created out of thin air and that users do not cheat and spend their money multiple times. However, blockchain introduces a completely new way of record-keeping, where the entire network, rather than intermediaries, verifies transactions and adds them to a public ledger.
Ethereum Mining
Although a “trustless” or “trust-minimized” currency system is the goal, there are still people who need to keep financial records secure and ensure no one cheats. Mining is one of the innovations that makes decentralized records possible. Miners reach consensus on transaction history in terms of preventing fraud (especially double spending on ether) – an interesting issue in a world where decentralized currencies are not workingSolved before blockchain. While Ethereum is working on other methods to reach consensus on the validity of transactions, mining currently holds the platform together.
How Mining Works
Today, the mining process for Ethereum is almost the same as for Bitcoin. For each transaction, miners can use computers to guess the answer repeatedly and quickly until one of them wins. More specifically, the miner will run the block's unique header metadata (including timestamp and software version) through a hash function (which will return a fixed-length, scrambled string of numbers and letters that will appear random) , only changes the 'nonce value', which affects the resulting hash value.
If a miner finds a hash that matches the current target, the miner is awarded ether and broadcasts the block throughout the network for each node to verify and add to their own copy of the ledger. If Miner B finds the hash, Miner A will stop working on the current block and repeat the process for the next block. It is difficult for miners to cheat in this game. There is no way to fake this work and come up with the correct answers to the puzzles. That's why the puzzle-solving method is called "proof of work."
On the other hand, there is little time for others to verify that the hash value is correct, which is exactly what each node does. Approximately every 12-15 seconds, a miner discovers a stone. If the miner starts solving the puzzle faster or slower than that, the algorithm automatically rescales the difficulty of the problem so that the miner bounces back to a solution time of about 12 seconds.
Miners earn this ether randomly, and their profitability depends on luck and the amount of computing power they invest. The specific proof-of-work algorithm used by Ethereum is called ‘ethash’ and is designed to require more memory, making it difficult to mine using expensive ASICs – special mining chips that are now the only profitable way to mine Bitcoin.
In a sense, ethash may have succeeded in achieving this, since dedicated ASICs are not available for Ethereum (at least not yet). Additionally, since Ethereum aims to move from proof-of-work mining to “proof-of-stake” (which we’ll discuss below), buying an ASIC may not be a wise choice as it may not prove useful long term.
Moving to Proof-of-Stake
Ethereum may never need miners, though. Developers plan to abandon proof-of-work, the algorithm currently used by the network to determine which transactions are valid and protect them from tampering, in favor of proof-of-stake, where the network is secured by token owners. If and when the algorithm is launched, proof-of-stake could be a means to achieve distributed consensus that uses fewer resources.
VII What are the blockchain technologies?
The concept of blockchain can be said to be very popular. At the Internet Finance Summit, no one said that blockchain technology is out.What is blockchain technology?
Blockchain technology can be either a public classification (anyone can see it) or a permissioned network (only permissioned people can see it), solving supply chain challenges. Because it is An immutable record, so it is shared among network participants and updated in real time.
Blockchain technology - data layer: Designing the data structure of the account book
Core technology 1. Block_ _;Chain:
Technically, a block is a data structure that records transactions, reflecting the capital flow of the transaction. The transaction blocks that have been reached in the system are connected to form the main chain, and all nodes participating in the calculation are It records the main chain or a part of the main chain.
Each block is composed of a block header and a block body. The block body is only responsible for recording all transaction information in the previous period, mainly including transaction quantity and transaction details. The block header includes The current version number, the previous block address, the timestamp (recording the time when the block was generated, accurate to the second), the random number (recording the answer value to the mathematical question related to decrypting the block), the target hash value of the current block, and the Merkle number Information such as the root value of the source mill. From a structural point of view, most functions of the blockchain are implemented by the block header.
Core technology 2. Hash function:
.
The hash function can convert data of any length from the Hash algorithm to a fixed-length code. The principle is a one-way hash function based on cryptography. This function is easy to verify, but difficult to interpret. The industry usually uses y =hash(x) means that this hash function realizes the hash value y of computing x.
Commonly used hash algorithms include MD5, SHA-1, SHA-256, SHA-384, SHA-512, etc. Taking the SHA256 algorithm as an example, input any data into SHA256 and you will get a 256-bit Hash value (hash value). Its characteristics: the same data input will get the same result. The input data changes a little (for example, 1 becomes 0) will get completely different results. The result is that the forward calculation (the Hash value corresponding to the data calculation) is very simple. The reverse calculation is extremely difficult and is considered impossible under the current scientific and technological conditions.
Core technology 3. Merkle tree:
Merkle tree is a hash binary tree that can quickly verify the integrity of large-scale data. In the blockchain network, Merkle_黄髂jumimiofuzhenglu The weapon is the gray boy's side_the Zhang is inciting the firewood boy's bank⒌The resistance is still V's burden and the oar is fishy Wei is the gray boy's bank⒌The plan is to seek out the Ji's plan_erkle Trees.
Core technology 4. Asymmetric encryption algorithm:
Asymmetric encryption algorithm is a key confidentiality method that requires a key and a key. The public key and the private key are a pair. If you use the public key to encrypt data, you can only use the corresponding private key. Decrypt to obtain the corresponding data value. If you use a private key to sign data, you can only use the corresponding public key to verify the signature. The sender of the verification information is the owner of the private key.
Since encryption and decryption use two different keys, theThe algorithm is called an asymmetric encryption algorithm, while symmetric encryption uses the same key in the encryption and decryption processes.
Blockchain mitigation technology - network layer: achieving centralization of charging nodes
< p>Core technology 5, P2P network:P2P network (peer-to-peer network), also known as point-to-point technology, is an Internet system without a central server and user groups exchanging information. It is different from a central network system with a central server Different, each client of the peer-to-peer network is a node and also has the function of a server. Domestic Xunlei software uses P2P technology. The P2P network has the characteristics of centralization and reinforcement.
Blockchain technology-consensus layer: Allocating the task load of charging nodes
VIII What is the random hash used in the blockchain also called?
The random hash used in the blockchain is also called the hash algorithm . According to the relevant query information, random hashing is performed between each block. (also called hash algorithm) realizes linking. The latter block contains the hash value of the previous block. With the expansion of information exchange, one block is continued one after another, and the result is called a blockchain.