pull down to refresh

At the time of writing, almost 100MvB worth of transactions has been dumped into the mempool. If you had lower-fee transactions waiting to be confirmed, there's a risk they'll be purged from the global mempool. If that happens, you might have to recreate the transaction, which can be painful, especially if you're using a multi-sig wallet or an offline, air-gapped wallet.
I'll explain how to alleviate this pain.

Getting the raw transaction hex

First thing you'll need is the raw transaction hex. It'll allow you to to rebroadcast the transaction later on. Your wallet might have an option to export the transaction hex. If that's your case, you can skip this section. Otherwise, keep reading.
Both options below require having the txid, the id of the transaction.
# Using bitcoin-cli $ bitcoin-cli getrawtransaction <txid> >my-transaction.hex # Using curl $ curl https://blockstream.info/api/tx/<txid>/hex >my-transaction.hex
Alternatively, you can use your day-to-day browser. Just navigate to https://blockstream.info/api/tx/<txid>/hex.
Save this data somewhere safe. You'll need it later on.

Rebroadcasting the transaction

If you can't see your transaction in the mempool or in your wallet anymore, it means it has been purged.
To rebroadcast it, you can either:
  • Use bitcoin-cli, or
  • Use a third-party service

Using bitcoin-cli

You can use bitcoin-cli's sendrawtransaction, but there are privacy concerns:
Note that the transaction will be sent unconditionally to all peers, so using this for manual rebroadcast may degrade privacy by leaking the transaction's origin, as nodes will normally not rebroadcast non-wallet transactions already in their mempool.
If you still want to use bitcoin-cli, here's how:
$ xargs bitcoin-cli sendrawtransaction <my-transaction.hex

Using a third-party

By using a third-party you don't expose the relationship between your node and your transaction. This is especially interesting when using a VPN to even hide your IP address.
There are two way to use a third-party:
  1. Using the cli
  2. Using the browser

Using the cli

xargs curl https://blockstream.info/api/tx -X POST --data-raw <my-transaction.hex

Using the browser

Navigate to the URL below, paste in your transaction's raw hex data, and click "Broadcast transcation" (d'oh).

What if it says "mempool error: fee too low"?

If the mempool is full and won't accept your transaction due to it having a low-fee, you can use Replace-By-Fee (RBF) or Child-Pays-For-Parent (CPFP). However, you'll rather just keep waiting until 1sat/vB is enough, just keep your transaction's raw hex data somewhere save and retry rebroadcasting it whenever the mempool is not so full anymore.
No worries. I run some nodes with maxmempool=1000 and some with 2000. Also much raised maxorphantx and mempoolexpiry. And of course there are much more such higher-limit-nodes. And some even keep manually rebroadcasting each transaction in the big mempool they keep, like if it was comming from them using a script like following:
#!/bin/sh USER=user:password_for_RPC_if_needed TMPL=/tmp/mempool$$ trap "rm -rfv ${TMPL}*; exit 1" EXIT INT QUIT printf "Preparing current mempool txid snapshot... " bitcoin-cli getrawmempool \ | sed '/^\[/d;/^\]/d;s/,$//;s/^ //;s/^"//;s/"$//' \ | split -l 256 -a 5 - $TMPL \ && echo done ls $TMPL* >/dev/null 2>&1 \ || { echo "Mempool empty. Sleeping."; sleep 60; exec $0; } printf "Broadcasting: " for file in $TMPL*; do { printf '[' cat $file | while read tx do test -n "$tx" || continue RAW=$(bitcoin-cli getrawtransaction $tx 2>/dev/null) || continue printf '{"jsonrpc": "1.0", "id": "send", "method": "sendrawtransaction", "params": ["%s"]},' $RAW done printf '{"jsonrpc": "1.0", "id": "getbc", "method": "getblockcount", "params": []}]\n' } | curl -s --user $USER --data-binary @- -H 'content-type: text/plain;' http://127.0.0.1:8332/ >/dev/null \ && { rm $file && printf .; } \ || { echo "ERR $file"; exit 1; } done echo done sleep 20 exec $0
@k00b thanks, the indentation of the lines is fixed!
reply
Thank you for sharing. And for maintaining these higher-limit-nodes. Also, damn—you're good at bash! I've learned a trick or two from this script :)
reply
Happy you like it. It's actually bare POSIX shell free of any bashisms. This script runs with busybox ash and should run with OpenBSD's pdksh as well.
And @GDPR_deleted is not the author ;) The script is a public domain legacy.
reply
Old spoiler. Allow me at least one more day of fame next time please. Just kidding 😅
Yes, it's right.
reply
I see CLI commands I zap I am a simple man
reply
Yes. I see your point. Just that the reason I use command line is the same. It's hard for me to use the mouse/pointer and almost impossible to get repeatable results (if not using xdotool for automation).
reply
or you could check mempool.space before you ever send out a transaction..this is the best block explorer regarding fee amounts and if you're going to be in the next block or not..it has never failed me.
reply
Took me a moment to get what xargs curl … <input does :) It's great to learn from everyone! Thanks!
Compared to the script below you can reach the command-line length limit with xargs (run it with --show-limits).
But cool anyway. TIMTOWTDI :)
reply
Thanks for the guide!!!
reply
0 sats \ 0 replies \ @nym 20 Apr
How can one rebroadcast a transaction that has been purged from the global mempool to prevent the risk of it being lost, like when using bitcoin-cli or a third-party service, as explained in the context of addressing the potential issue of lower-fee transactions being purged from the mempool?
reply