Bitcoin Forum
November 09, 2024, 11:50:37 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to delete unconfirmed transactions in Bitcoin mempool  (Read 313 times)
linuxqq (OP)
Jr. Member
*
Offline Offline

Activity: 34
Merit: 6


View Profile
December 22, 2020, 01:29:47 AM
Merited by ranochigo (2), ABCbits (1)
 #1

I executed bitcoin-cli getrawmempool and listed many records. I want to delete one of them. Is there a way to do this?
DaveF
Legendary
*
Offline Offline

Activity: 3654
Merit: 6664


Crypto Swap Exchange


View Profile WWW
December 22, 2020, 01:59:30 AM
 #2

It's the mempool so it gathering all the transactions that are out there. There is no real way to remove specific ones.
Why would you want to delete them?

Or are you trying to remove a transaction that you sent and want to have dropped?

-Dave

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
bill gator
Legendary
*
Offline Offline

Activity: 1372
Merit: 1123



View Profile
December 22, 2020, 02:07:18 AM
 #3

I'm pretty sure the answer to your question is "No". I think sometimes transactions get stuck if the fee is too low, and if enough time goes by without it being picked up then it will be dropped/removed from the pool. I'm not certain about that though, it's been awhile..

Otherwise unconfirmed transactions would be even more volatile than they already are, if my understanding is correct.
ranochigo
Legendary
*
Offline Offline

Activity: 3038
Merit: 4420


Crypto Swap Exchange


View Profile
December 22, 2020, 03:35:14 AM
 #4

There is no way to delete specific transactions from your mempool. Deleting specific transactions from your mempool will only affect what you see and not what others see. You can try to set a different mempool policy but that'll affect a few transactions.

There are ways to remove transactions sent by you by using zapwallettxes.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
PrimeNumber7
Copper Member
Legendary
*
Offline Offline

Activity: 1666
Merit: 1901

Amazon Prime Member #7


View Profile
December 22, 2020, 03:39:27 AM
Merited by pooya87 (1)
 #5

If the transaction is associated with your wallet, you can do one of two things:
*restart bitcoin with the -zapwallettxes option. This will cause bitcoin core to 'forget' all transactions associated with your wallet, and rescan the blockchain for transactions associated with addresses in your wallet.
*use the RPC command removeprunedfunds, which will remove the transaction from your wallet.

Please note that removing a transaction from your mempool will not affect any other node's mempool, and your transaction can still confirm in the future as long as it is valid.
linuxqq (OP)
Jr. Member
*
Offline Offline

Activity: 34
Merit: 6


View Profile
December 22, 2020, 03:48:27 AM
 #6

If the transaction is associated with your wallet, you can do one of two things:
*restart bitcoin with the -zapwallettxes option. This will cause bitcoin core to 'forget' all transactions associated with your wallet, and rescan the blockchain for transactions associated with addresses in your wallet.
*use the RPC command removeprunedfunds, which will remove the transaction from your wallet.

Please note that removing a transaction from your mempool will not affect any other node's mempool, and your transaction can still confirm in the future as long as it is valid.
I want to analyze unconfirmed transactions, but there are more and more transactions in the memory pool, which leads to longer and longer analysis time of my program, so I hope to delete after the analysis, any good suggestions
ranochigo
Legendary
*
Offline Offline

Activity: 3038
Merit: 4420


Crypto Swap Exchange


View Profile
December 22, 2020, 03:56:52 AM
 #7

I want to analyze unconfirmed transactions, but there are more and more transactions in the memory pool, which leads to longer and longer analysis time of my program, so I hope to delete after the analysis, any good suggestions
I assume that you're getting a dataset for the mempool in general? That would mean you're looking to prune the same number of transactions from each fees level, I assume. The method is probably to export the mempool and process it before passing it to your program.

There are ways to limit the size of mempool by using -maxmempool= and -minrelaytxfee= but that'll result in the transaction that pays a lesser fees to be excluded from your mempool.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
PrimeNumber7
Copper Member
Legendary
*
Offline Offline

Activity: 1666
Merit: 1901

Amazon Prime Member #7


View Profile
December 22, 2020, 03:59:20 AM
 #8

If the transaction is associated with your wallet, you can do one of two things:
*restart bitcoin with the -zapwallettxes option. This will cause bitcoin core to 'forget' all transactions associated with your wallet, and rescan the blockchain for transactions associated with addresses in your wallet.
*use the RPC command removeprunedfunds, which will remove the transaction from your wallet.

Please note that removing a transaction from your mempool will not affect any other node's mempool, and your transaction can still confirm in the future as long as it is valid.
I want to analyze unconfirmed transactions, but there are more and more transactions in the memory pool, which leads to longer and longer analysis time of my program, so I hope to delete after the analysis, any good suggestions

You could run the getrawmempool RPC command, add those txids to a list of txids you have analyzed that remain on the list for x days. When you run your analysis, you can compare the txids to what is in the mempool to the txids on your list. You can also review each confirmed block, and any transaction that has been confirmed can also be removed from your list.
linuxqq (OP)
Jr. Member
*
Offline Offline

Activity: 34
Merit: 6


View Profile
December 22, 2020, 06:15:46 AM
 #9

If the transaction is associated with your wallet, you can do one of two things:
*restart bitcoin with the -zapwallettxes option. This will cause bitcoin core to 'forget' all transactions associated with your wallet, and rescan the blockchain for transactions associated with addresses in your wallet.
*use the RPC command removeprunedfunds, which will remove the transaction from your wallet.

Please note that removing a transaction from your mempool will not affect any other node's mempool, and your transaction can still confirm in the future as long as it is valid.
I want to analyze unconfirmed transactions, but there are more and more transactions in the memory pool, which leads to longer and longer analysis time of my program, so I hope to delete after the analysis, any good suggestions

You could run the getrawmempool RPC command, add those txids to a list of txids you have analyzed that remain on the list for x days. When you run your analysis, you can compare the txids to what is in the mempool to the txids on your list. You can also review each confirmed block, and any transaction that has been confirmed can also be removed from your list.


Thank you very much for your answer, I use this method to run, export the data in the memory pool to the list, and compare the list with the memory pool, but the analysis time of the program will also change as the bitcoind runs longer. Long, I haven't found a quick way. Can I exclude some transactions with relatively low fees? If I only analyze transactions with higher fees, this can speed up the speed, but how to block some transactions with lower fees?
PrimeNumber7
Copper Member
Legendary
*
Offline Offline

Activity: 1666
Merit: 1901

Amazon Prime Member #7


View Profile
December 22, 2020, 06:36:10 AM
 #10

In your bitcoin.config file, you can adjust some settings. You can set the minrelaytxfee to a higher fee rate.

Also, if you are not performing analysis frequently, you can set persistmempool=0, and restart your node immediately after completing your analysis. This will result in your mempool being wiped each time you stop your bitcoin node. If you stop and quickly restart your node with this setting, you will miss some number of transactions that would have been relayed during the brief period your node was not running.
linuxqq (OP)
Jr. Member
*
Offline Offline

Activity: 34
Merit: 6


View Profile
December 22, 2020, 08:36:50 AM
 #11

In your bitcoin.config file, you can adjust some settings. You can set the minrelaytxfee to a higher fee rate.

Also, if you are not performing analysis frequently, you can set persistmempool=0, and restart your node immediately after completing your analysis. This will result in your mempool being wiped each time you stop your bitcoin node. If you stop and quickly restart your node with this setting, you will miss some number of transactions that would have been relayed during the brief period your node was not running.
I don’t want to analyze transactions below 0.9. There is currently no way to restart the bitcoind node because I want to analyze every transaction with a transaction greater than 0.9
linuxqq (OP)
Jr. Member
*
Offline Offline

Activity: 34
Merit: 6


View Profile
December 22, 2020, 08:39:10 AM
 #12

It's the mempool so it gathering all the transactions that are out there. There is no real way to remove specific ones.
Why would you want to delete them?

Or are you trying to remove a transaction that you sent and want to have dropped?

-Dave


Can I get all the transactions in the memory pool first, and then clear the transactions in the memory pool? I hope not to restart the bitcoin node
ABCbits
Legendary
*
Offline Offline

Activity: 3052
Merit: 8074


Crypto Swap Exchange


View Profile
December 22, 2020, 11:27:54 AM
Merited by linuxqq (1)
 #13

I don’t want to analyze transactions below 0.9. There is currently no way to restart the bitcoind node because I want to analyze every transaction with a transaction greater than 0.9

Why don't you just grab all transaction on mempool, then filter out all transaction that doesn't meet your criteria before begin the analysis process?

Can I get all the transactions in the memory pool first, and then clear the transactions in the memory pool? I hope not to restart the bitcoin node

AFAIK there's no command to clear your mempool

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!