离线签署比特币交易

sign bitcoin transaction offline

如何离线签署这笔交易?

收到的比特币:

https://www.blocktrail.com/tBTC/tx/6971035c95e8997e55dfe18c2940edeb4137b3e41b33af478b9b5512068c5164

TXID= 6971035c95e8997e55dfe18c2940edeb4137b3e41b33af478b9b5512068c5164

数量:10 收到地址:mgnKCYotzvX9gK36vZEd86WJMN8bdtB1sF

createrawtransaction '[{"txid":"6971035c95e8997e55dfe18c2940edeb4137b3e41b33af478b9b5512068c5164","vout":1}]' '{"2N4ofFPCXk7NMRduBc59bPnM2CksXdk9964":0.1}'

returns:

010000000164518c0612559b8b47af331be4b33741ebed40298ce1df557e99e8955c0371690100000000ffffffff01809698000000000017a9147ecbc7d9cbb793ffb9a2905876c49f19cef8f75a8700000000

对其进行解码(以获得 vout 十六进制)

decoderawtransaction 010000000164518c0612559b8b47af331be4b33741ebed40298ce1df557e99e8955c0371690100000000ffffffff01809698000000000017a9147ecbc7d9cbb793ffb9a2905876c49f19cef8f75a8700000000

returns:

{
    "txid" : "04c557d38051d1450ff501520b1d7895c127543b435ee34e8bb76da4139f2e4b",
     "version" : 1,
     "locktime" : 0,
     "vin" : [
         {
             "txid" : "6971035c95e8997e55dfe18c2940edeb4137b3e41b33af478b9b5512068c5164",
             "vout" : 1,
             "scriptSig" : {
                 "asm" : "",
                 "hex" : ""
             },
             "sequence" : 4294967295
         }
     ],
     "vout" : [
         {
             "value" : 0.10000000,
             "n" : 0,
             "scriptPubKey" : {
                 "asm" : "OP_HASH160 7ecbc7d9cbb793ffb9a2905876c49f19cef8f75a OP_EQUAL",
                 "hex" : "a9147ecbc7d9cbb793ffb9a2905876c49f19cef8f75a87",
                 "reqSigs" : 1,
                 "type" : "scripthash",
                 "addresses" : [
                     "2N4ofFPCXk7NMRduBc59bPnM2CksXdk9964"
                 ]
             }
         }
     ]
  }

获取地址私钥

dumpprivkey mgnKCYotzvX9gK36vZEd86WJMN8bdtB1sF

returns:

XXX

签名:

signrawtransaction "010000000164518c0612559b8b47af331be4b33741ebed40298ce1df557e99e8955c0371 690100000000ffffffff01809698000000000017a9147ecbc7d9cbb793ffb9a2905876c49f19cef8f75a8700000000" "[{\"txid\":\"6971035c95e8997e55dfe18c2940edeb4137b3e41b33af478b9b5512068c5164\",\"vout\":1,\"scriptPubKey\":\"a9147ecbc7d9cbb793ffb9a2905876c49f19cef8f75a87\", ,\"redeemScript\":\""]" "ALL"

运行 这个 returns 一直只是我服务器上的一个输入。当我按下回车键时,什么也没有发生:

在您 55c0371 6901000 之间的原始交易中有一个 space。去掉它。另外,它应该就这么简单:

signrawtransaction 010000000164518c0612559b8b47af331be4b33741ebed40298ce1df557e99e8955c0371690100000000ffffffff01809698000000000017a9147ecbc7d9cbb793ffb9a2905876c49f19cef8f75a8700000000

您不需要其他参数,因为它使用任何可用的参数。这个question is a good reference.

您没有在签名交易中包含必需的参数:amount 试试这个例子,并将 value_from_transaction 更改为您交易中的值) from listunspent:

signrawtransaction "010000000164518c0612559b8b47af331be4b33741ebed40298ce1df557e99e8955c0371
690100000000ffffffff01809698000000000017a9147ecbc7d9cbb793ffb9a2905876c49f19cef8f75a8700000000"
 "[{\"txid\":\"6971035c95e8997e55dfe18c2940edeb4137b3e41b33af478b9b5512068c5164\",\"vout\":1,\"scriptPubKey\":\"a9147ecbc7d9cbb793ffb9a2905876c49f19cef8f75a87\",
 \"value\": value_from_transaction]"