【问题标题】:How can I know the address that sent the BTC?我怎么知道发送 BTC 的地址?
【发布时间】:2013-12-29 04:21:44
【问题描述】:

我与 bitcoind 进行了交易。我从地址 A 向地址 B 汇款。

在持有地址 B 的客户端,当我发出“gettransaction”传递事务 id 时,它会显示类型(接收)、接收地址和金额等信息。但它并没有说明 BTC 是从哪里来的。

我如何知道哪个地址发送了 BTC?

附带问题:如果我将 BTC 发送回这个地址,它会像“下放”一样运作吗? (这是我的目标)

【问题讨论】:

标签: bitcoin bitcoind


【解决方案1】:

来自Bitcoin stackexchange,(伪代码)

txid = <relevant transaction id>
addresses = []
raw_tx = decoderawtransaction(getrawtransaction(txid))
for(input in raw_tx['vin']) {
  input_raw_tx = decoderawtransaction(getrawtransaction(input['txid']))
  addresses.push(input_raw_tx['vout'][input['vout']]['scriptPubKey']['addresses'][0])
}

【讨论】:

  • 补充一点,我只想说这对使用coinbase的人不起作用。 Coinbase 实际上有 2 个输出。一个是该人的真实地址,另一个是 coinbase 的 tx id 地址。如果您向 tx-id 发送一个,那么该人将永远不会收到它。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-08-25
  • 1970-01-01
  • 1970-01-01
  • 2012-01-18
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多