Bitcoin Forum
July 10, 2024, 03:42:58 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Getting/building witness script to sign Taproot Multisig transaction  (Read 76 times)
andy912 (OP)
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile
August 04, 2023, 04:30:21 PM
 #1

Hi. We are trying to start using a multisig taproot address in regtest. We can create the address, and it seems to be a valid one. However, when we try to spend funds received in said address, we run into a problem: the witness script we are trying to use is apparently not valid. We are trying to build the witness script this way:

        address_info = self.call("getaddressinfo", multisig_address)
        witness_program_hex = address_info["witness_program"]
        witness_version = address_info['witness_version']

        witness_script = bytes([witness_version]) + binascii.unhexlify(witness_program_hex)
        witness_script = binascii.hexlify(witness_script).decode()

(this is basically Copilot code)

where multisig_address is the created taproot address. However, when we try to sign the transaction using signrawtransactionwithkey, we receive an error:  'Witness program was passed an empty witness'. We are not 100% sure exactly what the error is, but we believe it is related to the witness script not being valid, since the "decodescript" command with witness_script gives us:

{'asm': '85 OP_UNKNOWN [error]',
 'desc': 'raw(0155ee431293f4e29678b294e48f96d5ac47678ccba2d7c33783f99014ddfa8fcf)#0tv3kpc7',
 'type': 'nonstandard'}

Again, any advice or guidance would be appreciated.
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3444
Merit: 6785


Just writing some code


View Profile WWW
August 04, 2023, 04:53:34 PM
 #2

signrawtransactionwithkey doesn't know how to sign for complex taproot scripts.

For now, the only way to sign such transaction is to have imported the descriptor with at least one private key, and then use the PSBT RPCs.

The next release will have a descriptorprocesspsbt that will allow for the keys to be provided in a descriptor external to the wallet.

andy912 (OP)
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile
August 04, 2023, 07:04:19 PM
 #3

signrawtransactionwithkey doesn't know how to sign for complex taproot scripts.

For now, the only way to sign such transaction is to have imported the descriptor with at least one private key, and then use the PSBT RPCs.

The next release will have a descriptorprocesspsbt that will allow for the keys to be provided in a descriptor external to the wallet.

thanks! so basically, if we want to use taproot multisig address, we are forced to use psbts instead of regular transactions, good to know.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!