Skip to content
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

Recover funds from an unspent reveal transaction (maxtxfee error) #3647

Open
StashMaker opened this issue Apr 22, 2024 · 19 comments
Open

Recover funds from an unspent reveal transaction (maxtxfee error) #3647

StashMaker opened this issue Apr 22, 2024 · 19 comments

Comments

@StashMaker
Copy link

StashMaker commented Apr 22, 2024

@raphjaph @casey

Is it possible to recover the funds from a reveal transaction that was never broadcasted to the mempool?

The commit transaction was send and successfully included in a block. The reveal transaction got stuck due to a maxtxfee error. When checking the ord wallet balance, the cardinals previously reserved for reveal transaction fees are still displayed, but can no longer be sent or otherwise spent (error: unable to sign transaction)

Manually creating and signing a transaction returns an error as well ("error": "Witness program was passed an empty witness").

@huguojunsy
Copy link

huguojunsy commented Apr 22, 2024

My situation is the same as yours, it also happened during etch, where due to the feerate being over 10000/vb, only the commit transaction succeeded and the reveal encountered an error(not broadcasted). Now, as the network's miner fees have significantly decreased, I hope to recover the funds from the input of reveal transaction, but I have tried multiple methods and failed. From what I understand, quite a few people have also encountered the same problem, hoping @casey @raphjaph could help us out.

Best regards.

@StashMaker
Copy link
Author

As far as I can tell, our funds are still there. The question is whether we can access them again or whether they are so tied to the commit transaction that we can no longer spend them.

@raphjaph
Copy link
Collaborator

We've set it up in a way such that the commit output, should be seamlessly recoverable.

So you see the UTXO in your wallet but can't use it in a transaction?

@droplister
Copy link

droplister commented Apr 22, 2024

I have ~0.65 BTC across several named wallets encountering this issue. I don't mind doxxing one if it helps or paying someone for their help due to the amount impacted by this.

ord --index-runes wallet --name e1 balance

{
  "cardinal": 10626819,
  "ordinal": 0,
  "runes": {},
  "runic": 0,
  "total": 10626819
}

ord --index-runes wallet --name e1 send 3Mji2mfaht1MdgwvD5ivLro7M5onAugdZY "10606719sat" --fee-rate 100 --dry-run

{
  "txid": "11fcfb43f048437c096de638ffa08dda98c704a72242d4c0c99c50fa7c7e068a",
  "psbt": "cHNidP8BAHwCAAAAAs/VqU96F0Js5+Sytu1xkgiCUkPRJNEr61/+8zB05otbAQAAAAD9////z9WpT3oXQmzn5LK27XGSCIJSQ9Ek0SvrX/7zMHTmi1sAAAAAAP3///8Bf9ihAAAAAAAXqRTb5NPZvHmupZSphnIlLNBo30QUb4cAAAAAAAEBKzYCAgAAAAAAIlEgh+x8eLDPhvbW7uGaEMJS/MwVaGOxHTIFsMwFyL8Ae3khFggKlgRpDMGJF6FbCLZ0uSTzu3+i876k0h3IRXjrk9Y9GQCHGA3qVgAAgAAAAIAAAACAAQAAADIAAAABFyAICpYEaQzBiRehWwi2dLkk87t/ovO+pNIdyEV465PWPQABASvNJKAAAAAAACJRIMBzYsVx7XnWYPhreo9Vz1TWWj8qHSfw1FB8H8apIlFdAAA=",
  "outgoing": "0.10606719 btc",
  "fee": 20100
}

ord --index-runes wallet --name e1 send 3Mji2mfaht1MdgwvD5ivLro7M5onAugdZY "10606719sat" --fee-rate 100

error: unable to sign transaction

ord --index-runes wallet --name e1 transactions

[
  {
    "transaction": "20f03267aeac2163f6dea66091f4bedf31135aab19c64129b5855ca32c1d225c",
    "confirmations": 751
  },
  {
    "transaction": "5b8be67430f3fe5feb2bd124d1435282089271edb6b2e4e76c42177a4fa9d5cf",
    "confirmations": 742
  },
  {
    "transaction": "5b8be67430f3fe5feb2bd124d1435282089271edb6b2e4e76c42177a4fa9d5cf",
    "confirmations": 742
  }
]

