ord icon indicating copy to clipboard operation
ord copied to clipboard

Allow fee-bumping transactions

Open casey opened this issue 2 years ago • 29 comments

Commit, reveal, and send transactions can all get stuck in the mempool. The wallet opts them into RBF, so they can be bumped, but we don't have any code to actually bump them. We should add this.

First step is a design. Does ord wallet bump TXID work? that would be the simplest design, but if ord needs to do different things for commit, reveal, and send transactions, it would have to figure out which TXID was. Another option is ord wallet rescue TXID, which will fee bump, not reveal inscriptions, and return the UTXO to your wallet to try again with a higher fee. If this is really simple, we might consider prioritizing it.

casey avatar Feb 06 '23 07:02 casey

I have an inscription stuck in the mempool at 1sat/vB (I know I know, I should have used the fee_rate param but I was so excited and moving fast that I didn't rtfm). So, I started implementing this and quickly ran into an issue with bumpfee:

Unable to create transaction. Transaction must have at least one recipient (code -4)

The reveal transaction doesn't seem to be eligible for RBF. Will continue digging but thought it worth mentioning.

MattSenter avatar Feb 09 '23 21:02 MattSenter

Got into same situation but with transfer, stuck with 1sat/vB. How do you even specify fee_rate for transfers? The params are just recipient and inscription

pokrovskyy avatar Feb 10 '23 20:02 pokrovskyy

Does this let transactions not in the mempool be bumped aswell? Have a bunch of funds & rare inscriptions just locked waiting to get broadcasted :(

chipaaas avatar Feb 10 '23 20:02 chipaaas

Got into same situation but with transfer, stuck with 1sat/vB. How do you even specify fee_rate for transfers? The params are just recipient and inscription

My bad, there actually is --fee-rate option for wallet send command 😄 Well, now just need the bump-up feature to recover stuck tx

pokrovskyy avatar Feb 10 '23 22:02 pokrovskyy

FYI - I have tried bumping up fee for my stuck inscription transfer via bitcoin-cli's bumpfee and it seemingly worked:

bitcoin-cli bumpfee <txid> '{"fee_rate": 100}'

The inscription is showing up in the target wallet (confirmed with ord wallet inscriptions) and on Ordinals explorer.

NOTE - it was an inscription transfer fee bump (still need to test bumping up inscription creation)

pokrovskyy avatar Feb 11 '23 14:02 pokrovskyy

FYI - I have tried bumping up fee for my stuck inscription transfer via bitcoin-cli's bumpfee and it seemingly worked:

bitcoin-cli bumpfee <txid> '{"fee_rate": 100}'

The inscription is showing up in the target wallet (confirmed with ord wallet inscriptions) and on Ordinals explorer.

NOTE - it was an inscription transfer fee bump (still need to test bumping up inscription creation)

How? Did you use windows? I keep getting JSON errors in CMD and PowerShell using your command syntax.

cc0mfer avatar Feb 11 '23 16:02 cc0mfer

sorry not sure about Windows version if it is different. I did it on Ubuntu, bitcoin-cli v24.0.1.

Btw, I checked it won't work for bumping up inscriptions because it is commit-reveal setup (commit tx with a dependent reveal tx), and bumping up tx with dependent txs is not supported by bitcoin-cli because it requires changing the whole batch (unlike for inscription transfers which is single tx). One way would be to force-replace the commit tx with higher fee rate (possibly via createrawtransaction > signrawtransactionwithwallet > sendrawtransaction flow) which will rescue the UTXO and let you re-inscribe again (pretty much what @casey suggested above) I will test this concept and post here if it works

pokrovskyy avatar Feb 11 '23 17:02 pokrovskyy

You are correct, the only way I was able to get unblocked was sending out the balance on my Ord wallet to a new Ord wallet via the bitcoin core gui. The ord cli was not allowing me to send out funds. Redoing inscribes with the --fee-rate flag now.

cc0mfer avatar Feb 11 '23 19:02 cc0mfer

FYI - here is a detailed instruction on how to create a replacement tx with higher fee via createrawtransaction https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line/blob/master/04_2_Creating_a_Raw_Transaction.md

pokrovskyy avatar Feb 12 '23 12:02 pokrovskyy

You are correct, the only way I was able to get unblocked was sending out the balance on my Ord wallet to a new Ord wallet via the bitcoin core gui. The ord cli was not allowing me to send out funds. Redoing inscribes with the --fee-rate flag now.

any chance you can clarify on how to do this? i have a send inscription and inscribe transaction stuck because i didnt set a fee rate.

biggeld avatar Feb 12 '23 18:02 biggeld

Be careful with this bitcoin-cli command above as the bitcoin wallet isn't aware of inscriptions so will likely use them as fee.. Just lost 3 inscriptions to the miners this way 😭

it also used the intended inscription as fee and sent a different inscription to the other person..

in summary: Do NOT use bumpfee unless you know there are no other inscriptions in that wallet at risk

brianorwhatever avatar Feb 14 '23 22:02 brianorwhatever

FYI - I have tried bumping up fee for my stuck inscription transfer via bitcoin-cli's bumpfee and it seemingly worked:

bitcoin-cli bumpfee <txid> '{"fee_rate": 100}'

The inscription is showing up in the target wallet (confirmed with ord wallet inscriptions) and on Ordinals explorer. NOTE - it was an inscription transfer fee bump (still need to test bumping up inscription creation)

How? Did you use windows? I keep getting JSON errors in CMD and PowerShell using your command syntax.

this will cause you to lose your inscriptions...be careful, better would be if this is removed.

surfer77 avatar Feb 15 '23 05:02 surfer77

@casey any ETA on bump fee feature on ord wallet ? Using bitcoin ci to bump fee is risky... My transaction is stuck at 1sat/vbyte :(.

goddesslens avatar Feb 15 '23 09:02 goddesslens

@casey any ETA on bump fee feature on ord wallet ? Using bitcoin ci to bump fee is risky... My transaction is stuck at 1sat/vbyte :(.

Did you fixed it? My inscribe stuck also with 1sat/vbyte :(. And no way error: wallet contains no cardinal utxos to create new one because previous stuck?

ittechguruuu avatar Feb 18 '23 05:02 ittechguruuu

+1 for this! goofed up and submitted an inscription at 1 sat/vB, not sure what to do as I don't want to accidentally spend one of my rares

ogunden avatar Feb 22 '23 00:02 ogunden

yeah i recommend not burning rares its a real bummer

brianorwhatever avatar Feb 22 '23 06:02 brianorwhatever

I goofed up with this as well. Now I got the first 5 ordinals in my projects collection stuck trying to mint one with 1sat/vbyte. Has anyone figure a way to get their BTC and ordinals back yet? Is this being worked on at all?

ronval avatar Feb 25 '23 05:02 ronval

Lucky you, blocks are empty right now so you should be confirmed. To my knowledge, the only safe thing to do is to wait until you get confirmed; unless you're a deep ordinals hacker in which case you might be able to craft a raw transaction that manages not to spend any rares.

ogunden avatar Feb 26 '23 18:02 ogunden

+1 Also got a stuck tx at 1sat/vbyte after not thinking too much when using ord wallet send :-P

stianstr avatar Mar 02 '23 07:03 stianstr

Sry for being a n00b, but...

If a tx to send an ordinal is stuck due to a low fee, and I transfer out all other ordinals to another wallet first, and then run bitcoin-cli bumpfee - would that be safe?

Or is there a risk that it somehow spends the very ordinal being transferred in the original tx when doing the bumpfee?

stianstr avatar Mar 04 '23 21:03 stianstr

yeah I think there is a chance. When I did it there was 4 ordinals that ended up moving and the one I was trying to bump was one of the burned.

brianorwhatever avatar Mar 06 '23 16:03 brianorwhatever

Sry for being a n00b, but...

If a tx to send an ordinal is stuck due to a low fee, and I transfer out all other ordinals to another wallet first, and then run bitcoin-cli bumpfee - would that be safe?

Or is there a risk that it somehow spends the very ordinal being transferred in the original tx when doing the bumpfee?

if it's just a send transaction you can easily craft a raw transaction with reveal tx as the input and the same target address but with lower output value using this guide: https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line/blob/master/04_2_Creating_a_Raw_Transaction.md

I'm still interested in the original feature request of this issue: ord wallet bump TXID should we offer a bounty? how can we push this forward?

ordinalsbot avatar Mar 11 '23 05:03 ordinalsbot

I had a few stuck transactions due to low fees, and I ended up writing a script to free them up. While researching, I came across this issue, but unfortunately, I don't know Rust yet to be able to contribute. In any case, I'll share the Python solution I came up with as it might help others in a similar situation of stuck txs: https://github.com/drignads/restore-ord-txs

MMCGW avatar Mar 14 '23 14:03 MMCGW

@ordinalsbot doubling-down for being a noob. Trying to craft a new raw transaction following the guide you linked in an attempt to bump an ord wallet send transaction I gave a low fee-rate for. Currently stuck in mempool for 6 days.

utxo_txid -> The txid/location of your ordinal (e.g. the inscription id minus the last 2 digits https://ordinals.com/inscription/670da24819e8e221eec3f49f77bd1ea779c1e2fb2e8da1df2ceba0ec2340201bi0 ) recipient -> The same recipient your original send transaction was going to (this transaction https://mempool.space/tx/aa34c1b96700c4704fa54d5b047144f9b2d94409432ba221f677c63029bfc7e9) utxo_vout -> 0 (the last digit of the inscription id)

So for me I can set:

utxo_txid="670da24819e8e221eec3f49f77bd1ea779c1e2fb2e8da1df2ceba0ec2340201b"
recipient="bc1pcunwzvauqyupsdn4ke6ulquk7rlspzn6xpkq2tj09908mc4s2q9q57jnmp"
utxo_vout="0"

There are 10000 sats with the inscrintion (unspent UTXOs), so lets give it a fee of 2000 sats which means we set an amount of 8000 sats (0.00008 btc) to send (and the 2000 will be used as fee).

So I create raw transaction:

rawtxhex=$(bitcoin-cli createrawtransaction '''[ { "txid": "'$utxo_txid'", "vout": '$utxo_vout' } ]''' 
  ''{ "'$recipient'": 0.00008 }''')

Sign the transaction:

signedtx=$(bitcoin-cli signrawtransactionwithwallet $rawtxhex jq -r '.hex')

And send it:

bitcoin-cli sendrawtransaction $signedtx

Does that seem correct? I don't quite understand the amount, whether it needs to pull the fee from this UTXO or whether it is going to grab whatever funds from my wallet (other inscriptions included).

extraordinal avatar Mar 16 '23 00:03 extraordinal

FYI, I ended up using the method propsed by the legend "Greg" on discord:

  1. Shut down bitcoind
  2. Backup mempool.dat and your wallet.dat file, e.g: mv .bitcoin/mempool.dat ~/Backup/ mv .bitocin/wallets/ord ~/Backup/
  3. (optional?) Restart bitcoind with -connect=0 (I had bitcoind freeze at "net thread start", so I did not include this.)
  4. Restore your wallet from seed phrase ord wallet restore "your seed words here"
  5. Rescan the blocks starting from the first inscription (or your first inscription) bitcoin-cli -rpcwallet=ord rescanblockchain 767430
  6. Re-send with higher fee ord wallet send --fee-rate 20 <orginal btc destination> <ordinal inscrion id>

extraordinal avatar Mar 16 '23 11:03 extraordinal

@ordinalsbot doubling-down for being a noob. Trying to craft a new raw transaction following the guide you linked in an attempt to bump an ord wallet send transaction I gave a low fee-rate for. Currently stuck in mempool for 6 days.

utxo_txid -> The txid/location of your ordinal (e.g. the inscription id minus the last 2 digits https://ordinals.com/inscription/670da24819e8e221eec3f49f77bd1ea779c1e2fb2e8da1df2ceba0ec2340201bi0 ) recipient -> The same recipient your original send transaction was going to (this transaction https://mempool.space/tx/aa34c1b96700c4704fa54d5b047144f9b2d94409432ba221f677c63029bfc7e9) utxo_vout -> 0 (the last digit of the inscription id)

So for me I can set:

utxo_txid="670da24819e8e221eec3f49f77bd1ea779c1e2fb2e8da1df2ceba0ec2340201b"
recipient="bc1pcunwzvauqyupsdn4ke6ulquk7rlspzn6xpkq2tj09908mc4s2q9q57jnmp"
utxo_vout="0"

There are 10000 sats with the inscrintion (unspent UTXOs), so lets give it a fee of 2000 sats which means we set an amount of 8000 sats (0.00008 btc) to send (and the 2000 will be used as fee).

So I create raw transaction:

rawtxhex=$(bitcoin-cli createrawtransaction '''[ { "txid": "'$utxo_txid'", "vout": '$utxo_vout' } ]''' 
  ''{ "'$recipient'": 0.00008 }''')

Sign the transaction:

signedtx=$(bitcoin-cli signrawtransactionwithwallet $rawtxhex jq -r '.hex')

And send it:

bitcoin-cli sendrawtransaction $signedtx

Does that seem correct? I don't quite understand the amount, whether it needs to pull the fee from this UTXO or whether it is going to grab whatever funds from my wallet (other inscriptions included).

this is exactly right, since original tx signals RBF you can just sign tx with sequence=1 and a higher fee (your output being 8k sats so 2k sats for fee) and miners will mine the new one. Greg's method might work if you have a lot of time on your hands but we did so many of these, we had to automate it. I'll probably share a gist at some point.

But I don't want to derail this issue, we still need a native bump fee on the ord wallet.

@raphjaph @Psifour any comments please?

ordinalsbot avatar Mar 16 '23 20:03 ordinalsbot

Commit, reveal, and send transactions can all get stuck in the mempool

Commit transactions are the hardest to replace. Typically the reveal tx is much bigger than the commit tx. When we attempt to replace the commit tx, the node rejects the replacement if the fee on the replacement tx is smaller than the sum of the fees on the existing commit and reveal txs, which it almost always will be. So in that case we either need to specify a huge fee rate for the new commit tx, which is a waste of sats, or use cpfp on the reveal output to increase the effective fee rate.

gmart7t2 avatar Apr 02 '23 17:04 gmart7t2

Would creating a send tx after the reveal with a high CPFP fee rate help an inscription get prioritized without increasing cost of inscription as much?

brianorwhatever avatar Apr 03 '23 17:04 brianorwhatever

@MMCGW thank you man! it's working!

silverstr89 avatar Jul 12 '23 13:07 silverstr89