Raw-Transaction

DLC 資金交易錯誤:非強制腳本驗證標誌(見證程序雜湊不匹配)(程式碼 64)

  • November 27, 2021

我正在嘗試為 DLC 建構資金交易。到目前為止,我已經創建了以下交易,該交易對 1000/1000 sats 的本地/遠端抵押品的投注條目和二進制贏/輸全有或全無結果進行編碼。

據我所知,交易在輸入/輸出地址等方面是準確的,並且提供了簽名(見下文),但我收到了這個錯誤:

non-mandatory-script-verify-flag (Witness program hash mismatch) (code 64)

嘗試廣播交易時。十六進制:

<txhash>

我還嘗試使用另一個服務進行廣播,該服務有一個更具描述性的錯誤,所以我也會在這裡發布:

Error validating transaction: Error running script for input 0 referencing <hash> at 1: incorrect number of witness items for version 0 witness program of length 20.

我不太確定如何解釋這個錯誤,也不確定如何進行調試,所以任何指針都會非常感激。在 StackExchange 上搜尋這些錯誤似乎並沒有提供任何相關的結果,除了這個答案。用於簽署交易的不正確的私鑰是否可能導致見證程序雜湊不匹配?(正如Andrew Chow 所建議的那樣)。

{
   "addresses": [
       "<addrs>",
       "<addrs>",
       "<addrs>",
       "<addrs>",
       "<addrs>"
   ],
   "block_height": -1,
   "block_index": -1,
   "confirmations": 0,
   "double_spend": false,
   "fees": <amt>,
   "hash": "d6c6069357ed571c91294d736f44db57a22b1e422ebd6947cc912ef8f498f8ca",
   "inputs": [
       {
           "addresses": [
               "<addrs>"
           ],
           "age": 00,
           "output_index": 1,
           "output_value":<amt>,
           "prev_hash": "<hash>",
           "script_type": "pay-to-witness-pubkey-hash",
           "sequence": 4294967295
       },
       {
           "addresses": [
               "<addrs>"
           ],
           "age": 00,
           "output_index": 1,
           "output_value": <amt>,
           "prev_hash": "f174bf45da30a7a43360c37fde80955ad3e0b45e6913b0aab1314fdfabe2e0c7",
           "script_type": "pay-to-witness-pubkey-hash",
           "sequence": 4294967295,
           "witness": [
               "304402207bb9cffa80ee109758b6c0c74ac2d5745cb42bb06c76b0cf7a86e64cc4159bba0220351f1ae477c5703c2990336a2888a4ff1c52e3d01897931ba3b48fce694797c101",
               "022b89efbabb2ab7f712912c399ef161216b07d101fa95a3ffbb4ce675548b64e1"
           ]
       }
   ],
   "outputs": [
       {
           "addresses": [
               "<addrs>"
           ],
           "script": "002002349639c02aee43f4474e269bc03860d0290f7f3fc15f0bcea54b2025dffae8",
           "script_type": "pay-to-witness-script-hash",
           "value": <amt>
       },
       {
           "addresses": [
               "<addrs>"
           ],
           "script": "00147bd21f276fa2e6a81a69a1d89c4217876810bf98",
           "script_type": "pay-to-witness-pubkey-hash",
           "value": <amt>
       },
       {
           "addresses": [
               "<addrs>"
           ],
           "script": "00148e0892c30b293a2ae1fa90988cc6004f03eadc1c",
           "script_type": "pay-to-witness-pubkey-hash",
           "value": <amt>
       }
   ],
   "preference": "low",
   "received": "<datetime>",
   "relayed_by": "<ip>",
   "size": <size>,
   "total": <amt>,
   "ver": 2,
   "vin_sz": 2,
   "vout_sz": 3,
   "vsize": <vsize>
}

如果您查看輸入 0,它不包含witness元素,這意味著它沒有簽名。您需要對兩個輸入進行簽名才能進行廣播。

引用自:https://bitcoin.stackexchange.com/questions/110206