1

I'm trying to use getrawtransaction to get transaction details (for any address) from my local blockchain. What I have is an address in readable format, "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa" but the input to getrawtransaction is a hexadecimal string. I found the following solution that does not change the string at all.

let address='1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa';
address=address.toString('hex')
console.log(address);
client.getRawTransaction(address, function(error, o) { console.log(o); });

Any ideas?

1

Bitcoin Core does not support querying an address balance.

What you can do is import the address as watch-only into your wallet (using the importaddress RPC), and completing a rescan of the blockchain. When you're finished, the wallet will treat that address as one of its own, and track payments to it, and include it in its balance. Of course, you won't be able to spend it without private key.

3
  • The feature seems pretty basic to me, but I'm sure the core devs have good reason for it. Thank you for the suggestion I will try this out.
    – Corbin
    Mar 9 '18 at 0:29
  • For normal operation an address index is not necessary, plus it is expensive to maintain, and there exists other software that is more appropriate for it. Mar 9 '18 at 0:42
  • Pieter thank you. May I ask what other software that is?
    – Corbin
    Mar 10 '18 at 18:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.