Crypto News

How to register a transaction in the blockchain

Maybe you, as a sender or receiver of digital currency, may be with steps Transaction registration in the blockchain Don’t be familiar and make this process easy on your wallet. But you should know that doing this process is not as simple as you see, and behind the scenes, many miners are working to add their block to the blockchain. They must first put your transaction in their block and then add that block to the blockchain.

Maybe it’s better, before getting familiar with this process, the article What is Blockchain? Read it and get familiar with its structure.

Procedures for registering a transaction in the blockchain

Have you ever wondered how a transaction is confirmed and added to the blockchain? How is the mining process done in the blockchain? This process is somewhat complicated and for better understanding, we have divided it into seven simple steps so that you can get to know this process step by step. These steps are a tutorial on how to record a transaction in the blockchain.

First step: register the transaction

In the first step of registering the transaction in the blockchain, you have to Digital currency wallet Go and send tokens yourself. For this, it is enough to select the desired token and specify its number. Then, enter the link of the destination wallet or its QR code and finally, click Send to complete the transaction.

Second step: waiting for processing

This step is related to waiting for the processing or confirmation of the registered transaction. After sending the desired token through the digital currency wallet, your transaction remains in the waiting mode on the network until a miner confirms it. Until this transaction is processed by a miner, in small local pools named Pool of unconfirmed transactions are kept Not all unconfirmed transactions are kept in one big pool. There are several small local pools into which unconfirmed transactions are collected with a certain division.

The third step: block construction by miners

In the third stage of registering the transaction in the blockchain, after a short period of time, one of the miners in the network selects your transaction and adds it to his block. In some situations, miners to the nineties (Nodes) are also known. Each miner has a separate block for itself, and these blocks are a collection of unconfirmed transactions and some metadata. Of course, these unconfirmed transactions that are added to a miner’s block will be verified and processed in the future. The point is that miners can add similar transactions to their block and there is no limit.

Added transaction to block miners

Let us make this step understandable for you with a simple example. Imagine that a transaction called X enters the network and two miners A and B want to add it to their block. Both of them can add this transaction to their block, but they must be careful about the block size and blockchain history of that token. For example, Bitcoin blockchain (BTC) has a maximum capacity of one megabyte for each block. So, before choosing that transaction by every miner, they should pay attention to the transaction volume and blockchain capacity of that token.

The blockchain history is related to the balance of the sender’s wallet, if there are enough funds in the wallet, the transaction is recognized as valid and finally, it is placed in the desired block. If you want your transaction to be processed faster, you can pay more Mining reward Pay for miners to prioritize your transaction. Transactions that are prioritized are quickly selected by miners and their blocks are added.

Fourth step: Solving the problem of each block

When transactions are added by miners to their blocks, eventually, they have a block with a set of transactions. After completing a block, they must add it to the blockchain and actually complete the process of recording the transaction in the blockchain. After adding blocks to the desired blockchain, the nodes of each blockchain can register block transactions. The important point at this stage is how to add a block to the blockchain. To do this, miners need a signature or, in fact, solve a complex mathematical problem.

Solving hash problems by miners

The math problem for each block is different and each of them has the same difficulty. Now, miners must focus on solving this mathematical problem, which involves high computing power and a large amount of electricity. You can run it in the calculator to get a general familiarity with this problem and finally increase its difficulty level. Because this problem must be solved in very powerful computer systems and requires high computing power. In fact, this is a small acquaintance with The process of mining digital currency Is. In the following, we will discuss the exact functioning of this mathematical problem and its role in recording transactions in the blockchain.

How to extract hashing (Hashing) based on the Proof of Work (POW) consensus algorithm

This mathematical problem that every miner faces when adding his block to the blockchain or recording a transaction in the blockchain is actually finding an output. Hash (Hash) is. These hashes correspond to the data in each block miner, which includes a specific value of zero. Let us explain hashing to you in a simpler way.

The hash function is a mathematical problem that must be solved by a skilled person familiar with mathematical calculations. However, after finding the answer of this hash function, your answer is simply confirmed and you enter the next step of registering the transaction in the blockchain.

In fact, a hash function is an input string that includes numbers and letters. This input string is concatenated with new 32-digit strings of the same letters and numbers from which you must find the output 32-digit string. If any number or letter in this input string changes, so does the output hash. Otherwise, the hash input has a specific hash output.

Performance of nodes in blockchain transaction registration

Now consider this hash input as a block that also has a hash output and the miner must solve it. One of the rules of the Bitcoin blockchain is related to the hash output, according to which the obtained hash output must be a certain value of zero. Otherwise, the resulting hash or signature is not correct to record the transaction in the blockchain. Now, what do you think if Hash output obtained does not start with a certain number of zeros, what should the miner do?

In this situation, miners usually share a part of their own block data called Nonce They change it frequently. By changing this part of the block, almost the composition of the data changes, and by changing the composition of the data, its signature or the hash output also changes. Therefore, every time miners change the Nonce part of the block, the block generates a new signature or random output. As a result, the miner’s answer to the new hash problem also changes and becomes closer to the correct answer. Miners repeat this process indefinitely on their block to reach the correct result and record the transaction in the blockchain.

Important points about hashing

The number of zeros in a correct hash output depends on the difficulty of a blockchain. For example, the Bitcoin blockchain has high security, which is why the difficulty of its hash output is also higher. The higher the difficulty of the hash, the more difficult the steps to solve it. Hence, many miners leave complex problems with a high degree of difficulty for last.

Miners need very high computing power to solve these math problems. For example, some created Nonces may be very difficult and require high computing power and time. Also, the higher the hash power of a blockchain, the more difficult the mathematical problem is, and the more electricity is consumed to solve that problem. Finally, after that, the transaction is recorded in the blockchain.

Step 5: Find the correct answer to the problem

Whenever a miner finds the correct answer to the math problem, or indeed, the correct signature for his block, he can distribute it to all other miners along with the block. So, which miner finds the correct signature first is important in recording the transaction in the blockchain.

The sixth stage: Consensus of proof of work

At this stage, the desired signature has reached all the miners and they must confirm the legitimacy of that signature. To do this, they hash the signature and examine the output. Because it must have the right number of zeros for the blockchain. If the signature is correct in this respect, all miners will confirm it so that the block is added to the blockchain. In fact, they reach a consensus to add a block or record a transaction to the blockchain. Hence, to this algorithm, Proof of work consensus algorithm (POW) is called.

After this process, the desired block is added to the blockchain and that block is distributed among all nodes. Nodes store this block in their transaction data.

Consensus proof of work by miners

Seventh step: confirmation of the block stored in the blockchain

After a block is placed in the blockchain, other blocks may be added to it. Hence, any other block that is added to the blockchain after the desired block is considered a confirmation stamp for that block.

For example, if your transaction is in block 207 and in general, the blockchain has 250 blocks; That means you have 43 confirmations for your transaction. These confirmations indicate the security of your transaction as much as possible, and also, it means that your transaction has been checked 43 times and confirmed 43 times by the blockchain. Because every time a transaction is recorded in the blockchain, the blocks before it are also checked. As a result, we must say that the more confirmations your transaction has, the lower the percentage of attackers attacking that transaction.

After registering the transaction in the blockchain, miners must return to the third stage and create a new block for themselves. This process is ongoing and a blockchain can have capacity for new blocks until infinity.

Why should miners create a new block for themselves?

For two reasons, miners cannot work on a block they have already worked on and must create a new block for themselves. The first reason for this is that that block probably has transactions that are in several other blocks. As we said, a transaction can be placed in different blocks of miners. So a miner can work on solving his own block problem only once. If it is unsuccessful, he has to wait for other miners to solve it and he has to start building a new block himself.

The second reason is related to transferring the hash output of the last block added to the blockchain to the metadata. That is, when a miner finds the correct hash output and sends it to other miners; After all miners confirm, that hash output is added to the metadata. Hence, if a miner works on mining a previous block, other miners will know about it. As a result, that block is rejected. Because, the mismatch of the hash output with the last block in the blockchain, from Metadata Characterized.

The article on how to register a transaction in the blockchain was written for the first time on the Wallex blog. appeared.

Amirim

hello my name is amir; i love bitcoin and dogecoin 🎯

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button