Exemple #1
0
def _register_network(chainspec: dict, network_idx: int,
                      count_of_bootstrap_nodes: int,
                      count_of_genesis_nodes: int,
                      path_to_faucet_pvk: pathlib.Path):
    """Register a network.

    """
    # Set network.
    network = factory.create_network(
        f"lrt{network_idx}",
        chainspec['genesis']['name'],
        count_of_bootstrap_nodes,
        count_of_genesis_nodes,
    )

    # Set faucet.
    private_key, public_key = crypto.get_key_pair_from_pvk_pem_file(
        path_to_faucet_pvk, crypto.DEFAULT_KEY_ALGO, crypto.KeyEncoding.HEX)
    network.faucet = factory.create_account(
        network=network.name,
        typeof=AccountType.NETWORK_FAUCET,
        index=0,
        key_algo=crypto.DEFAULT_KEY_ALGO,
        private_key=private_key,
        public_key=public_key,
    )

    # Push to cache.
    cache.infra.set_network(network)
    utils.log(f"registered network")

    return network
Exemple #2
0
def _register_network(network_id: str, chain_name: str):
    """Register a network.

    """
    network = factory.create_network(network_id, chain_name)
    cache.infra.set_network(network)

    # Inform.
    utils.log(f"registered {network.name_raw} - metadata")

    return network
Exemple #3
0
def main(args):
    """Entry point.
    
    :param args: Parsed CLI arguments.

    """
    # Instantiate.
    network = factory.create_network(args.network, args.chain)

    # Push.
    cache.infra.set_network(network)

    # Inform.
    utils.log(f"Network {args.network} was successfully registered")
def _register_network(network_idx: int, count_of_bootstrap_nodes: int, count_of_genesis_nodes: int):
    """Register a network.

    """
    # Set network.
    network = factory.create_network(
        f"nctl{network_idx}",
        f"casper-net-{network_idx}",
        count_of_bootstrap_nodes,
        count_of_genesis_nodes,
        )

    # Push to cache.
    cache.infra.set_network(network)

    # Inform.
    utils.log(f"Registered {network.name} - metadata")

    return network
Exemple #5
0
def create_network() -> types.infra.Network:
    return factory.create_network(
        f"{types.infra.NetworkType.LOC.name}-{str(1).zfill(2)}",
        types.infra.NetworkType.LOC.name
    )