Blockstream / lwk

Liquid Wallet Kit
Other
62 stars 24 forks source link

Add custom blinding key support #17

Closed dsbaars closed 7 months ago

dsbaars commented 7 months ago

I have used BTCPayServer to receive payments on confidential liquid addresses, the NBXplorer docs describe how it creates blinding keys.

I do have the blinding keys but there is currently no way to set this for a transaction, so I am not able to spend it.

2024-04-23T15:33:48.786803Z  INFO lwk_wollet::clients: [elements]<txid>:0 cannot unblind, ignoring (could be sender messed up with the blinding process)

An alternative way I could spend is using elements-cli createrawtransaction after importing the blinding keys and rescanning the wallet. Unfortunately the hex-output of createrawtransaction is not comptabile with the lwk_cli signer sign command, and I am not able to sign with elements-cli itself since the wallet belongs to a hardware signer.

LeoComandini commented 7 months ago

The blinding key derivation standard by NBXplorer is not standard, so we are not going to support it as there is no way of expressing it as a ELIP150 CT Descriptor.

However, lwk_cli should be able to make Jade sign a transaction sweeping funds from those utxos.

You should try to use

dsbaars commented 7 months ago

Thanks this works, the transaction shows correctly on the Jade but the lwk_cli signer sign command provides no output and it does not seem to broadcast anything neither.

When I check the PSET with lwk_cli wallet pset-details I get the following error:

{
  "code": -32005,
  "data": null,
  "message": "Wollet Error: Input #0 belongs to the wallet but cannot be unblinded"
}

And lwk_cli wallet broadcast gives the following error:

{
  "code": -32005,
  "data": null,
  "message": "Wollet Error: Missing pubkey for a pkh/wpkh at index 0"
}
LeoComandini commented 7 months ago

Thanks this works, the transaction shows correctly on the Jade

This seems promising.

lwk_cli signer sign command provides no output and it does not seem to broadcast anything neither.

That is quite odd, lwk_cli signer sign should output the signed PSET or an error.

(but it does not broadcast)

lwk_cli wallet pset-details

That is the expected error if you are using a wallet with the same scriptpubkeys but different blinding keys. You should be able to parse if you specify an unrelated wallet.

And lwk_cli wallet broadcast gives the following error:

It might be that the PSET passed in is not signed yet?

RCasatta commented 7 months ago

lwk_cli signer sign command provides no output and it does not seem to broadcast anything neither.

are you confirming the transaction on the Jade ?

dsbaars commented 7 months ago

Thanks a lot for your help @LeoComandini For others finding this issue when they need similar help:

I will close this issue since it is not possible to express the NBXplorer way of blinding keys.