def main( rpc_provider: HTTPProvider, private_key: str, private_key_password_file: str, state_file: str, channel_manager_address: str, minimum_amount: int, gas_price: int, ): if minimum_amount <= 0: click.echo('Minimum amount need to be at least 1') sys.exit(1) private_key = utils.get_private_key(private_key, private_key_password_file) if private_key is None: sys.exit(1) receiver_address = utils.privkey_to_addr(private_key) web3 = Web3(HTTPProvider(rpc_provider, request_kwargs={'timeout': 60})) config.NETWORK_CFG.set_defaults(int(web3.version.network)) web3.eth.defaultAccount = receiver_address channel_manager_address = ( channel_manager_address or config.NETWORK_CFG.channel_manager_address ) channel_manager_contract = make_channel_manager_contract(web3, channel_manager_address) if not state_file: state_file_name = "%s_%s.db" % ( channel_manager_address[:10], receiver_address[:10] ) app_dir = click.get_app_dir('microraiden') if not os.path.exists(app_dir): click.echo('No state file or directory found!') sys.exit(1) state_file = os.path.join(app_dir, state_file_name) try: click.echo('Loading state file from {}'.format(state_file)) state = ChannelManagerState.load(state_file) except StateFileException: click.echo('Error reading state file') traceback.print_exc() sys.exit(1) if not is_same_address(state.receiver, receiver_address): click.echo('Private key does not match receiver address in state file') sys.exit(1) elif not is_same_address(state.contract_address, channel_manager_address): click.echo('Channel manager contract address mismatch') sys.exit(1) click.echo('Withdrawing all paid tokens with at least {} due from ' 'receiver {}'.format(minimum_amount, receiver_address)) withdraw_from_channels( private_key, state, channel_manager_contract, minimum_amount, gas_price * denoms.gwei if gas_price else None, )
def __init__( self, private_key: str = None, key_password_path: str = None, channel_manager_address: str = None, web3: Web3 = None ) -> None: is_hex_key = is_hex(private_key) and len(remove_0x_prefix(private_key)) == 64 is_path = os.path.exists(private_key) assert is_hex_key or is_path, 'Private key must either be a hex key or a file path.' # Load private key from file if none is specified on command line. if is_path: private_key = get_private_key(private_key, key_password_path) assert private_key is not None, 'Could not load private key from file.' self.channels = [] # type: List[Channel] # Create web3 context if none is provided, either by using the proxies' context or creating # a new one. if not web3: web3 = Web3(HTTPProvider(WEB3_PROVIDER_DEFAULT)) channel_manager_address = to_checksum_address( channel_manager_address or NETWORK_CFG.CHANNEL_MANAGER_ADDRESS ) self.context = Context(private_key, web3, channel_manager_address) self.sync_channels()
def __init__(self, private_key: str = None, key_password_path: str = None, channel_manager_address: str = None, web3: Web3 = None) -> None: is_hex_key = is_hex(private_key) and len( remove_0x_prefix(private_key)) == 64 is_path = os.path.exists(private_key) assert is_hex_key or is_path, 'Private key must either be a hex key or a file path.' # Load private key from file if none is specified on command line. if is_path: private_key = get_private_key(private_key, key_password_path) assert private_key is not None, 'Could not load private key from file.' self.channels = [] # type: List[Channel] # Create web3 context if none is provided, either by using the proxies' context or creating # a new one. if not web3: web3 = Web3(HTTPProvider(WEB3_PROVIDER_DEFAULT)) channel_manager_address = to_checksum_address( channel_manager_address or NETWORK_CFG.CHANNEL_MANAGER_ADDRESS) self.context = Context(private_key, web3, channel_manager_address) self.sync_channels()
def main( ctx, channel_manager_address, ssl_key, ssl_cert, gas_price, state_file, private_key, private_key_password_file, paywall_info, rpc_provider, ): private_key = utils.get_private_key(private_key, private_key_password_file) if private_key is None: sys.exit(1) receiver_address = privkey_to_addr(private_key) constants.paywall_html_dir = paywall_info while True: try: web3 = Web3( HTTPProvider(rpc_provider, request_kwargs={'timeout': 60})) NETWORK_CFG.set_defaults(int(web3.version.network)) channel_manager_address = to_checksum_address( channel_manager_address or NETWORK_CFG.CHANNEL_MANAGER_ADDRESS) if gas_price is not None: NETWORK_CFG.gas_price = gas_price if not state_file: state_file_name = "%s_%s.db" % (channel_manager_address[:10], receiver_address[:10]) app_dir = click.get_app_dir('microraiden') if not os.path.exists(app_dir): os.makedirs(app_dir) state_file = os.path.join(app_dir, state_file_name) app = make_paywalled_proxy( private_key, state_file, contract_address=channel_manager_address, web3=web3) except StateFileLocked as ex: log.warning('Another uRaiden process is already running (%s)!' % str(ex)) except InsecureStateFile as ex: msg = ( 'The permission bits of the state file (%s) are set incorrectly (others can ' 'read or write) or you are not the owner. For reasons of security, ' 'startup is aborted.' % state_file) log.fatal(msg) raise except NetworkIdMismatch as ex: log.fatal(str(ex)) raise except requests.exceptions.ConnectionError as ex: log.warning("Ethereum node refused connection: %s" % str(ex)) else: break sleep(constants.SLEEP_RELOAD) ctx.obj = app
def main( rpc_provider: HTTPProvider, private_key: str, private_key_password_file: str, state_file: str, channel_manager_address: str, minimum_amount: int, gas_price: int, ): if minimum_amount <= 0: click.echo('Minimum amount need to be at least 1') sys.exit(1) private_key = utils.get_private_key(private_key, private_key_password_file) if private_key is None: sys.exit(1) receiver_address = utils.privkey_to_addr(private_key) web3 = Web3(HTTPProvider(rpc_provider, request_kwargs={'timeout': 60})) config.NETWORK_CFG.set_defaults(int(web3.version.network)) web3.eth.defaultAccount = receiver_address channel_manager_address = (channel_manager_address or config.NETWORK_CFG.channel_manager_address) channel_manager_contract = make_channel_manager_contract( web3, channel_manager_address) if not state_file: state_file_name = "%s_%s.db" % (channel_manager_address[:10], receiver_address[:10]) app_dir = click.get_app_dir('microraiden') if not os.path.exists(app_dir): click.echo('No state file or directory found!') sys.exit(1) state_file = os.path.join(app_dir, state_file_name) try: click.echo('Loading state file from {}'.format(state_file)) state = ChannelManagerState.load(state_file) except StateFileException: click.echo('Error reading state file') traceback.print_exc() sys.exit(1) if not is_same_address(state.receiver, receiver_address): click.echo('Private key does not match receiver address in state file') sys.exit(1) elif not is_same_address(state.contract_address, channel_manager_address): click.echo('Channel manager contract address mismatch') sys.exit(1) click.echo('Withdrawing all paid tokens with at least {} due from ' 'receiver {}'.format(minimum_amount, receiver_address)) withdraw_from_channels( private_key, state, channel_manager_contract, minimum_amount, gas_price * denoms.gwei if gas_price else None, )
def faucet_private_key(request, faucet_password_path: str) -> str: private_key = request.config.getoption('faucet_private_key') if is_hex(private_key): assert len(remove_0x_prefix(private_key)) == 64 return private_key else: private_key = get_private_key(private_key, faucet_password_path) assert private_key is not None, 'Error loading faucet private key from file.' return private_key
def main( ctx, channel_manager_address, ssl_key, ssl_cert, gas_price, state_file, private_key, private_key_password_file, paywall_info, rpc_provider, ): private_key = utils.get_private_key(private_key, private_key_password_file) if private_key is None: sys.exit(1) receiver_address = privkey_to_addr(private_key) constants.paywall_html_dir = paywall_info while True: try: web3 = Web3(HTTPProvider(rpc_provider, request_kwargs={'timeout': 60})) NETWORK_CFG.set_defaults(int(web3.version.network)) channel_manager_address = to_checksum_address( channel_manager_address or NETWORK_CFG.CHANNEL_MANAGER_ADDRESS ) if gas_price is not None: NETWORK_CFG.gas_price = gas_price if not state_file: state_file_name = "%s_%s.db" % ( channel_manager_address[:10], receiver_address[:10] ) app_dir = click.get_app_dir('microraiden') if not os.path.exists(app_dir): os.makedirs(app_dir) state_file = os.path.join(app_dir, state_file_name) app = make_paywalled_proxy(private_key, state_file, contract_address=channel_manager_address, web3=web3) except StateFileLocked as ex: log.warning('Another uRaiden process is already running (%s)!' % str(ex)) except InsecureStateFile as ex: msg = ('The permission bits of the state file (%s) are set incorrectly (others can ' 'read or write) or you are not the owner. For reasons of security, ' 'startup is aborted.' % state_file) log.fatal(msg) raise except NetworkIdMismatch as ex: log.fatal(str(ex)) raise except requests.exceptions.ConnectionError as ex: log.warning("Ethereum node refused connection: %s" % str(ex)) else: break sleep(constants.SLEEP_RELOAD) ctx.obj = app
def main(close_channel: bool = True, ): w3 = Web3(HTTPProvider(config['web3path'])) private_key = get_private_key('./dragonstone-rinkeby-02-03') print("Web3 Provider:", config['web3path']) #print('Private Key :', config['private-key']) print('Password Path:', config['password-path']) print('Resource Reqd:', config['resource']) print('Manager Addr:', config['manager']) print('Close Channel:', close_channel) close_channels(private_key, config['password-path'], config['resource'], config['manager'], w3, close_channel)
def main(): web3 = Web3(HTTPProvider(config['web3path'])) NETWORK_CFG.set_defaults(int(web3.version.network)) private_key = get_private_key('./dragonstone-rinkeby') log.info('This private key %s', private_key) log.info('This address %s', privkey_to_addr(private_key)) channel_manager = make_channel_manager(private_key, config['manager'], './db/echo_server.db', web3, 'localhost', 6001) run(private_key=private_key, channel_manager=channel_manager)
def main(close_channel: bool = True, ): w3 = Web3(HTTPProvider(config['web3path'])) NETWORK_CFG.set_defaults(int(w3.version.network)) private_key = get_private_key('./dragonstone-rinkeby-02-03') print("Web3 Provider:", config['web3path']) #print('Private Key :', config['private-key']) log.info('This private key %s', private_key) log.info('This address %s', privkey_to_addr(private_key)) # print('Password Path:', config['password-path']) # print('Resource Reqd:', config['resource']) # print('Manager Addr:', config['manager']) # print('Close Channel:', close_channel) close_channels(private_key, config['manager'], config['monitor'], w3)
def main( private_key, private_key_password_file, ): private_key = utils.get_private_key(private_key, private_key_password_file) if private_key is None: sys.exit(1) ticker = None try: ticker = ETHTickerClient(private_key) ticker.run() except KeyboardInterrupt: if ticker: ticker.close()
def main( ctx, channel_manager_address, ssl_key, ssl_cert, state_file, private_key, private_key_password_file, paywall_info, rpc_provider, ): private_key = utils.get_private_key(private_key, private_key_password_file) if private_key is None: sys.exit(1) receiver_address = privkey_to_addr(private_key) channel_manager_address = channel_manager_address or config.CHANNEL_MANAGER_ADDRESS if not state_file: state_file_name = "%s_%s.db" % (channel_manager_address[:10], receiver_address[:10]) app_dir = click.get_app_dir('microraiden') if not os.path.exists(app_dir): os.makedirs(app_dir) state_file = os.path.join(app_dir, state_file_name) config.paywall_html_dir = paywall_info web3 = Web3(HTTPProvider(rpc_provider, request_kwargs={'timeout': 60})) try: app = make_paywalled_proxy(private_key, state_file, contract_address=channel_manager_address, web3=web3) except StateFileLocked as ex: log.fatal('Another uRaiden process is already running (%s)!' % str(ex)) sys.exit(1) except InsecureStateFile as ex: msg = ( 'The permission bits of the state file (%s) are set incorrectly (others can ' 'read or write) or you are not the owner. For reasons of security, ' 'startup is aborted.' % state_file) log.fatal(msg) sys.exit(1) except NetworkIdMismatch as ex: log.fatal(str(ex)) sys.exit(1) except requests.exceptions.ConnectionError as ex: log.fatal("Ethereum node refused connection: %s" % str(ex)) sys.exit(1) ctx.obj = app
def get_tokens(): web3 = Web3(HTTPProvider(config['web3path'])) private_key = get_private_key('./dragonstone-rinkeby-02-03') log.info('This private key %s', private_key) log.info('This address %s', privkey_to_addr(private_key)) token_address = config['token'] token_abi = constants.CONTRACT_METADATA[constants.TOKEN_ABI_NAME]['abi'] token_contract = web3.eth.contract(abi=token_abi, address=token_address) raw_tx = create_signed_contract_transaction(private_key, token_contract, 'mint', [], 100000000000000000) web3.eth.sendRawTransaction(raw_tx) log.info('bought tokens from custom token')
def main( rpc_provider: HTTPProvider, private_key: str, private_key_password_file: str, state_file: str, channel_manager_address: str ): private_key = utils.get_private_key(private_key, private_key_password_file) if private_key is None: sys.exit(1) receiver_address = privkey_to_addr(private_key) if not state_file: state_file_name = "%s_%s.json" % (channel_manager_address[:10], receiver_address[:10]) app_dir = click.get_app_dir('microraiden') state_file = os.path.join(app_dir, state_file_name) web3 = Web3(HTTPProvider(rpc_provider, request_kwargs={'timeout': 60})) web3.eth.defaultAccount = receiver_address channel_manager_address = ( channel_manager_address or config.CHANNEL_MANAGER_ADDRESS[web3.version.network] ) channel_manager_contract = make_channel_manager_contract(web3, channel_manager_address) try: click.echo('Loading state file from {}'.format(state_file)) state = ChannelManagerState.load(state_file) except StateFileException: click.echo('Error reading state file') traceback.print_exc() sys.exit(1) if not is_same_address(state.receiver, receiver_address): click.echo('Private key does not match receiver address in state file') sys.exit(1) elif not is_same_address(state.contract_address, channel_manager_address): click.echo('Channel manager contract address mismatch') sys.exit(1) click.echo('Closing all open channels with valid balance proofs for ' 'receiver {}'.format(receiver_address)) close_open_channels(private_key, state, channel_manager_contract)
def set_up(self): self.logger = logging.getLogger(self.name) self.logger.propagate = False self.logger.setLevel(logging.INFO) handler = logging.StreamHandler(sys.stdout) handler.setFormatter( logging.Formatter('%(name)-13s %(levelname)-8s %(message)s')) self.logger.addHandler(handler) self.project = Project() self.open_block = None self.key = None with self.project.get_chain(CHAIN_NAME) as chain: self.web3 = chain.web3 self.project_info = read_from_file() self.rand = random.Random() self.channel = chain.provider\ .get_contract_factory('MicroTransferChannels')(self.project_info['channels_address']) self.token = chain.provider.get_contract_factory('GEXToken')( self.project_info['token_address']) self.sender = self.web3.eth.accounts[0] self.sender_key = utils.get_private_key(signer_key_path, signer_pass_path)
def main(private_key, private_key_password_file, state_file, channel_manager_address): private_key = utils.get_private_key(private_key, private_key_password_file) if private_key is None: sys.exit(1) receiver_address = privkey_to_addr(private_key) channel_manager_address = channel_manager_address or config.CHANNEL_MANAGER_ADDRESS if not state_file: state_file_name = "%s_%s.json" % (channel_manager_address[:10], receiver_address[:10]) app_dir = click.get_app_dir('microraiden') state_file = os.path.join(app_dir, state_file_name) web3 = Web3(config.WEB3_PROVIDER) web3.eth.defaultAccount = receiver_address contract_proxy = make_contract_proxy(web3, private_key, config.CHANNEL_MANAGER_ADDRESS) try: click.echo('Loading state file from {}'.format(state_file)) state = ChannelManagerState.load(state_file) except StateFileException: click.echo('Error reading state file') traceback.print_exc() sys.exit(1) if not is_same_address(state.receiver, receiver_address): click.echo('Private key does not match receiver address in state file') sys.exit(1) elif not is_same_address(state.contract_address, channel_manager_address): click.echo('Channel manager contract address mismatch') sys.exit(1) click.echo('Closing all open channels with valid balance proofs for ' 'receiver {}'.format(receiver_address)) close_open_channels(state, contract_proxy)
def __init__(self, private_key: str = None, key_path: str = None, key_password_path: str = None, channel_manager_address: str = CHANNEL_MANAGER_ADDRESS, web3: Web3 = None) -> None: assert private_key or key_path assert not private_key or isinstance(private_key, str) # Load private key from file if none is specified on command line. if not private_key: private_key = get_private_key(key_path, key_password_path) assert private_key is not None self.channels = [] # type: List[Channel] # Create web3 context if none is provided, either by using the proxies' context or creating # a new one. if not web3: web3 = Web3(RPCProvider()) self.context = Context(private_key, web3, channel_manager_address) self.sync_channels()
def __init__( self, privkey: str = None, key_path: str = None, key_password_path: str = None, datadir: str = click.get_app_dir('microraiden'), channel_manager_address: str = CHANNEL_MANAGER_ADDRESS, token_address: str = TOKEN_ADDRESS, rpc: RPCProvider = None, web3: Web3 = None, channel_manager_proxy: ChannelContractProxy = None, token_proxy: ContractProxy = None, rpc_endpoint: str = 'localhost', rpc_port: int = 8545, contract_abi_path: str = os.path.join( os.path.dirname(os.path.dirname(__file__)), 'data/contracts.json' ) ) -> None: assert privkey or key_path assert not privkey or isinstance(privkey, str) # Plain copy initializations. self.privkey = privkey self.datadir = datadir self.channel_manager_address = channel_manager_address self.token_address = token_address self.web3 = web3 self.channel_manager_proxy = channel_manager_proxy self.token_proxy = token_proxy # Load private key from file if none is specified on command line. if not privkey: self.privkey = get_private_key(key_path, key_password_path) assert self.privkey is not None os.makedirs(datadir, exist_ok=True) assert os.path.isdir(datadir) self.account = privkey_to_addr(self.privkey) self.channels = [] # type: List[Channel] # Create web3 context if none is provided, either by using the proxies' context or creating # a new one. if not web3: if channel_manager_proxy: self.web3 = channel_manager_proxy.web3 elif token_proxy: self.web3 = token_proxy.web3 else: if not rpc: rpc = RPCProvider(rpc_endpoint, rpc_port) self.web3 = Web3(rpc) # Create missing contract proxies. if not channel_manager_proxy or not token_proxy: with open(contract_abi_path) as abi_file: contract_abis = json.load(abi_file) if not channel_manager_proxy: channel_manager_abi = contract_abis[CHANNEL_MANAGER_ABI_NAME]['abi'] self.channel_manager_proxy = ChannelContractProxy( self.web3, self.privkey, channel_manager_address, channel_manager_abi, GAS_PRICE, GAS_LIMIT ) if not token_proxy: token_abi = contract_abis[TOKEN_ABI_NAME]['abi'] self.token_proxy = ContractProxy( self.web3, self.privkey, token_address, token_abi, GAS_PRICE, GAS_LIMIT ) assert self.web3 assert self.channel_manager_proxy assert self.token_proxy assert self.channel_manager_proxy.web3 == self.web3 == self.token_proxy.web3 netid = self.web3.version.network self.balances_filename = 'balances_{}_{}.json'.format( NETWORK_NAMES.get(netid, netid), self.account[:10] ) self.filelock = filelock.FileLock(os.path.join(self.datadir, self.balances_filename)) self.filelock.acquire(timeout=0) self.load_channels() self.sync_channels()
def __init__( self, privkey: str = None, key_path: str = None, key_password_path: str = None, datadir: str = click.get_app_dir('microraiden'), channel_manager_address: str = CHANNEL_MANAGER_ADDRESS, web3: Web3 = None, channel_manager_proxy: ChannelContractProxy = None, token_proxy: ContractProxy = None, contract_metadata: dict = CONTRACT_METADATA ) -> None: assert privkey or key_path assert not privkey or isinstance(privkey, str) # Plain copy initializations. self.privkey = privkey self.datadir = datadir self.channel_manager_address = channel_manager_address self.web3 = web3 self.channel_manager_proxy = channel_manager_proxy self.token_proxy = token_proxy # Load private key from file if none is specified on command line. if not privkey: self.privkey = get_private_key(key_path, key_password_path) assert self.privkey is not None os.makedirs(datadir, exist_ok=True) assert os.path.isdir(datadir) self.account = privkey_to_addr(self.privkey) self.channels = [] # type: List[Channel] # Create web3 context if none is provided, either by using the proxies' context or creating # a new one. if not web3: if channel_manager_proxy: self.web3 = channel_manager_proxy.web3 self.channel_manager_address = channel_manager_proxy.address elif token_proxy: self.web3 = token_proxy.web3 else: self.web3 = Web3(RPCProvider()) # Create missing contract proxies. if not channel_manager_proxy: channel_manager_abi = contract_metadata[CHANNEL_MANAGER_ABI_NAME]['abi'] self.channel_manager_proxy = ChannelContractProxy( self.web3, self.privkey, channel_manager_address, channel_manager_abi, GAS_PRICE, GAS_LIMIT ) token_address = self.channel_manager_proxy.contract.call().token() if not token_proxy: token_abi = contract_metadata[TOKEN_ABI_NAME]['abi'] self.token_proxy = ContractProxy( self.web3, self.privkey, token_address, token_abi, GAS_PRICE, GAS_LIMIT ) else: assert is_same_address(self.token_proxy.address, token_address) assert self.web3 assert self.channel_manager_proxy assert self.token_proxy assert self.channel_manager_proxy.web3 == self.web3 == self.token_proxy.web3 netid = self.web3.version.network self.balances_filename = 'balances_{}_{}.json'.format( NETWORK_NAMES.get(netid, netid), self.account[:10] ) self.filelock = filelock.FileLock(os.path.join(self.datadir, self.balances_filename)) self.filelock.acquire(timeout=0) self.load_channels() self.sync_channels()
import logging import os from flask import request, send_file from flask_restful import Resource from microraiden.make_helpers import make_paywalled_proxy from microraiden.proxy.resources import Expensive from microraiden.utils import get_private_key private_key = "/home/oliver/.local/share/io.parity.ethereum/keys/test/UTC--2018-07-30T14-28-43Z--781e3a75-ed6b-b801-a939-591bc8a9938f" private_key = get_private_key(private_key) state_file_path = "/home/oliver/.config/microraiden/state_file_name" log = logging.getLogger(__name__) FIX_PRICE_URL = "/echofix" class Pic4Cash(Expensive): def get(self, url: str, param: str): # return request.files.get("/home/oliver/Schreibtisch/loredana.jpg", '') return send_file("/home/oliver/Schreibtisch/" + param, mimetype='image/jpg') def run(join_thread: bool = True): dirname = os.path.dirname(state_file_path) if dirname: os.makedirs(dirname, exist_ok=True) app = make_paywalled_proxy(private_key, state_file_path)
def __init__(self, privkey: str = None, key_path: str = None, key_password_path: str = None, channel_manager_address: str = CHANNEL_MANAGER_ADDRESS, web3: Web3 = None, channel_manager_proxy: ChannelContractProxy = None, token_proxy: ContractProxy = None, contract_metadata: dict = CONTRACT_METADATA) -> None: assert privkey or key_path assert not privkey or isinstance(privkey, str) # Plain copy initializations. self.privkey = privkey self.channel_manager_address = channel_manager_address self.web3 = web3 self.channel_manager_proxy = channel_manager_proxy self.token_proxy = token_proxy # Load private key from file if none is specified on command line. if not privkey: self.privkey = get_private_key(key_path, key_password_path) assert self.privkey is not None self.account = privkey_to_addr(self.privkey) self.channels = [] # type: List[Channel] # Create web3 context if none is provided, either by using the proxies' context or creating # a new one. if not web3: if channel_manager_proxy: self.web3 = channel_manager_proxy.web3 self.channel_manager_address = channel_manager_proxy.address elif token_proxy: self.web3 = token_proxy.web3 else: self.web3 = Web3(RPCProvider()) # Create missing contract proxies. if not channel_manager_proxy: channel_manager_abi = contract_metadata[CHANNEL_MANAGER_ABI_NAME][ 'abi'] self.channel_manager_proxy = ChannelContractProxy( self.web3, self.privkey, channel_manager_address, channel_manager_abi, GAS_PRICE, GAS_LIMIT) token_address = self.channel_manager_proxy.contract.call().token() if not token_proxy: token_abi = contract_metadata[TOKEN_ABI_NAME]['abi'] self.token_proxy = ContractProxy(self.web3, self.privkey, token_address, token_abi, GAS_PRICE, GAS_LIMIT) else: assert is_same_address(self.token_proxy.address, token_address) assert self.web3 assert self.channel_manager_proxy assert self.token_proxy assert self.channel_manager_proxy.web3 == self.web3 == self.token_proxy.web3 self.sync_channels()
def main(private_key: str): private_key = get_private_key(private_key) run(private_key)
import os from microraiden import config from microraiden.crypto import privkey_to_addr from microraiden.utils import get_private_key # private key of the content provider PRIVATE_KEY_FILE = '/tmp/key.json' PASSWORD_FILE = '/tmp/password.txt' PRIVATE_KEY = get_private_key(PRIVATE_KEY_FILE, PASSWORD_FILE) RECEIVER_ADDRESS = privkey_to_addr(PRIVATE_KEY) # host and port Parity/Geth serves RPC requests on WEB3_PROVIDER = 'http://web3:8545' # state file to store proxy state and balance proofs STATE_FILE = "/files/%s_%s.db" % (config.CHANNEL_MANAGER_ADDRESS[:10], RECEIVER_ADDRESS[:10]) SLEEP_RELOAD = 2
def main(private_key: str, rpc_provider: str): private_key = get_private_key(private_key) run(private_key, rpc_provider)
def main(private_key: str, rpc_provider: str = str(WEB3_PROVIDER_DEFAULT)): private_key = get_private_key(private_key) run(private_key, rpc_provider)