Block number + bitcoin address -> Find transactions with bitcoind?

0

If I have a block number and a bitcoin address -> Can I list all transactions for this address with an bitcoind command? Or mutliple commands?

jan

Posted 2018-02-07T20:45:27.193

Reputation: 151

Without using any programming language?Adam 2018-02-07T20:48:48.327

Answers

1

some pseudo-code to work with the Bitcoin-Core 0.16 (if there are simpler ways pls lmk).

suppose you all have is height and addr

hash = getblockhash(height)
block = getblock(hash)

for txid in block[‘txid’]:

  tx = getrawtransaction(txid)

  for vi in tx['vin']:
    original_tx = getrawtransaction(vi['txid'])
    for vo in original_tx['vout']:
      if vo['n'] == vi['vout'] and addr in vo['scriptPubKey']['addresses']:
        print('this tx is relevant')

  for vo in tx['vout']:
    if addr in vo['scriptPubKey']['addresses']:
      print('this tx is relevant')

Will Gu

Posted 2018-02-07T20:45:27.193

Reputation: 318

0

Possible duplicate of How to get an address's balance with the bitcoin client? which has an excellent answer.

Sorry to post as an answer since rep is too low :)

skang404

Posted 2018-02-07T20:45:27.193

Reputation: 548