Transactions

為什麼在比特幣客戶端發件人地址是“未定義”

  • February 20, 2014

儘管 bockexplorer 允許瀏覽交易詳細資訊並發現發件人地址,但為什麼通過比特幣客戶端,發件人地址仍然“未定義”。

是否可以通過原始比特幣 API 發現發件人地址?

對的,這是可能的。您可以使用getrawtransaction <txid>decoderawtransaction <output from getrawtransaction>。例如:

getrawtransaction 6dcaa5e7f412a9c14d0f87a2660907c37de5abac31823c22fba978b6fd616313
010000000105bbdd4f69478586a192f4904f51229690ae7f17703a8410f983c072658eb611c60200006a47304402200c64714e605c1ad63e5a52b2d4a734c3a6174e2d6a4e0aa7fcff99ec8c1451a902202005bed9f7f2969bf86989cbe295aab3d51ba77b2faf9def6010b04f24183e450121024209026dda4b136d55f92e36fb4fdf23a8beb129d872838a122a9d1e55c9f838ffffffff0240f3ad00000000001976a91452bf43c4d410b5971a37c304ba96b53dc5da7f5f88acc8a10000000000001976a914bcccc2b493e31afd0767448c8f7d7d5d6823164888ac00000000

decoderawtransaction 010000000105bbdd4f69478586a192f4904f51229690ae7f17703a8410f983c072658eb611c60200006a47304402200c64714e605c1ad63e5a52b2d4a734c3a6174e2d6a4e0aa7fcff99ec8c1451a902202005bed9f7f2969bf86989cbe295aab3d51ba77b2faf9def6010b04f24183e450121024209026dda4b136d55f92e36fb4fdf23a8beb129d872838a122a9d1e55c9f838ffffffff0240f3ad00000000001976a91452bf43c4d410b5971a37c304ba96b53dc5da7f5f88acc8a10000000000001976a914bcccc2b493e31afd0767448c8f7d7d5d6823164888ac00000000
{
"txid" : "6dcaa5e7f412a9c14d0f87a2660907c37de5abac31823c22fba978b6fd616313",
"version" : 1,
"locktime" : 0,
"vin" : [{
   "txid" : "11b68e6572c083f910843a70177fae909622514f90f492a1868547694fddbb05",
   "vout" : 710,
   "scriptSig" : {
       "asm" : "304402200c64714e605c1ad63e5a52b2d4a734c3a6174e2d6a4e0aa7fcff99ec8c1451a902202005bed9f7f2969bf86989cbe295aab3d51ba77b2faf9def6010b04f24183e4501 024209026dda4b136d55f92e36fb4fdf23a8beb129d872838a122a9d1e55c9f838",
       "hex" : "47304402200c64714e605c1ad63e5a52b2d4a734c3a6174e2d6a4e0aa7fcff99ec8c1451a902202005bed9f7f2969bf86989cbe295aab3d51ba77b2faf9def6010b04f24183e450121024209026dda4b136d55f92e36fb4fdf23a8beb129d872838a122a9d1e55c9f838"
   },
   "sequence" : 4294967295
}],
"vout" : [{
   "value" : 0.11400000,
   "n" : 0,
   "scriptPubKey" : {
       "asm" : "OP_DUP OP_HASH160 52bf43c4d410b5971a37c304ba96b53dc5da7f5f OP_EQUALVERIFY OP_CHECKSIG",
       "hex" : "76a91452bf43c4d410b5971a37c304ba96b53dc5da7f5f88ac",
       "reqSigs" : 1,
       "type" : "pubkeyhash",
       "addresses" : ["18YXY35z1HgMoKqBFgiShGuqnhR7zdwwC6"]
   }
}, {
   "value" : 0.00041416,
   "n" : 1,
   "scriptPubKey" : {
       "asm" : "OP_DUP OP_HASH160 bcccc2b493e31afd0767448c8f7d7d5d68231648 OP_EQUALVERIFY OP_CHECKSIG",
       "hex" : "76a914bcccc2b493e31afd0767448c8f7d7d5d6823164888ac",
       "reqSigs" : 1,
       "type" : "pubkeyhash",
       "addresses" : ["1JDHL5WhHNrg4HrNksnF7S1ChGVYYUkjVC"]
   }
}]
}

vin[0].scriptSig.asm。它包含 2 個值:3044...45010242...f838。第二個值是壓縮的公鑰。現在您可以使用它來計算地址:RIPEMD160(SHA256(pubkey)) -> Base58。但是你必須自己做。

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