ord --index-runes wallet --name e1 outputs

[
  {
    "output": "5b8be67430f3fe5feb2bd124d1435282089271edb6b2e4e76c42177a4fa9d5cf:0",
    "amount": 10495181
  },
  {
    "output": "5b8be67430f3fe5feb2bd124d1435282089271edb6b2e4e76c42177a4fa9d5cf:1",
    "amount": 131638
  }
]

@droplister
Copy link

Also reported here: #3629

@StashMaker
Copy link
Author

StashMaker commented Apr 22, 2024

Thank you @raphjaph for your quick response and for taking care of this issue:

  • the correct amount of sats is displayed as cardinals when checking with ord wallet balance,
  • the UTXO is listed when running bitcoin-cli -rpcwallet=walletName listunspent
  • gettransaction shows the correct transaction to the new address and
  • and decoderawtransaction looks good too.

When I check the new output address of these unspent funds with getaddressinfo, it returns:
"ismine": true, "solvable": true, "iswatchonly": false, "isscript": true, "iswitness": true, "witness_version": 1, "ischange": false, "labels": ["commit tx recovery key"]

When I try to send the funds with ord wallet send I get: error: unable to sign transaction.
The same happens when I construct a tx manually.

Ord version used: 0.18.2

When I dump the wallet in restore it on another system, none of the above is displayed anymore. The new output is no longer available there.

@raphjaph
Copy link
Collaborator

Thanks for the details, I'll have a look at this.

What you can try now as well is loading the seed phrase for that wallet into Sparrow, then carefully selecting the correct UTXO and sending it out. When importing into sparrow make sure to select the Taproot descriptor on initialization.

@StashMaker
Copy link
Author

Thank you very much, @raphjaph. The thing is, the UTXO in question doesn't show up in Sparrow after importing the wallet. The same is true if I dump and restore the ord wallet on another system. I'm not sure if this is just a problem on my end.

@droplister
Copy link

I tried scanning 2000 deep on Sparrow and it doesn't detect all the BTC.
image

@StashMaker
Copy link
Author

Same here, mine looks almost identical.

@raphjaph
Copy link
Collaborator

Ah yes, sorry I was wrong. Since the commit output is a custom output it won't show up in Sparrow. The backup key should be stored in the Bitcoin Core wallet though. I'll figure out what commands to run to recover.

@raphjaph
Copy link
Collaborator

I was able to manually create a transaction. The commit output is locked because when you etch we don't want to accidentally spend the commitment. You have to be really careful when constructing transactions manually since the fee is implicit. Before trying to do that just try unlocking the locked commit output and then try sending with ord again. I'll continue trying to drill down.

> bitcoin-cli -datadir=env -rpcwallet=ord lockunspent true "[{\"txid\":\"33b61355d732a771465c991bbd0c4e7ca0b7b150ee2fac4f94f95adb244aa83f\",\"vout\":0}]"

true


> bitcoin-cli -datadir=env -rpcwallet=ord listunspent | jq '.[] | select(.address == "bcrt1pzrfzdzyzna2gutqw83sw3x0gjyvfuyqc666mgf3rdz2jde49mhvqf75gqh")'

{
  "txid": "33b61355d732a771465c991bbd0c4e7ca0b7b150ee2fac4f94f95adb244aa83f",
  "vout": 0,
  "address": "bcrt1pzrfzdzyzna2gutqw83sw3x0gjyvfuyqc666mgf3rdz2jde49mhvqf75gqh",
  "label": "commit tx recovery key",
  "scriptPubKey": "512010d22688829f548e2c0e3c60e899e891189e1018d6b5b42623689526e6a5ddd8",
  "amount": 0.00021159,
  "confirmations": 1,
  "spendable": true,
  "solvable": true,
  "desc": "rawtr([9adbd87e]10d22688829f548e2c0e3c60e899e891189e1018d6b5b42623689526e6a5ddd8)#f2k6008h",
  "parent_descs": [
    "rawtr(10d22688829f548e2c0e3c60e899e891189e1018d6b5b42623689526e6a5ddd8)#6p7wgsn0"
  ],
  "safe": true
}


