示例#1
0
def geth_commands(ctx, geth_hosts, datadir):
    """This is helpful to setup a private cluster of geth nodes that won't need discovery
    (because they can use the content of `static_nodes` as `static-nodes.json`).
    """
    pretty = ctx.obj['pretty']
    nodes = []  # pylint: disable=redefined-outer-name

    for i, host in enumerate(geth_hosts):
        nodes.append(create_node_configuration(host=host, node_key_seed=i))

    for node in nodes:
        node.pop('unlock')
        node.pop('rpcport')

    config = {
        '{host}'.format(**node): ' '.join(to_cmd(node, datadir=datadir))
        for node in nodes
    }
    config['static_nodes'] = [node['enode'] for node in nodes]

    indent = None
    if pretty:
        indent = 2

    print json.dumps(
        config,
        indent=indent,
    )
示例#2
0
def geth_commands(ctx, geth_hosts, datadir):
    """This is helpful to setup a private cluster of geth nodes that won't need discovery
    (because they can use the content of `static_nodes` as `static-nodes.json`).
    """
    pretty = ctx.obj['pretty']
    nodes = []  # pylint: disable=redefined-outer-name

    for i, host in enumerate(geth_hosts):
        nodes.append(create_node_configuration(host=host, node_key_seed=i))

    for node in nodes:
        node.pop('unlock')
        node.pop('rpcport')

    config = {'{host}'.format(**node): ' '.join(to_cmd(node, datadir=datadir)) for node in nodes}
    config['static_nodes'] = [node['enode'] for node in nodes]

    indent = None
    if pretty:
        indent = 2

    print json.dumps(
        config,
        indent=indent,
    )