Skip to main content
edited tags; edited title
Link
Antoine Poinsot
  • 9.1k
  • 2
  • 18
  • 36

Signing a transaction with wpkh Sweep Taproot and tr descriptors - "Signingnative Segwit v0 coins in a single transaction failed"using Bitcoin Core wallet

added 55 characters in body
Source Link

My goal

Learn how to send an imported tr(wif) and wpkh() utxo in the same transaction.

What I've tried

I imported a WIF utxo containing a v1 segwit utxo.

bitcoin-cli importdescriptors '[{"desc":"tr(wifkey)#checksum", "timestamp":unixts}]'

I didn't know the checksum, but when importing I got an error that told me what the checksum should be, so I used that.

The balance showed up after import, I assume it was imported correctly.

Learned createrawtransaction, fundrawtransaction, signrawtransactionwithwallet are not acceptable for taproot. This was resulting in "Witness program was passed an empty witness".

It seems psbt commands are more appropriate. However, I couldn't figure out how to successfully sendsign with cli. I kept getting "complete": false returned.

I then tried bitcoin-qt and attempted to sweep funds to an address as a test. I received this: fail signing

While using bitcoin-cli and running bitcoin-cli listunspent I see:

[
  {
    "txid": "TX_1",
    "vout": x,
    "address": "ADDR_1",
    "label": "xxx1",
    "scriptPubKey": "44_LEGNTH_HEX_STRING",
    "amount": xxxxxx.xxxxxx,
    "confirmations": xxx,
    "spendable": true,
    "solvable": true,
    "desc": "wpkh([FINGERPRINT/84'/0'/0'/0/0]KEY)#CHECKSUM1",
    "parent_descs": [
      "wpkh(xpub_key/84'/0'/0'/0/*)#CHECKSUM-parent"
    ],
    "safe": true
  },
  {
    "txid": "TX_2",
    "vout": xx,
    "address": "ADDR_2",
    "label": "xxx2",
    "scriptPubKey": "68_LENGTH_HEX_STRING",
    "amount": xxxxxx.xxxxxx,
    "confirmations": xxxx,
    "spendable": true,
    "solvable": true,
    "desc": "tr([FINGERPRINT2]KEY2)#CHECKSUM2",
    "parent_descs": [
      "tr(KEY2)#CHECKSUM2"
    ],
    "safe": true
  }
]

Output sanitized

Question

  • What are the methodical steps starting with an imported WIF/taproot utxo + wpkh utxo and creating a signed tx to send funds?

My goal

Learn how to send an imported tr(wif) and wpkh() utxo in the same transaction.

What I've tried

I imported a WIF utxo containing a v1 segwit utxo.

bitcoin-cli importdescriptors '[{"desc":"tr(wifkey)#checksum", "timestamp":unixts}]'

I didn't know the checksum, but when importing I got an error that told me what the checksum should be, so I used that.

The balance showed up after import, I assume it was imported correctly.

Learned createrawtransaction, fundrawtransaction, signrawtransactionwithwallet are not acceptable for taproot. This was resulting in "Witness program was passed an empty witness".

It seems psbt commands are more appropriate. However, I couldn't figure out how to successfully send with cli.

I then tried bitcoin-qt and attempted to sweep funds to an address. I received this: fail signing

While using bitcoin-cli and running bitcoin-cli listunspent I see:

[
  {
    "txid": "TX_1",
    "vout": x,
    "address": "ADDR_1",
    "label": "xxx1",
    "scriptPubKey": "44_LEGNTH_HEX_STRING",
    "amount": xxxxxx.xxxxxx,
    "confirmations": xxx,
    "spendable": true,
    "solvable": true,
    "desc": "wpkh([FINGERPRINT/84'/0'/0'/0/0]KEY)#CHECKSUM1",
    "parent_descs": [
      "wpkh(xpub_key/84'/0'/0'/0/*)#CHECKSUM-parent"
    ],
    "safe": true
  },
  {
    "txid": "TX_2",
    "vout": xx,
    "address": "ADDR_2",
    "label": "xxx2",
    "scriptPubKey": "68_LENGTH_HEX_STRING",
    "amount": xxxxxx.xxxxxx,
    "confirmations": xxxx,
    "spendable": true,
    "solvable": true,
    "desc": "tr([FINGERPRINT2]KEY2)#CHECKSUM2",
    "parent_descs": [
      "tr(KEY2)#CHECKSUM2"
    ],
    "safe": true
  }
]

Output sanitized

