lightninglabs / chantools

A loose collection of tools all somehow related to lnd and Lightning Network channels.
MIT License
222 stars 32 forks source link

Error: funding output script does not match UTXO #73

Closed grnqrtr closed 1 year ago

grnqrtr commented 1 year ago

I believe I have "funds locked in a funding multisig output that never resulted in a proper channel" and am therefore trying to use rescuefunding, but I may not be doing it right. All I get is "Error: funding output script does not match UTXO."

This is the funding transaction: d89373cf20693b1274882480dafbe8363b4334984ea82975ba383e63052c204d

I am running this: chantools rescuefunding --confirmedchannelpoint d89373cf20693b1274882480dafbe8363b4334984ea82975ba383e63052c204d:0 --remotepubkey 030c3f19d742ca294a55c00376b3b355c3c90d61c6b6b39554dbc7ac19b141c14f --sweepaddr bc1qmyaddyhere --feerate 30

I got in this situation by accidentally broadcasting this transaction from Electrum, when I meant to only sign the transaction and let balanceofsatoshis tool's bos open open the channel. I see no indication of a "pending channel" in LND, just have this confirmed transaction.

Thank you for any help in advance!

ellemouton commented 1 year ago

I think you are missing the --localkeyindex flag which is required if you are specifying the pub keys manually (if you leave it out then it likely defaults to 0)

If you have your channel db still then the other option is to use that instead of specifying the keys. Something like:

chantools rescuefunding \
        --channeldb ~/.lnd/data/graph/mainnet/channel.db \
        --dbchannelpoint xxxxxxx:xx \
        --sweepaddr bc1qxxxxxxxxx \
        --feerate 10
grnqrtr commented 1 year ago

I've tried with --channeldb but I get Error: error loading pending channel d89373cf20693b1274882480dafbe8363b4334984ea82975ba383e63052c204d:0 from DB: channel not found

This is exactly what I tried: chantools rescuefunding --channeldb /mnt/hdd/lnd/data/graph/mainnet/channel.db --dbchannelpoint d89373cf20693b1274882480dafbe8363b4334984ea82975ba383e63052c204d:0 --sweepaddr bc1qmyaddyhere --feerate 30

I assumed that maybe the channel isn't found in the database because LND doesn't seem to know anything about a channel.

bos@raspiblitz:~$ lncli listchannels
{
    "channels": [
    ]
}
bos@raspiblitz:~$ lncli pendingchannels
{
    "total_limbo_balance": "0",
    "pending_open_channels": [
    ],
    "pending_closing_channels": [
    ],
    "pending_force_closing_channels": [
    ],
    "waiting_close_channels": [
    ]
}

If I were to try again with the way I did it the first time, how would I know what to put for --localkeyindex? I'm not sure what to put there.

Thanks for your help!

guggero commented 1 year ago

How was the channel created in the first place? Did you have any channels before this one? Anything in lncli closedchannels that might correlate with the channel?

You can basically go ahead and try indexes from 0 to xxx, basically until you don't get an error anymore. But since that can take a while, it's probably easier to do some research first.

grnqrtr commented 1 year ago

This is literally the very first channel that I tried to open on a new node.

I got in this situation by accidentally broadcasting this transaction from Electrum, when I meant to only sign the transaction and let balanceofsatoshis tool's bos open open the channel. (I have done this many times in the past, but just started a new node after almost a year and overlooked the Electrum process.)

Nothing in lncli closedchannels channels.

Since it's the first and only channel I've attempted to open, my best guess would be that the localkeyindex should be 0, but I have tried 0, 1, 2, and all give funding output script does not match UTXO

Maybe this is a case that is unrecoverable. Even if I could figure this part out, I don't know that I could get the other party to run commands from their side for me.

guggero commented 1 year ago

So you used the bos tool to open a channel and the tool gave you a PSBT that you then signed and broadcast in Electrum? Do you still have that original PSBT?

Also, the remote pubkey, is that the remote node's identity key or their multisig key for this particular channel? The node pubkey won't work, every channel gets a unique key from both channel participants...

grnqrtr commented 1 year ago

The bos tool doesn't give you a PSBT, it tells you to create and sign a transaction sending bitcoin to a specific address (in this case bc1qm80rcumyhejefu43nds90a8ucww0q8ttrj7nrt7tzges79utgzuqlrj3y2). It then tells you not to broadcast the transaction, but to instead let the bos tool broadcast the transaction for you. So you are supposed to copy and paste the signed transaction into the bos tool, which I assume then broadcasts it in a certain timing. So I don't have a PSBT.

For the --remotepubkey I assumed that was the publicly available identity key that can be looked up at sites like 1ML.com. I don't know how I would find their unique multisig key, I suppose a PSBT would be needed for that.

Sounds like I am missing several key pieces of information required to recover the funds. I only tried this because the creator of bos said I could try chantools. But I think I'm going to count this as an expensive lesson in not being dumb.

Thanks for trying to help.

guggero commented 1 year ago

Ah, I see. I was hoping if there was a PSBT involved in the process it would maybe contain some useful information. But in this case I think you need to go through the Zombie Channel Recovery Process. The "match" file would look like this in your case:

{
    "node1": {
        "identity_pubkey": "<your_node_identity_public_key>",
        "contact": "<some contact information to reach you>"
    },
    "node2": {
        "identity_pubkey": "030c3f19d742ca294a55c00376b3b355c3c90d61c6b6b39554dbc7ac19b141c14f",
        "contact": "bitrefill"
    },
    "channels": [
        {
            "short_channel_id": "0",
            "chan_point": "d89373cf20693b1274882480dafbe8363b4334984ea82975ba383e63052c204d:0",
            "address": "bc1qm80rcumyhejefu43nds90a8ucww0q8ttrj7nrt7tzges79utgzuqlrj3y2",
            "capacity": 1390184
        }
    ]
}

You will need Bitrefill's cooperation in any case though. I would try reaching out to their customer service. Let me know if they don't react and I'll try reaching out myself.

I'm closing the issue since there's nothing wrong with chantools as far as I can tell. But feel free to continue the thread if you have further questions.

grnqrtr commented 1 year ago

Thanks a lot @guggero!

I appreciate your time and help in laying that all out for me. I will try the Zombie channel route. I was planning to reach out to Bitrefill's customer service once I figured out what I needed to do from my side. I don't have a lot of hope in their cooperation, but I will try!