> bitcoin-cli -datadir=env -rpcwallet=ord createrawtransaction "[{\"txid\":\"33b61355d732a771465c991bbd0c4e7ca0b7b150ee2fac4f94f95adb244aa83f\",\"vout\":0}]" "[{\"bcrt1ps09gd4jyg9u5kx0gg2clv0gxddtzmtujq3s99vaxaszkf6f8f96qv2exg0\":0.00021000}]"

02000000013fa84a24db5af9944fac2fee50b1b7a07c4e0cbd1b995c4671a732d75513b6330000000000fdffffff01085200000000000022512083ca86d64441794b19e842b1f63d066b562daf92046052b3a6ec0564e927497400000000


> bitcoin-cli -datadir=env -rpcwallet=ord signrawtransactionwithwallet 02000000013fa84a24db5af9944fac2fee50b1b7a07c4e0cbd1b995c4671a732d75513b6330000000000fdffffff01085200000000000022512083ca86d64441794b19e842b1f63d066b562daf92046052b3a6ec0564e927497400000000

{
  "hex": "020000000001013fa84a24db5af9944fac2fee50b1b7a07c4e0cbd1b995c4671a732d75513b6330000000000fdffffff01085200000000000022512083ca86d64441794b19e842b1f63d066b562daf92046052b3a6ec0564e927497401404f935f0a40a4e76dec6ad36080527e6957a37c737da2a1831073ee541b9dab6326ceedb3fd0cdcf57809d0cd06e89f5931d18677b71f6661978b26bcb4c01ba400000000",
  "complete": true
}


> bitcoin-cli -datadir=env -rpcwallet=ord sendrawtransaction 020000000001013fa84a24db5af9944fac2fee50b1b7a07c4e0cbd1b995c4671a732d75513b6330000000000fdffffff01085200000000000022512083ca86d64441794b19e842b1f63d066b562daf92046052b3a6ec0564e927497401404f935f0a40a4e76dec6ad36080527e6957a37c737da2a1831073ee541b9dab6326ceedb3fd0cdcf57809d0cd06e89f5931d18677b71f6661978b26bcb4c01ba400000000

1aac9491cdc24dd96cd60683d7301e5e599404f92874a207117343afa4e1fe9e

@raphjaph
Copy link
Collaborator

