-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to cancel pending transaction #3406
Comments
Dupe of #1834? |
Hi @314159265359879, I would like to work on adding a "Cancel request" button to delete pending transactions, as mentioned in issue #3406. I have over 2 years of experience in JavaScript, Python, and building scalable systems. I am eager to begin my open source journey by contributing to this project. Please consider assigning this issue to me, and let me know if there are any additional details or specifications I should be aware of before I start working on it. Thank you! Best regards, |
Hi @Mudityadev thanks for wanting to pick this up, that is awesome. @markmhx anything to keep in mind and do you know if Michelly had time to look at design for this already. or is the current mockup okay for now? |
Thanks for offering to help here, @Mudityadev. @314159265359879 I presume these are the specific design needs:
Given these pieces, I think it'd be best if @mica000 design this properly before we head into development. I'll get it on the board. |
@314159265359879 We discussed this briefly during the product kick-off meeting yesterday and @kyranjamie was hoping to get some more input here on the particular use cases that this feature would help solve. Can you provide a short list of the highest frequency issues with transactions that cancelling would resolve? |
I think this is the top 3
|
Upon discussion it appears the most pressing use case here is for canceling transactions with incorrect nonces so they don't linger for days in the mempool and cause downstream problems with subsequent transactions. |
Another pressing use case is removing transactions that influence available balance such as outgoing STX transactions. Sometimes users can't replace a transaction because the wallet doesn't allow it because the available balance is 0 STX. Cancelling such transactions should take into account balance available after cancelling in order to judge if the fee increase can be covered and if cancelling is possible. Cancel transactions should create 0.000001 STX transfers to the burn address (Stacks network) with a relatively high fee, to make sure there is a high chance the transaction gets picked up after cancelling. Using the high fee for STX transfers with a cap 1-2 STX seems like a reasonable solution. For cancelling bitcoin transactions, we may need optionality a higher fee than any other transaction pending to spend the same inputs would have to be the minimum, but typically I think transactions like this should be sent with the high priority fee to give users the best chance of actually cancelling the transaction. |
Rather than some deeply integrated solution, this would be much easier to build if we trigger an extension pop up. This way, we craft the tx, fire, and forget, rather than building an in-app UX flow. |
@314159265359879 can i work on this?
Is there any other details or important edge cases that i need to keep in mind? |
Hi again @Aman-zishan, yes, absolutely, you are welcome to work on this, thanks!
Excellent
Please consider this comment from Kyran: #3406 (comment)
✅
Use SP00000000000003SCNSJTCSE62ZF4MSE for mainnet instead, we'll spare the genesis address a little bit from spam ;-)
We already have some logic to determine available balance based on pending outgoing STX transfers and pending fees. I think you should also consider the transaction being replaced if a user.
✅ |
@314159265359879 Thanks! a few clarifications:
In that case i can replicate the current fee selection UI with default set to high?.
So when a user click on
✅
✅ |
Setting the default to high is a good idea. That way we increase the likelihood that the transaction is actually replaced.
That sounds good one caveat: We will have to show the transaction in the pending tab; it would be confusing not to. But I understand that "cancel" implies it vanishes, so the user may be confused. These two additions could help mitigate that confusion: explain and add memo/label.
|
@314159265359879 i have finished working on the stacks transactions part, right now working on the integrations tests for this feature, but i noticed that few integration tests are failing (found an issue related to tests unreliability -> #3919) should i add tests anyway even though they are being unreliable? (i verified the working via manual testing with the earlier discussed edge case and can produce a test report in the new PR). I could move on to bitcoin transaction solution if that is the case. Let me know your thoughts |
cc @kyranjamie since he created the related Playwright tests unreliability issue |
How can i create a test environment for BTC transactions? even though i switch to testnet the BTC address remains to be mainnet one. leather gitbook seems to be down too |
@Aman-zishan you should be able to access bitcoin testnet(3) when you select this option in the wallet: You should see testnet addresses on the receive button. When adding custom (stacks) testnets there is currently an issue where the mainnet details are used instead. #5228 perhaps that is what you are running into. Bitcoin testnet 3 is unreliable, constant blockstorm, but you may still be able to utilise it. Work is being done to replace it with a new one public bitcoin testnet (testnet4), I just added an issue here to accommodate that later when it is ready. Right now #5491 |
In that case, once I get confirmation from @kyranjamie regarding the status of integration tests, I would like to include the Stacks transactions cancel feature in a single PR and focus on BTC transactions in a later PR once I am able to reproduce a good testing environment, if that is okay. |
Ideally we should not be adding more tests that are unreliable, as this might exacerbate the issues we're having. Do we know why the test in being unreliable? |
@Aman-zishan have you set |
No, i re ran after setting |
Brice: The problem is that its not possible to cancel a transaction. Once it's reached the mempool, a miner could include it in a block. There's no way to prove whether or not the miner received your attempt to cancel it. The better option is to create a new transaction with the same nonce and a higher fee. Then it is expected that the miner will pick up the higher fee transaction instead.
We can make replacing a transaction super easy. For the user it could be much like "delete transaction" By creating a STX transfer of 0.000001 to the burn address with a fee that is default set to 0.000001 STX more than the transaction being replaced. We could call it a cancel request rather than a delete transaction, as we can never be 100% certain the old isn't picked up anyway, the new transaction would have to be propagated through the network before a miner picks it up.
I think it would make it a lot easier for users to deal with troublesome transactions. Because it wouldn't require a user to understand nonces or RBF... it is handled for them.
Lets combine this with always showing the button to increase the fee for a transaction. They should be always visible. Users do not realize the option is there if it is only shown on hover.
This has been theorized and requested many times. It is a great help when an account has questionable transactions if something went wrong. For example a transaction to send 500 STX was send twice instead of once.
Please note that if we make sending STX very strictly #3389 possible based on available balance. I would want a "cancel request" option in case a user still succeeds in creating transactions that will remain pending until dropped. Because the regular flow may then nolonger allow sending an RBF transaction like this to unclog the wallet:
This transfer of 1 uSTX and a fee of 0.003001 STX replaces the 0.027 transfer with a fee of 0.003 STX:
The text was updated successfully, but these errors were encountered: