Exemple #1
0
def create_network_interface(port, initial_peers=None):
    if initial_peers is None:
        initial_peers = {}
    return ServerNetworkInterface(JsonRpcClient(), initial_peers,
                                  MockCryptoHelper(), empty_function,
                                  on_transaction_received, empty_function,
                                  empty_function, get_transaction, port)
Exemple #2
0
def create_client(wallet_file, node_ip, node_port):
    crypto_helper = CryptoHelper.instance()
    network_interface = ClientNetworkInterface(JsonRpcClient(),
                                               {node_ip: {
                                                   node_port: {}
                                               }})
    return BlockchainClient(Wallet(wallet_file), network_interface,
                            crypto_helper)
Exemple #3
0
 def create_network_interface(self, port, initial_peers=None):
     """Initialize the network interface"""
     if initial_peers is None:
         initial_peers = {}
     return ServerNetworkInterface(
         JsonRpcClient(), initial_peers, self.crypto_helper_obj,
         self.on_new_block_received, self.on_new_transaction_received,
         self.on_get_block_by_id, self.on_get_block_by_hash,
         self.on_get_transaction, self.on_get_blocks_by_range, port)