Last active
August 29, 2015 14:24
Revisions
-
Robby Dermody revised this gist
Jul 13, 2015 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,8 +22,9 @@ def fetch_addresses(): r = response.json() for tx in r['txs']: for out in tx['out']: if 'addr' in out: for addr in out['addr']: addrs.append(out['addr']) return list(set(addrs)) #uniqueify #call searchrawtransactions on these sample addresses -
Robby Dermody created this gist
Jul 13, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ #!/usr/bin/env python3 import requests, json import time rpcPort = 8332 rpcUser = 'rpc' rpcPassword = 'YOUR PASSWORD HERE' serverURL = 'http://' + rpcUser + ':' + rpcPassword + '@localhost:' + str(rpcPort) def call_rpc(method, params): print("Calling %s with params: %s" % (method, params)) headers = {'content-type': 'application/json'} if not isinstance(params, list): params = [params,] payload = json.dumps({"method": method, "params": params, "jsonrpc": "2.0"}) response = requests.get(serverURL, headers=headers, data=payload) print("RESPONSE: %s" % (response.text[:75] + '..') if len(response.text) > 75 else response.text) def fetch_addresses(): #get a list of addresses to mess with response = requests.get("https://blockchain.info/unconfirmed-transactions?format=json") addrs = [] r = response.json() for tx in r['txs']: for out in tx['out']: for addr in out['addr']: addrs.append(out['addr']) return list(set(addrs)) #uniqueify #call searchrawtransactions on these sample addresses while True: call_rpc("getmempoolinfo", []) for a in fetch_addresses(): call_rpc("searchrawtransactions", a) time.sleep(.5) time.sleep(10)