btcsuite / btcwallet

A secure bitcoin wallet daemon written in Go (golang)
ISC License
1.13k stars 575 forks source link

spend a taproot script-path input owned by the wallet #931

Closed louisinger closed 2 months ago

louisinger commented 3 months ago

Is it possible to add a script-path signature to psbt using SignTransaction RPC ?

guggero commented 3 months ago

I think the RPCs of the wallet have not been touched in a very long time and are therefore not updated to deal with P2TR script spends. And because the wallet doesn't have the concept of descriptors (you can simply import a P2TR script key, nothing more), you'll need to do the signing manually anyway. You can find some examples of how we do that in lnd in the integration tests: https://github.com/lightningnetwork/lnd/blob/8da68bb7dbf0423bb8c9e13dcfa982f80a9aabe3/itest/lnd_taproot_test.go#L1096

louisinger commented 3 months ago

Does it mean that I can't sign psbt with tapscript using a btcwallet ? Are u suggesting to use lnd instead ?

guggero commented 3 months ago

I'm saying that btcwallet is mostly used as a Go library and not as a standalone tool. So most functionality is only available in code and not in RPCs. Depending on what you want to build, you either use btcwallet as a code library for your project. Or you use lnd as a more feature complete wallet if you're mostly looking to use RPC calls to interact with a wallet.

Roasbeef commented 2 months ago

You can use lnd's SignPsbt call for this: https://lightning.engineering/api-docs/api/lnd/wallet-kit/sign-psbt. If you give it valid psbt (you can also use FundPsbt), it'll handle all the signing for you.