Multi-Signature
P2SH-Multisig 交易未通過
我有一些資金被鎖定在需要 2-of-3 簽名的測試網 P2SH 地址中。
這是地址:
2NEKRqUqoDtsELzpBa5wuWEiJeVbio5cSa2
和 3 個鍵:
#1 - cU1mPkyNgJ8ceLG5v2zN1VkZcvDCE7VK8KrnHwW82PZb6RCq7zRq #2 - cPTFNJD7hgbZTqNJgW89HABGtRzYo5aLpCQKvmNdtRNGWo49NAky #3 - cNUe2L9CNJZoedMU8YNrzRuxFc56dvMjFxzK4mTsSGhXwbidAyog
多重簽名腳本是:
OP_2 <Key #1 length> <Key #1 PubKey> <Key #2 length> <Key #2 PubKey> <Key #3 length> <Key #3 PubKey> OP_3 OP_CHECKMULTISIG
我還創建了一個在此地址中花費資金的交易,但是我無法廣播此交易,因為它給出了錯誤
Mempool accept test failed: 16: mandatory-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation)
。這是交易:
01000000 //Version 01 //Input Count e29cf4dad1c36d5e316bac18edfc665f8323050d7260b94b72777b12a4eecba0 //TXID 00000000 //Out index fb //ScriptSig size 0046304302202848f7f4087da2e01adcaca2da30fe9004861ca284efffcae6b49d2cf9f239b2021f7794619a597f5847e92fef4bdebeba42b91544d267220bfe8e2824f3ef74190147304402201dd2ba26a81ac13da8ecd5d967f9394ec0c5356e6d303adeb71f84bd2ee62d0202203632bfc457d778a71ca72007cce9d0e6f92a1bf8226e010fc9e59e0572afe454014c695221034d0953ff49ed8e98cce462e9ecd3ead6cf641b299ec500329dc153443d4cced721024be733c116a4ca8bd7dd2aafa6fb6877d153962e0f6a21709fab771ce6572b4821038c6a2191a2e77ede17063d8633fb9e08dba8535fd1dd99377b7dc9b6bea89efe53ae //ScriptSig (2 signatures followed by the redeem script) ffffffff //Sequence 01 //Output count 204e000000000000 //Output Value 16 //ScriptPubKey size 001491c6c31a62b37a16447ccf44224eb1ab78ca0299 //scriptPubKey (Segwit P2PKH) 00000000 //Locktime
以下是我為輸入簽名所採取的步驟:
1. Hash the input with the scriptPubKey as the scriptSig and SigHash ALL appended 2. Sign the hashed signature with Key #1 and Key #2 3. Construct the scriptSig by concatenating the 2 signatures and redeem script 4. Place the scriptSig in the scriptSig field of the input
我不確定我是否遺漏了一個步驟或錯誤地完成了一個步驟。我所做的步驟與簽署我可以成功創建的 P2PKH 輸入的步驟幾乎相同,只是使用不同的 scriptSigs。
任何幫助,將不勝感激。
我發現我哪裡出錯了。
在為輸入創建 hashpreimage 時,我將輸入的 scriptPubKey 而不是redeemScript 替換為scriptSig。