microraiden.utils package

Submodules

microraiden.utils.contract module

microraiden.utils.contract.create_contract_transaction(contract, from_, func_name, args, value=0, nonce_offset=0, gas_price=None, gas_limit=130000)[source]
Return type:Transaction
microraiden.utils.contract.create_signed_contract_transaction(private_key, contract, func_name, args, value=0, nonce_offset=0, gas_price=None, gas_limit=130000)[source]

Creates a signed on-chain contract transaction compliant with EIP155.

Return type:str
microraiden.utils.contract.create_signed_transaction(private_key, web3, to, value=0, data=b'', nonce_offset=0, gas_price=None, gas_limit=21000)[source]

Creates a signed on-chain transaction compliant with EIP155.

Return type:str
microraiden.utils.contract.create_transaction(web3, from_, to, data=b'', nonce_offset=0, value=0, gas_price=None, gas_limit=21000)[source]
Return type:Transaction
microraiden.utils.contract.create_transaction_data(contract, func_name, args)[source]
Return type:bytes
microraiden.utils.contract.get_event_blocking(contract, event_name, from_block=0, to_block='latest', argument_filters=None, condition=None, wait=3, timeout=60)[source]
Return type:Optional[Dict[str, Any]]
microraiden.utils.contract.get_logs(contract, event_name, from_block=0, to_block='pending', argument_filters=None)[source]
microraiden.utils.contract.wait_for_transaction(web3, tx_hash, timeout=60, polling_interval=3)[source]

microraiden.utils.crypto module

microraiden.utils.crypto.addr_from_sig(sig, msg)[source]
microraiden.utils.crypto.eth_message_hash(msg)[source]
Return type:bytes
microraiden.utils.crypto.eth_sign(privkey, msg)[source]
Return type:bytes
microraiden.utils.crypto.eth_sign_typed_data(privkey, typed_data)[source]
Return type:bytes
microraiden.utils.crypto.eth_sign_typed_data_eip(privkey, typed_data)[source]
Return type:bytes
microraiden.utils.crypto.eth_sign_typed_data_message(typed_data)[source]
Return type:bytes
microraiden.utils.crypto.eth_sign_typed_data_message_eip(typed_data)[source]
Return type:bytes
microraiden.utils.crypto.eth_verify(sig, msg)[source]
Return type:str
microraiden.utils.crypto.generate_privkey()[source]
Return type:bytes
microraiden.utils.crypto.get_balance_message(receiver, open_block_number, balance, contract_address)[source]
Return type:bytes
microraiden.utils.crypto.get_closing_message(sender, open_block_number, balance, contract_address)[source]
Return type:bytes
microraiden.utils.crypto.keccak256(*args)[source]
Return type:bytes
microraiden.utils.crypto.keccak256_hex(*args)[source]
Return type:bytes
microraiden.utils.crypto.pack(*args)[source]

Simulates Solidity’s keccak256 packing. Integers can be passed as tuples where the second tuple element specifies the variable’s size in bits, e.g.: keccak256((5, 32)) would be equivalent to Solidity’s keccak256(uint32(5)) Default size is 256.

Return type:bytes
microraiden.utils.crypto.privkey_to_addr(privkey)[source]
Return type:str
microraiden.utils.crypto.pubkey_to_addr(pubkey)[source]
Return type:str
microraiden.utils.crypto.sign(privkey, msg, v=0)[source]
Return type:bytes
microraiden.utils.crypto.sign_balance_proof(privkey, receiver, open_block_number, balance, contract_address)[source]
Return type:bytes
microraiden.utils.crypto.sign_close(privkey, sender, open_block_number, balance, contract_address)[source]
Return type:bytes
microraiden.utils.crypto.sign_transaction(tx, privkey, network_id)[source]
microraiden.utils.crypto.verify_balance_proof(receiver, open_block_number, balance, balance_sig, contract_address)[source]
Return type:str
microraiden.utils.crypto.verify_closing_sig(sender, open_block_number, balance, closing_sig, contract_address)[source]
Return type:str

microraiden.utils.misc module

microraiden.utils.misc.get_function_kwargs(kwargs, function)[source]
microraiden.utils.misc.pop_function_kwargs(kwargs, function)[source]

microraiden.utils.populus_compat module

class microraiden.utils.populus_compat.LogFilter(web3, abi, address, event_name, from_block=0, to_block='latest', filters=None, callback=None)[source]

Bases: object

get_logs()[source]
init(post_callback=None)[source]
set_log_data(log)[source]
uninstall()[source]

microraiden.utils.private_key module

microraiden.utils.private_key.check_permission_safety(path)[source]

Check if the file at the given path is safe to use as a state file.

This checks that group and others have no permissions on the file and that the current user is the owner.

microraiden.utils.private_key.get_private_key(key_path, password_path=None)[source]

Open a JSON-encoded private key and return it

If a password file is provided, uses it to decrypt the key. If not, the password is asked interactively. Raw hex-encoded private keys are supported, but deprecated.

Module contents