Question

  • What are the methodical steps starting with an imported WIF/taproot utxo + wpkh utxo and creating a signed tx to send funds?

My goal

Learn how to send an imported tr(wif) and wpkh() utxo in the same transaction.

What I've tried

I imported a WIF utxo containing a v1 segwit utxo.

bitcoin-cli importdescriptors '[{"desc":"tr(wifkey)#checksum", "timestamp":unixts}]'

I didn't know the checksum, but when importing I got an error that told me what the checksum should be, so I used that.

The balance showed up after import, I assume it was imported correctly.

Learned createrawtransaction, fundrawtransaction, signrawtransactionwithwallet are not acceptable for taproot. This was resulting in "Witness program was passed an empty witness".

It seems psbt commands are more appropriate. However, I couldn't figure out how to successfully sign with cli. I kept getting "complete": false returned.

I then tried bitcoin-qt and attempted to sweep funds to an address as a test. I received this: fail signing

While using bitcoin-cli and running bitcoin-cli listunspent I see:

[
  {
    "txid": "TX_1",
    "vout": x,
    "address": "ADDR_1",
    "label": "xxx1",
    "scriptPubKey": "44_LEGNTH_HEX_STRING",
    "amount": xxxxxx.xxxxxx,
    "confirmations": xxx,
    "spendable": true,
    "solvable": true,
    "desc": "wpkh([FINGERPRINT/84'/0'/0'/0/0]KEY)#CHECKSUM1",
    "parent_descs": [
      "wpkh(xpub_key/84'/0'/0'/0/*)#CHECKSUM-parent"
    ],
    "safe": true
  },
  {
    "txid": "TX_2",
    "vout": xx,
    "address": "ADDR_2",
    "label": "xxx2",
    "scriptPubKey": "68_LENGTH_HEX_STRING",
    "amount": xxxxxx.xxxxxx,
    "confirmations": xxxx,
    "spendable": true,
    "solvable": true,
    "desc": "tr([FINGERPRINT2]KEY2)#CHECKSUM2",
    "parent_descs": [
      "tr(KEY2)#CHECKSUM2"
    ],
    "safe": true
  }
]

Output sanitized

Question

  • What are the methodical steps starting with an imported WIF/taproot utxo + wpkh utxo and creating a signed tx to send funds?
added 137 characters in body; edited title
Source Link

Taproot UTXO raw tx help Signing a transaction with wpkh and tr descriptors - "error": "Witness program was passed an empty witness""Signing transaction failed"

Learn how to send a taproot output via bitcoin core's bitcoin-clian imported tr(wif) and wpkh() utxo in the same transaction.

After:bitcoin-cli importdescriptors '[{"desc":"tr(wifkey)#checksum", "timestamp":unixts}]'

I didn't know the checksum, but when importing I got an error that told me what the checksum should be, so I used that.

The balance showed up after import, I assume it was imported correctly.

Learned createrawtransaction then, fundrawtransaction, I will attempt to sign with: signrawtransactionwithwallet but will get:are not acceptable for taproot. This was resulting in "Witness program was passed an empty witness".

{
  "hex": "hex_from_fund_command",
  "complete": false,
  "errors": [
    {
      "txid": "from_v1_taproot_txid",
      "vout": n,
      "witness": [
      ],
      "scriptSig": "",
      "sequence": seq_num_not_sure_if_this_is_sensitive,
      "error": "Witness program was passed an empty witness"
    }
  ]
}

Note: witness and scriptSigIt seems psbt commands are blankmore appropriate. I've tried not providing and not providing the prevtxsHowever, I couldn't figure out how to successfully send with no differencecli.

I'm unsure if I needthen tried bitcoin-qt and attempted to providesweep funds to an address. I received this: redeemScript orfail signing