If you do ord wallet dump the rawtr(.... is the descriptor of the backup key to the commit output. You could also try importing just that into a new wallet and spending from there.

@loon3
Copy link

loon3 commented Apr 22, 2024

When I try to manually create the tx with bitcoin-cli, I get an error using the lockunspent command and an error when signing the tx...

bitcoin-cli -rpcwallet=etching2 lockunspent true "[{\"txid\":\"495e00dabe1ce6d1cfc0c83d83e756134f73037dad4fa60977be9955a03ffd94\",\"vout\":0}]"
error code: -8
error message:
Invalid parameter, expected locked output

bitcoin-cli -rpcwallet=etching2 createrawtransaction "[{\"txid\":\"495e00dabe1ce6d1cfc0c83d83e756134f73037dad4fa60977be9955a03ffd94\",\"vout\":0}]" "[{\"3NU5MVmiQuweKM6o3odkFfV1apkBFfqyQo\":0.0495}]"
020000000194fd3fa05599be7709a64fad7d03734f1356e7833dc8c0cfd1e61cbeda005e490000000000fdffffff01f0874b000000000017a914e3e818ece31f8bbf2cbb65aac6b22ea51d0ddb158700000000

bitcoin-cli -rpcwallet=etching2 signrawtransactionwithwallet 020000000194fd3fa05599be7709a64fad7d03734f1356e7833dc8c0cfd1e61cbeda005e490000000000fdffffff01f0874b000000000017a914e3e818ece31f8bbf2cbb65aac6b22ea51d0ddb158700000000
{
  "hex": "020000000194fd3fa05599be7709a64fad7d03734f1356e7833dc8c0cfd1e61cbeda005e490000000000fdffffff01f0874b000000000017a914e3e818ece31f8bbf2cbb65aac6b22ea51d0ddb158700000000",
  "complete": false,
  "errors": [
    {
      "txid": "495e00dabe1ce6d1cfc0c83d83e756134f73037dad4fa60977be9955a03ffd94",
      "vout": 0,
      "witness": [
      ],
      "scriptSig": "",
      "sequence": 4294967293,
      "error": "Witness program was passed an empty witness"
    }
  ]
}

@huguojunsy
Copy link

huguojunsy commented Apr 23, 2024

If you do ord wallet dump the rawtr(.... is the descriptor of the backup key to the commit output. You could also try importing just that into a new wallet and spending from there.

This is useful. However, you need to use the 'ord.exe wallet dump' command instead of 'bitcoin-cli.exe listunspent' to obtain the rawtr, as the rawtr information obtained from these two methods is different. Once you have the rawtr, you can use 'bitcoin-cli.exe importdescriptors' to import it into the Bitcoin Core wallet and then send it.

Thanks to @raphjaph .

@loon3
Copy link

loon3 commented Apr 23, 2024

This is useful. However, you need to use the 'ord.exe dump' command instead of 'bitcoin-cli.exe listunspent' to obtain the raw transaction, as the raw transaction information obtained from these two methods is different. Once you have the raw transaction, you can use 'bitcoin-cli.exe importdescriptors' to import it into the Bitcoin Core wallet and then send it.

This worked for me!

ord wallet dump then using the descriptors array from the dump bitcoin-cli importdescriptors "[{\"desc\": \"rawtr(... (if using Windows remember to escape the inner quotes)

Then I just created a simple transaction and was able to sign it no problem.

bitcoin-cli createrawtransaction "[{\"txid\":\"...

bitcoin-cli signrawtransactionwithwallet 02000...

bitcoin-cli sendrawtransaction 02000...

Thanks @raphjaph and @huguojunsy !

@StashMaker
Copy link
Author

If you do ord wallet dump the rawtr(.... is the descriptor of the backup key to the commit output. You could also try importing just that into a new wallet and spending from there.

This works!

  • ord wallet dump to reveal the descriptors
  • copy/paste the one that contains the transaction you want to restore
  • create a new Bitcoin Core wallet with bitcoin-cli createwallet walletName or
  • load an exiting Bitcoin Core wallet with bitcoin-cli loadwallet walletName
  • construct the importdescriptor command like so:
bitcoin-cli -rpcwallet=walletName importdescriptors  '[
  {
    "desc": "the descriptor",
    "timestamp": 1713530220
  }
]'
  • check the balance with bitcoin-cli -rpcwallet=walletName getbalance
  • and then follow the steps described by Raph to manually construct, sign and send a new transaction to a new address of your choice.

Thanks to all of your guys for your engagement. @raphjaph @huguojunsy @loon3

@big-soulja
Copy link

big-soulja commented Apr 23, 2024

Thanks for the guide everyone!

A couple things:
If you're struggling with mandatory-script-verify-flag-failed check if you are passing to sendrawtransaction the hex from signrawtransactionwithwallet and not from createrawtransaction.

In createrawtransaction put what you got in the output minus how much you want to spend on gas. Put too little and you will overspend, put too much and your transaction will be stuck.

@AryanJ-NYC
Copy link

This is useful. However, you need to use the 'ord.exe dump' command instead of 'bitcoin-cli.exe listunspent' to obtain the raw transaction, as the raw transaction information obtained from these two methods is different. Once you have the raw transaction, you can use 'bitcoin-cli.exe importdescriptors' to import it into the Bitcoin Core wallet and then send it.

This worked for me!

ord wallet dump then using the descriptors array from the dump bitcoin-cli importdescriptors "[{\"desc\": \"rawtr(... (if using Windows remember to escape the inner quotes)

Then I just created a simple transaction and was able to sign it no problem.

bitcoin-cli createrawtransaction "[{\"txid\":\"...

bitcoin-cli signrawtransactionwithwallet 02000...

bitcoin-cli sendrawtransaction 02000...

Thanks @raphjaph and @huguojunsy !

I imported the descriptors using bitcoin-cli and was able to go back and use ord wallet --name walletName send without a hassle. No need to create the raw transaction or anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants