The scammers firmly grasp the victim's psychological activities, pretending to be the identity of the public prosecution law to break through the victim's psychological defense line, and then arbitrarily arbitrarily arbitrarily let the victims hand over their own money. When the victims react, the scammers have already escaped. .
As a coping strategy, major banks have given the transfer the next day to the account, the solution that can be withdrawn during the period, giving users room for remorse. This kind of operation is not difficult for a centralized bank, but can it be done in a decentralized blockchain?
At first glance, reversing the transaction on the blockchain is like a fantasy, but the result is ok ! As Mr. Lu Xun said: There is no road in the world, and there are more people to go, and it will become a road.
- Babbitt column | Bitcoin's cultural type and its historical location
- Preparing for the main online line: a quick overview of Libra node operation guide
- Interview with famous economist W. Brian Arthur: historic changes are taking place, blockchain will enter everyday life
- Open Web3.0: Unbind Centralized Vector
- $8.5 million! US Securities and Exchange Commission fines fraud
- "I must come back to save this company!" Wu Jihan "forced the palace" to regain the position of the mainland
It is the fact that many users have the need to revoke transactions on the blockchain , so there is a general retraction scheme slowly, but this convenience for the user has brought endless trouble to DApp and DApp developers. .
Did the DApp you developed show users incorrect information? Don't rush to deny it, because it is likely to happen, and it is under the premise that you are completely unaware of it.
Since the beginning of the year, there have been technical teams conducting more than 30 transaction usability audits of mainstream DApps, each of which involved more than 50 customized quantitative indicators and qualitative assessments. Unexpectedly, however, we have not yet encountered which DApp can handle the scenario where the transaction was cancelled. Trading is the top priority of every DApp, but why is this happening?
Before we delve into the impact of cancellations and why most DApps don't address this issue, you need to understand what is cancelled.
What is a cancelled transaction?
In Ethereum, the act of canceling a transaction is to cover the transaction that will be processed with a new transaction. It should be noted that this mechanism for canceling transactions is not an official standard of Ethereum, but a customary convention.
New transactions usually have the following characteristics compared to cancelled transactions:
- Have an identical random number (nonce),
- Initiated by the same wallet address,
- Are sent to an external account (not a smart contract),
- The fuel cost of the transaction ( Gas ) is at least 10% higher.
- But the amount of the transaction is 0.
- This new transaction is signed and submitted by the user before the original transaction is confirmed by the blockchain.
Why does this mechanism work? Since the miners prioritize transactions with higher fuel costs, the miners will deal with the transaction that will be cancelled after the new transaction is confirmed, even if the transaction enters the miners earlier to store unprocessed transactions. Information in the trading pool. In other words, the mechanism for canceling a transaction is a bit like a probabilistic game.
How can I cancel a transaction?
Most (but not all) Ethereum wallets can help you cancel your trade. For example, in the browser-based plug-in Ethereum light wallet MetaMask, you can cancel a transaction like this : first find the pending transaction, click to display the details of the transaction, and then click "Cancel transaction" " button. The whole operation is as follows:
How to cancel a transaction in MetaMask
PENDING (in progress) indicates that the transaction is being processed, click on the transaction details, and the Cancel button indicates cancellation of the transaction. The dialog box that pops up indicates that the cancellation of the transaction requires a fuel cost of $0.08 (approximately RMB 0.5). Clicking on the cancellation transaction here does not guarantee that your original submitted transaction will be 100% cancelled. But if the cancellation is successful, you need to pay the above fuel costs, do you want to try?
Although the function of canceling the transaction may seem a bit wasteful, it turns out to be a necessary tool for users to use Dogues with complex functions, because users in these DApps are used to carefully reviewing their transactions. Proactively manage fuel costs.
[Cancel transaction] Is it so simple and straightforward?
This is not the case!
There is a fatal problem when canceling a deal: your DApp. When a user participates in a DApp that you develop and trades, the user's cancel transaction only occurs between the user and his digital wallet, that is, your DApp is completely uninvolved in this session.
How to identify a cancelled transaction?
After knowing the characteristics of the cancelled trade, can you find something in the fourth and fifth trades in the chart below?
Cancelled transaction example
In the ideal case, the fifth trade will cover the fourth trade, which means that the fourth trade will be cancelled.
The random numbers for the fourth and fifth transactions are the same, and the fifth transaction:
More fuel costs were paid.
The amount of the transaction is 0.
Has a different timestamp than the previous transaction.
Has a different transaction hash than the previous transaction.
The first three are at the heart of the cancellation mechanism, and the fourth is a tricky issue for DApp and DApp developers.
How will the cancelled transaction affect the DApp user experience?
Since the original transaction (the cancelled transaction) and the new transaction that covers it later have different hash values, and the DApp you developed is not involved in the creation of this new transaction, your DApp has nothing to do. Ways to get in touch with this new deal.
Normally, your DApp will think that the original transaction is being processed and always show the user the status of the process. This is a bit blunt. Let's use an example to illustrate what this is all about. This is an example of what our team recently discovered when auditing DApp:
The first transaction in the picture has been cancelled
But the DApp doesn't know, or shows it as "in process"
In fact, when the first transaction had been added to the trading pool by the miners, the second transaction was first settled, covering and replacing it.
Since DApp does not have a way to establish contact with the second transaction, DApp will never know if the status of the first transaction was confirmed or failed. Instead, DApp will only show that the first transaction is being processed. in.
With the development of the Ethereum network, the cancellation of transactions has become more and more common. So here we strongly recommend that all DApp developers build front-end features that can handle this situation.
If you are using a DApp that can handle the cancellation of the transaction well, please let us know at the end of the article!
Source | hackernoon
Editor | Carol
Produced | Blockchain Base Camp (blockchain_camp)