While using bitcoin-cli and running witnessScriptbitcoin-cli listunspent, I'm unsure how to construct/find these. I see:

   [
  {
    "txid": "hex""TX_1", 
    "vout": x,
    "address": "ADDR_1",
   (string "label": "xxx1", 
 required) The transaction id"scriptPubKey": "44_LEGNTH_HEX_STRING",
    "amount": xxxxxx.xxxxxx,
    "vout""confirmations": nxxx,   
    "spendable": true,
    "solvable": true,
    "desc": "wpkh(numeric[FINGERPRINT/84'/0'/0'/0/0]KEY)#CHECKSUM1", 
 required) The output number"parent_descs": [
      "wpkh(xpub_key/84'/0'/0'/0/*)#CHECKSUM-parent"
   "scriptPubKey": "hex"], 
    "safe": (string,true
 required) script},
 key {
    "txid": "TX_2",
    "redeemScript""vout": "hex"xx, 
    "address": (string"ADDR_2", optional) 
 (required for P2SH) redeem"label": script"xxx2",
    "scriptPubKey": "68_LENGTH_HEX_STRING",
    "witnessScript""amount": "hex"xxxxxx.xxxxxx,  
   (string, optional) (required"confirmations": forxxxx,
 P2WSH or P2SH-P2WSH) witness"spendable": scripttrue,
    "solvable": true,
    "amount""desc": amount"tr([FINGERPRINT2]KEY2)#CHECKSUM2", 
    "parent_descs": [
      "tr(numericKEY2)#CHECKSUM2"
 or string, optional) (required],
 for Segwit inputs) the"safe": amounttrue
 spent }
]

Output sanitized

  • What are the methodical steps starting with an imported WIF/taproot utxo + wpkh utxo and ending withcreating a signed tx to send funds?

Taproot UTXO raw tx help - "error": "Witness program was passed an empty witness"

Learn how to send a taproot output via bitcoin core's bitcoin-cli.

After: createrawtransaction then fundrawtransaction, I will attempt to sign with: signrawtransactionwithwallet but will get:

{
  "hex": "hex_from_fund_command",
  "complete": false,
  "errors": [
    {
      "txid": "from_v1_taproot_txid",
      "vout": n,
      "witness": [
      ],
      "scriptSig": "",
      "sequence": seq_num_not_sure_if_this_is_sensitive,
      "error": "Witness program was passed an empty witness"
    }
  ]
}

Note: witness and scriptSig are blank. I've tried not providing and not providing the prevtxs with no difference.

I'm unsure if I need to provide redeemScript or witnessScript, I'm unsure how to construct/find these.

         "txid": "hex",             (string, required) The transaction id
         "vout": n,                 (numeric, required) The output number
         "scriptPubKey": "hex",     (string, required) script key
         "redeemScript": "hex",     (string, optional) (required for P2SH) redeem script
         "witnessScript": "hex",    (string, optional) (required for P2WSH or P2SH-P2WSH) witness script
         "amount": amount,          (numeric or string, optional) (required for Segwit inputs) the amount spent
  • What are the methodical steps starting with an imported WIF/taproot utxo and ending with a signed tx?

Signing a transaction with wpkh and tr descriptors - "Signing transaction failed"

Learn how to send an imported tr(wif) and wpkh() utxo in the same transaction.

bitcoin-cli importdescriptors '[{"desc":"tr(wifkey)#checksum", "timestamp":unixts}]'

I didn't know the checksum, but when importing I got an error that told me what the checksum should be, so I used that.

The balance showed up after import, I assume it was imported correctly.

Learned createrawtransaction, fundrawtransaction, signrawtransactionwithwallet are not acceptable for taproot. This was resulting in "Witness program was passed an empty witness".

It seems psbt commands are more appropriate. However, I couldn't figure out how to successfully send with cli.

I then tried bitcoin-qt and attempted to sweep funds to an address. I received this: fail signing

While using bitcoin-cli and running bitcoin-cli listunspent I see:

[
  {
    "txid": "TX_1", 
    "vout": x,
    "address": "ADDR_1",
    "label": "xxx1", 
    "scriptPubKey": "44_LEGNTH_HEX_STRING",
    "amount": xxxxxx.xxxxxx,
    "confirmations": xxx, 
    "spendable": true,
    "solvable": true,
    "desc": "wpkh([FINGERPRINT/84'/0'/0'/0/0]KEY)#CHECKSUM1", 
    "parent_descs": [
      "wpkh(xpub_key/84'/0'/0'/0/*)#CHECKSUM-parent"
    ], 
    "safe": true
  },
  {
    "txid": "TX_2",
    "vout": xx, 
    "address": "ADDR_2", 
    "label": "xxx2",
    "scriptPubKey": "68_LENGTH_HEX_STRING",
    "amount": xxxxxx.xxxxxx, 
    "confirmations": xxxx,
    "spendable": true,
    "solvable": true,
    "desc": "tr([FINGERPRINT2]KEY2)#CHECKSUM2", 
    "parent_descs": [
      "tr(KEY2)#CHECKSUM2"
    ],
    "safe": true
  }
]

Output sanitized

  • What are the methodical steps starting with an imported WIF/taproot utxo + wpkh utxo and creating a signed tx to send funds?
Source Link
Loading