# Request to Faucet headers = {'content-type': 'text/plain'} query = "refcode[code]=%s&refcode[account]=%s&refcode[asset_symbol]=%s&refcode[asset_amount]=%s&refcode[send_to]=%s" % ( ref_code, from_account["name"], amount_asset["symbol"], op["amount"]["amount"], email) print("--- query: %s" % query) response = requests.post(config.faucet_url, params=query, headers=headers) if __name__ == '__main__': ## Monitor definitions protocol = GrapheneMonitor protocol.last_op = config.last_op ## last operation logged protocol.account_id = "1.2.%s" % config.accountID.split(".")[ 2] ## account to monitor ## Open Up Graphene Websocket API api = GrapheneWebsocket(config.host, config.port, config.user, config.password, protocol) print(api) ## Set Callback for object changes api.setObjectCallbacks({config.accountID: protocol.onAccountUpdate}) ## Run the Websocket connection continuously api.connect() api.run_forever()
try : # if possible privkey = PrivateKey(config.memo_wif_key) pubkey = PublicKey(memo["from"], prefix=prefix) memomsg = Memo.decode_memo(privkey, pubkey, memo["nonce"], memo["message"]) except Exception as e: # if not possible memomsg = "--cannot decode-- %s" % str(e) # Print out print("last_op: %s | block:%s | from %s -> to: %s | fee: %f %s | amount: %f %s | memo: %s" % ( opID, block, from_account["name"], to_account["name"], fee_amount, fee_asset["symbol"], amount_amount, amount_asset["symbol"], memomsg)) if __name__ == '__main__': # Monitor definitions protocol = GrapheneMonitor protocol.last_op = config.last_op # last operation logged protocol.account_id = "1.2.%s" % config.accountID.split(".")[2] # account to monitor # Open Up Graphene Websocket API api = GrapheneWebsocket(config.url, config.user, config.password, protocol) # Set Callback for object changes api.setObjectCallbacks({config.accountID : protocol.onAccountUpdate}) api.setEventCallbacks({"registered-history" : protocol.onAccountUpdate}) # Run the Websocket connection continuously api.connect() api.run_forever()
wallet_password = "******" remote_ws = "ws://159.203.246.155:8090" private_active_key = "5JVVeSuCHviTJSY3LKyQJ4t4s4coiVN7qw3M4XzWYQgZ2XzaJu1" witnessname = "test.dele-puppy" producer_number = 2 rpc_port = "8094" wallet_name = "wallet2.json" rpc = GrapheneWebsocket("ws://localhost:%d" % rpc_port, "", "") local_port = "127.0.0.1:" + rpc_port rpc = GrapheneWebsocket("ws://localhost:%d" % rpc_port, "", "") local_port = "127.0.0.1:" + rpc_port def tryProducer(): attempt = 0 while attempt < 5: attempt += 1 print("attempt #" + attempt + " to reconnect to " + wallet_name) subprocess.call([ "screen", "-dmS", wallet_name, path_to_cli_wallet, "-H", local_port, "-s", remote_ws, "-w", "producer2/" + wallet_name, "--chain-id",
remote_ws = "ws://159.203.246.155:8090" private_active_key = "5JVVeSuCHviTJSY3LKyQJ4t4s4coiVN7qw3M4XzWYQgZ2XzaJu1" witnessname = "test.dele-puppy" producer_number = 2 rpc_port = "8094" wallet_name = "wallet2.json" rpc = GrapheneWebsocket("localhost", rpc_port, "", "") local_port = "127.0.0.1:" + rpc_port rpc = GrapheneWebsocket("localhost", rpc_port, "", "") local_port = "127.0.0.1:" + rpc_port def tryProducer(): attempt = 0 while attempt < 5: attempt +=1 print("attempt #" + attempt + " to reconnect to " + wallet_name) subprocess.call(["screen","-dmS",wallet_name,path_to_cli_wallet,"-H",local_port,"-s",remote_ws,"-w","producer2/" + wallet_name,"--chain-id","16362d305df19018476052eed629bb4052903c7655a586a0e0cfbdb0eaf1bfd8"]) ### uncomment this line if running on testnet # subprocess.call(["screen","-dmS",wallet_name,path_to_cli_wallet,"-H",local_port,"-s",remote_ws,"-w","producer2/" + wallet_name"]) ### comment this line out if running on testnet time.sleep(1)
import sys import json from grapheneapi import GrapheneWebsocket, GrapheneWebsocketProtocol import time import config import subprocess from time import gmtime, strftime from producer1 import producer1 from producer2 import producer2 # # # rpc = GrapheneWebsocket("localhost", 8092, "", "") def unlockWallet(): if config.feed_script_active == True or config.switching_active == True: print("unlocking wallet") time.sleep(5) rpc.unlock(config.wallet_password) time.sleep(1) def closeScreens(): print("closing wallet") subprocess.call(["screen", "-S", "local-wallet", "-p", "0", "-X", "quit"]) time.sleep(2) print("closing witness")
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import json from grapheneapi import GrapheneWebsocket, GrapheneWebsocketProtocol import time import config import subprocess from time import gmtime, strftime rpc = GrapheneWebsocket("ws://localhost:8092", "", "") def unlockWallet(): if config.feed_script_active == True: print("unlocking wallet") rpc.unlock(config.wallet_password) time.sleep(10) def closeScreens(): print("closing wallet") subprocess.call(["screen", "-S", "wallet", "-p", "0", "-X", "quit"]) time.sleep(2) print("closing witness") subprocess.call(["screen", "-S", "witness", "-p", "0", "-X", "quit"]) time.sleep(2) subprocess.call(["pkill", "witness_node"]) time.sleep(2)