I want to cleanup mempool. I googled and knew -zapwallettxes might clean up mempool.

But when I do the following command, mempool is still loaded.

./bitcoind -testnet=3 -server -rest -dbcache=4000 -txindex=1 -rpcbind= -rpcallowip= -printtoconsole -zapwallettxs=2 -rescan

In this situation, even if I restart bitcoind, mempool is dumped to .bitcoin/testnet3/mempool.dat and loaded on startup.

how should I clean up mempool?

Any comments and advices are welcomed :)

  • Have you tried using the option maxmempool=N, where N is the maximum size of your mempool in megabytes?
    – Pedro
    Commented Sep 7, 2018 at 9:35
  • 2
    Why are you doing this? What do you hope to accomplish by "cleaning up" the mempool? Commented Sep 7, 2018 at 14:24

1 Answer 1


First of all, clearing your mempool doesn't really do anything if the transactions you're clearing have already propagated through the network. The mempool will sync again when you connect to other peers.

mempool.dat was introduced in 0.14.0 and will persist the mempool on shutdown. In order to clear the mempool you have to:

  1. Shutdown Bitcoin Core $ bitcoin-cli -testnet3 stop
  2. Delete mempool.dat $ rm ~/.bitcoin/testnet3/mempool.dat
  3. Restart the daemon $ bitcoind -testnet -zapwallettxes

Note: You might also need start the daemon with -zapwallettxes so the transactions related to your wallet aren't loaded into the mempool at startup.

Another Note: If you only want to remove transactions related to your wallet, you can skip step 2: https://github.com/bitcoin/bitcoin/pull/10330

  • -zapwallettxes has been removed from bitcoin-core. Use abandontransaction to clear an orphaned Tx from the wallet.
    – rustyx
    Commented Dec 29, 2022 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.