Skip to content

PSBT Taproot Input Validation Issue #1934

@timechainz

Description

@timechainz

Hello again,

I have updated to 6.1.2 and am now seeing some new input validation errors on known valid inputs. I have included an example which was signed in bitcoin-cli

bitcoin-cli walletprocesspsbt "{unsigned}" true "SINGLE|ANYONECANPAY" false false

which results in the following signed psbt:

{
  "tx": {
    "txid": "4810ff15141bd2d7fca4dc4e8fc2f361c716d721f2e221889a2639459d180fc4",
    "hash": "4810ff15141bd2d7fca4dc4e8fc2f361c716d721f2e221889a2639459d180fc4",
    "version": 2,
    "size": 94,
    "vsize": 94,
    "weight": 376,
    "locktime": 0,
    "vin": [
      {
        "txid": "59edb28a4c0c6a9fb319ae6f4e8d5f979b44e786fa127ad012d1eeda83cd944e",
        "vout": 0,
        "scriptSig": {
          "asm": "",
          "hex": ""
        },
        "sequence": 4294967295
      }
    ],
    "vout": [
      {
        "value": 9.90000000,
        "n": 0,
        "scriptPubKey": {
          "asm": "1 2252337d1f9f9485984f27b00fdbfed4df3822e6d9ffbaa0ea81e560bcefd5a6",
          "desc": "rawtr(2252337d1f9f9485984f27b00fdbfed4df3822e6d9ffbaa0ea81e560bcefd5a6)#tfj37s9y",
          "hex": "51202252337d1f9f9485984f27b00fdbfed4df3822e6d9ffbaa0ea81e560bcefd5a6",
          "address": "bc1pyffrxlgln72gtxz0y7cqlkl76n0nsghxm8lm4g82s8jkp0806knqclmd55",
          "type": "witness_v1_taproot"
        }
      }
    ]
  },
  "global_xpubs": [
  ],
  "psbt_version": 0,
  "proprietary": [
  ],
  "unknown": {
  },
  "inputs": [
    {
      "witness_utxo": {
        "amount": 0.00010000,
        "scriptPubKey": {
          "asm": "1 2252337d1f9f9485984f27b00fdbfed4df3822e6d9ffbaa0ea81e560bcefd5a6",
          "desc": "rawtr(2252337d1f9f9485984f27b00fdbfed4df3822e6d9ffbaa0ea81e560bcefd5a6)#tfj37s9y",
          "hex": "51202252337d1f9f9485984f27b00fdbfed4df3822e6d9ffbaa0ea81e560bcefd5a6",
          "address": "bc1pyffrxlgln72gtxz0y7cqlkl76n0nsghxm8lm4g82s8jkp0806knqclmd55",
          "type": "witness_v1_taproot"
        }
      },
      "non_witness_utxo": {
        "txid": "59edb28a4c0c6a9fb319ae6f4e8d5f979b44e786fa127ad012d1eeda83cd944e",
        "hash": "59edb28a4c0c6a9fb319ae6f4e8d5f979b44e786fa127ad012d1eeda83cd944e",
        "version": 1,
        "size": 94,
        "vsize": 94,
        "weight": 376,
        "locktime": 0,
        "vin": [
          {
            "txid": "5d54d7f8e1c17bcf29e5765ab0f40af873a55313c50245ec7eba41427c9afff1",
            "vout": 0,
            "scriptSig": {
              "asm": "",
              "hex": ""
            },
            "sequence": 4294967293
          }
        ],
        "vout": [
          {
            "value": 0.00010000,
            "n": 0,
            "scriptPubKey": {
              "asm": "1 2252337d1f9f9485984f27b00fdbfed4df3822e6d9ffbaa0ea81e560bcefd5a6",
              "desc": "rawtr(2252337d1f9f9485984f27b00fdbfed4df3822e6d9ffbaa0ea81e560bcefd5a6)#tfj37s9y",
              "hex": "51202252337d1f9f9485984f27b00fdbfed4df3822e6d9ffbaa0ea81e560bcefd5a6",
              "address": "bc1pyffrxlgln72gtxz0y7cqlkl76n0nsghxm8lm4g82s8jkp0806knqclmd55",
              "type": "witness_v1_taproot"
            }
          }
        ]
      },
      "sighash": "SINGLE|ANYONECANPAY",
      "taproot_key_path_sig": "643034e6a8dd130e0563ee010f48a61ed0ce4e3b32fae84c76c9478f4cc4a26643a85f8596b9c1556b74a61e6b9056fe5a2a6bb6a5da961864c946bdd4b4eb0383",
      "taproot_internal_key": "8ee617c48a7238c553604be5df980389d0a6fef508099cae34d64a68fcfd7710"
    }
  ],
  "outputs": [
    {
      "taproot_internal_key": "8ee617c48a7238c553604be5df980389d0a6fef508099cae34d64a68fcfd7710"
    }
  ],
  "fee": -9.89990000
}

Sparrow Wallet also confirms this is a valid signature. However, bitcoinjs-lib appears to fail in the validator. I have created a test case which demonstrates this.

https://github.com/timechainz/bitcoinjs-lib-psbt-validation/blob/db3d3bd20f57a89f58f59fa78d641001c6f50fcc/validate-taproot-input.js#LL33C1-L33C1

Any ideas would be appreciated. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions