Exemple #1
0
def network_validators58(network_validators):
    network_validators_base58 = {}
    for p, v in network_validators.items():
        p = public_key_from_ed25519_key(key_from_base64(p))
        network_validators_base58[p] = v

    return network_validators_base58
Exemple #2
0
def network_validators58(network_validators):
    network_validators_base58 = {}
    for p, v in network_validators.items():
        p = public_key_from_ed25519_key(key_from_base64(p))
        network_validators_base58[p] = v

    return network_validators_base58
Exemple #3
0
def ed25519_node_keys(node_keys):
    (pub, priv) = list(node_keys.items())[0]
    node_keys_dict = {}
    for pub, priv in node_keys.items():
        key = key_pair_from_ed25519_key(key_from_base64(priv))
        node_keys_dict[key.public_key] = key

    return node_keys_dict
Exemple #4
0
def ed25519_node_keys(node_keys):
    (pub, priv) = list(node_keys.items())[0]
    node_keys_dict = {}
    for pub, priv in node_keys.items():
        key = key_pair_from_ed25519_key(key_from_base64(priv))
        node_keys_dict[key.public_key] = key

    return node_keys_dict
Exemple #5
0
    def get_validators(cls, bigchain, height=None):
        """Return a dictionary of validators with key as `public_key` and
           value as the `voting_power`
        """
        validators = {}
        for validator in bigchain.get_validators(height):
            # NOTE: we assume that Tendermint encodes public key in base64
            public_key = public_key_from_ed25519_key(key_from_base64(validator['public_key']['value']))
            validators[public_key] = validator['voting_power']

        return validators
    def get_validators(cls, bigchain, height=None):
        """Return a dictionary of validators with key as `public_key` and
           value as the `voting_power`
        """
        validators = {}
        for validator in bigchain.get_validators(height):
            # NOTE: we assume that Tendermint encodes public key in base64
            public_key = public_key_from_ed25519_key(key_from_base64(validator['pub_key']['data']))
            validators[public_key] = validator['voting_power']

        return validators
Exemple #7
0
def node_key(node_keys):
    (pub, priv) = list(node_keys.items())[0]
    return key_pair_from_ed25519_key(key_from_base64(priv))
Exemple #8
0
def load_node_key(path):
    with open(path) as json_data:
        priv_validator = json.load(json_data)
        priv_key = priv_validator['priv_key']['value']
        hex_private_key = key_from_base64(priv_key)
        return key_pair_from_ed25519_key(hex_private_key)
Exemple #9
0
def load_node_key(path):
    with open(path) as json_data:
        priv_validator = json.load(json_data)
        priv_key = priv_validator['priv_key']['value']
        hex_private_key = key_from_base64(priv_key)
        return key_pair_from_ed25519_key(hex_private_key)
Exemple #10
0
def node_key(node_keys):
    (pub, priv) = list(node_keys.items())[0]
    return key_pair_from_ed25519_key(key_from_base64(priv))