Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- import re
- import json
- import platform
- import os
- from slickrpc import Proxy
- # fucntion to define rpc_connection
- def def_credentials(chain):
- rpcport = '';
- operating_system = platform.system()
- if operating_system == 'Darwin':
- ac_dir = os.environ['HOME'] + '/Library/Application Support/Komodo'
- elif operating_system == 'Linux':
- ac_dir = os.environ['HOME'] + '/.komodo'
- elif operating_system == 'Windows':
- ac_dir = '%s/komodo/' % os.environ['APPDATA']
- if chain == 'KMD':
- coin_config_file = str(ac_dir + '/komodo.conf')
- else:
- coin_config_file = str(ac_dir + '/' + chain + '/' + chain + '.conf')
- with open(coin_config_file, 'r') as f:
- for line in f:
- l = line.rstrip()
- if re.search('rpcuser', l):
- rpcuser = l.replace('rpcuser=', '')
- elif re.search('rpcpassword', l):
- rpcpassword = l.replace('rpcpassword=', '')
- elif re.search('rpcport', l):
- rpcport = l.replace('rpcport=', '')
- if len(rpcport) == 0:
- if chain == 'KMD':
- rpcport = 7771
- else:
- print("rpcport not in conf file, exiting")
- print("check " + coin_config_file)
- exit(1)
- return (Proxy("http://%s:%s@127.0.0.1:%d" % (rpcuser, rpcpassword, int(rpcport))))
- CHAIN = 'LABSTRE'
- ADDRESS = 'RXL3YXG2ceaB6C5hfJcN4fvmLH2C34knhA'
- rpc_connection = def_credentials(CHAIN)
- getinfo_result = rpc_connection.getinfo()
- height = getinfo_result['blocks']
- getnotarysendmany_result = rpc_connection.getnotarysendmany()
- for block in range(2,height):
- getblock_result = rpc_connection.getblock(str(block), 2)
- if len(getblock_result['tx'][0]['vout']) > 1:
- vouts = getblock_result['tx'][0]['vout']
- for vout in vouts[1:]:
- blah = vout['scriptPubKey']['addresses'][0]
- if blah in getnotarysendmany_result:
- getnotarysendmany_result[blah] += 1
- else:
- print('what')
- print(getnotarysendmany_result)
- #pprint.pprint(getraw_result['result']['vin'][0])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement