serverURL = 'http://{}:{}@{}:{}'.format(rpcUser, rpcPassword, rpcHost, rpcPort) myHost = config.get('MYSQL', 'host') myUser = config.get('MYSQL', 'username') myPasswd = config.get('MYSQL', 'password') myDatabase = config.get('MYSQL', 'database') secToken = config.get('SECURITY', 'token') secFixedGaid = config.get('SECURITY', 'fixedGaid') secAuthorizerAddress = config.get('SECURITY', 'authorizerAddress') betaToken = config.get('BETA', 'token') betaFixedGaid = config.get('BETA', 'fixedGaid') betaAuthorizerAddress = config.get('BETA', 'authorizerAddress') host = RPCHost(serverURL) if (len(rpcPassphrase) > 0): result = host.call('walletpassphrase', rpcPassphrase, 60) @app.route('/.well-known/<path:filename>') def wellKnownRoute(filename): return send_from_directory('{}/well-known/'.format(app.root_path), filename, conditional=True) def parse_signed_request(request): if not isinstance(request, dict) or \ set(request.keys()) != {'message', 'signature'} or \ not isinstance(request['message'], dict) or \
from bitcoin_rpc_class import RPCHost # version 0.16 of bitcoind, default port for regtest network is changed from 18332 to 18443 # The port number depends on the one writtein the bitcoin.conf file rpcPort = '18443' # The RPC username and RPC password MUST match the one in your bitcoin.conf file rpcUser = '******' rpcPassword = '******' #Accessing the RPC local server serverURL = 'http://' + 'vinay' + ':' + 'fintech' + '@127.0.0.1:' + rpcPort print(serverURL) #Using the class defined in the bitcoin_rpc_class.py host = RPCHost(serverURL) print('123') hash = host.call('getbestblockhash') print(hash) #block = host.call('getblock', hash) #coin = block['tx'][0] #test = host.call('listreceivedbyaddress', 0, True) #print (test) #from jsonrpc import ServiceProxy #access = ServiceProxy("http://*****:*****@127.0.0.1:18446") #print( access.getinfo()) #access.listreceivedbyaddress(6) #access.sendtoaddress("11yEmxiMso2RsFVfBcCa616npBvGgxiBX", 10)
config = configparser.RawConfigParser() config.read(configFile) app_id = config.get('TTN', 'app_id') access_key = config.get('TTN', 'access_key') rpcHost = config.get('BTC', 'host') rpcPort = config.get('BTC', 'port') rpcUser = config.get('BTC', 'username') rpcPassword = config.get('BTC', 'password') address = config.get('BTC', 'address') rpcWallet = config.get('BTC', 'wallet') serverURL = 'http://' + rpcUser + ':' + rpcPassword + '@' + rpcHost + ':' + str( rpcPort) + '/wallet/' + rpcWallet #serverURL = 'http://' + rpcUser + ':' + rpcPassword + '@'+rpcHost+':' + str(rpcPort) host = RPCHost(serverURL) messages = {} lock = threading.Lock() def uplink_callback(msg, client): lock.acquire() try: payload_plain = base64.b64decode(msg.payload_raw) dev_id = msg.dev_id prefix = payload_plain[0:3] message_id = payload_plain[4:6].hex() message_tot = payload_plain[7:8].hex()