Raw-Transaction

sendrawtransaction 後出現 bad-txns-nonstandard-inputs 錯誤

  • April 20, 2018

我在試圖發送原始交易的桌子上砸了頭,每次都得到同樣的錯誤bad-txns-nonstandard-inputs


所以,這就是我所做的:

  1. 獲取未使用的交易
bitcoin-cli listunspent
[
 {
   "txid": "txid_number_1",
   "vout": 1,
   "address": "address_1",
   "redeemScript": "redeemScript_1",
   "scriptPubKey": "scriptPubKey_1",
   "amount": 0.00024972,
   "confirmations": 31,
   "spendable": true,
   "solvable": true,
   "safe": true
 }
]
  1. 使用上面的 tx_id 和 vout 創建原始交易
bitcoin-cli createrawtransaction '[{"txid":"txid_number_1","vout":1}]' '{"address_to_sent":0.00002000}'

tx_id_as_hexstring =

02000000016affa8a874987f66be3ab4791b57042cbf0912088352ba0e3931b7b8b8f374c80100000000ffffffff01d0070000000000001976a9147c99343bb9cba8699e7f7b4f5552357e477dc76188ac00000000
  1. 簽署原始交易
bitcoin-cli signrawtransaction tx_id_as_hexstring
  1. 發送原始交易
bitcoin-cli sendrawtransaction tx_id_as_hexstring

error code: -26
error message:
64: bad-txns-nonstandard-inputs

我試圖用coinb.in創建相同的交易,但結果是一樣的。

我究竟做錯了什麼?


bitcoin-cli decoderawtransaction tx_id_as_hexstring

返回

{
 "txid": "txid_number_2",
 "hash": "txid_number_2",
 "version": 2,
 "size": 85,
 "vsize": 85,
 "locktime": 0,
 "vin": [
   {
     "txid": "txid_number_3",
     "vout": 1,
     "scriptSig": {
       "asm": "",
       "hex": ""
     },
     "sequence": 4294967295
   }
 ],
 "vout": [
   {
     "value": 0.00002000,
     "n": 0,
     "scriptPubKey": {
       "asm": "OP_DUP OP_HASH160 7c99343bb9cba8699e7f7b4f5552357e477dc761 OP_EQUALVERIFY OP_CHECKSIG",
       "hex": "76a9147c99343bb9cba8699e7f7b4f5552357e477dc76188ac",
       "reqSigs": 1,
       "type": "pubkeyhash",
       "addresses": [
         "address_to_sent"
       ]
     }
   }
 ]
}

您的交易未簽署。

首先,createrawtransaction給你的十六進製字元串不是 txid,而是交易本身。該交易不會儲存在您的錢包中。

當您將其傳遞給 時signrawtransaction,原始交易將被簽名並返回給您(它將是返回對像中hex欄位下的東西。同樣,此交易不會儲存在您的錢包中。該簽名交易是您傳遞給的sendrawtransaction,不是createrawtransaction給你的東西。

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