2

I want to get list of all address's income transactions since the genesis block

import requests, json

rpcPort = 8332
rpcUser = '[removed]'
rpcPassword = '[removed]'

#Accessing the RPC local server
serverURL = 'http://' + rpcUser + ':' + rpcPassword + '@localhost:' + str(rpcPort)

headers = {'content-type': 'application/json'}
payload = json.dumps({"method": 'listunspent', "params": [0, 999999, ['1KuWLoZuoJgz3N6sLoAwGth9XGm8YuFTGt']], "jsonrpc": "2.0"})
response = requests.post(serverURL, headers=headers, data=payload)
print(response.text)

it returns

{"result":[],"error":null,"id":null}

But according to https://blockchain.info/address/1KuWLoZuoJgz3N6sLoAwGth9XGm8YuFTGt there are a lot of transactions. How to get list of address-related transactions without private key? Can I add address not owned by me to local account to achieve transactions by getreceivedbyaddress command?

2

Can I add address not owned by me to local account to achieve transactions by getreceivedbyaddress command?

No, bitcoind only keeps track of transactions related to your wallet, not all transactions. So to do this, you can add a specific address as a watch only address to your wallet if you don't have the private key, and then rescan to find relevant transactions for it, but that will usually take a while.

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.