eth_enr package¶
Submodules¶
eth_enr.abc module¶
-
class
eth_enr.abc.CommonENRAPI¶ Bases:
collections.abc.Mapping,typing.Generic,abc.ABC-
get_signing_message() → bytes¶
-
identity_scheme¶
-
node_id¶
-
public_key¶
-
sequence_number¶
-
-
class
eth_enr.abc.ENRAPI¶ Bases:
eth_enr.abc.CommonENRAPI-
classmethod
from_repr(representation: str, identity_scheme_registry: collections.UserDict) → eth_enr.abc.ENRAPI¶
-
signature¶
-
validate_signature() → None¶
-
classmethod
-
class
eth_enr.abc.ENRDatabaseAPI¶ Bases:
abc.ABC-
delete_enr(node_id: NewType.<locals>.new_type) → None¶
-
get_enr(node_id: NewType.<locals>.new_type) → eth_enr.abc.ENRAPI¶
-
set_enr(enr: eth_enr.abc.ENRAPI, raise_on_error: bool = False) → None¶
-
-
class
eth_enr.abc.ENRManagerAPI¶ Bases:
abc.ABC-
enr¶
-
update(*kv_pairs) → None¶ Update the ENR record with the provided key/value pairs. Providing None for a value will result in the associated key being removed from the ENR.
-
-
class
eth_enr.abc.IdentitySchemeAPI¶ Bases:
abc.ABC-
classmethod
create_enr_signature(enr: eth_enr.abc.CommonENRAPI, private_key: bytes) → bytes¶ Create and return the signature for an ENR.
-
classmethod
extract_node_id(enr: eth_enr.abc.CommonENRAPI) → NewType.<locals>.new_type¶ Retrieve the node id from an ENR.
-
classmethod
extract_public_key(enr: eth_enr.abc.CommonENRAPI) → bytes¶ Retrieve the public key from an ENR.
-
classmethod
validate_enr_signature(enr: eth_enr.abc.ENRAPI) → None¶ Validate the signature of an ENR.
-
classmethod
validate_enr_structure(enr: eth_enr.abc.CommonENRAPI) → None¶ Validate that the data required by the identity scheme is present and valid in an ENR.
-
classmethod
-
class
eth_enr.abc.QueryableENRDatabaseAPI¶ Bases:
eth_enr.abc.ENRDatabaseAPI-
query(*constraints) → Iterable[eth_enr.abc.ENRAPI]¶
-
-
class
eth_enr.abc.UnsignedENRAPI¶ Bases:
eth_enr.abc.CommonENRAPI-
to_signed_enr(private_key: bytes) → eth_enr.abc.ENRAPI¶
-
eth_enr.constants module¶
eth_enr.enr module¶
-
class
eth_enr.enr.ENR(sequence_number: int, kv_pairs: Mapping[bytes, Any], signature: bytes, identity_scheme_registry: collections.UserDict = {b'v4': <class 'eth_enr.identity_schemes.V4IdentityScheme'>, b'v4-compat': <class 'eth_enr.identity_schemes.V4CompatIdentityScheme'>})¶ Bases:
eth_enr.enr.ENRCommon,eth_enr.sedes.ENRSedes,eth_enr.abc.ENRAPI-
classmethod
from_repr(representation: str, identity_scheme_registry: collections.UserDict = {b'v4': <class 'eth_enr.identity_schemes.V4IdentityScheme'>, b'v4-compat': <class 'eth_enr.identity_schemes.V4CompatIdentityScheme'>}) → eth_enr.enr.ENR¶
-
signature¶
-
validate_signature() → None¶
-
classmethod
-
class
eth_enr.enr.ENRCommon(sequence_number: int, kv_pairs: Mapping[bytes, Any], identity_scheme_registry: collections.UserDict = {b'v4': <class 'eth_enr.identity_schemes.V4IdentityScheme'>, b'v4-compat': <class 'eth_enr.identity_schemes.V4CompatIdentityScheme'>})¶ Bases:
eth_enr.abc.CommonENRAPI-
get(k[, d]) → D[k] if k in D, else d. d defaults to None.¶
-
get_signing_message() → bytes¶
-
identity_scheme¶
-
items() → a set-like object providing a view on D's items¶
-
keys() → a set-like object providing a view on D's keys¶
-
node_id¶
-
public_key¶
-
sequence_number¶
-
values() → an object providing a view on D's values¶
-
-
class
eth_enr.enr.UnsignedENR(sequence_number: int, kv_pairs: Mapping[bytes, Any], identity_scheme_registry: collections.UserDict = {b'v4': <class 'eth_enr.identity_schemes.V4IdentityScheme'>, b'v4-compat': <class 'eth_enr.identity_schemes.V4CompatIdentityScheme'>})¶ Bases:
eth_enr.enr.ENRCommon,eth_enr.abc.UnsignedENRAPI-
to_signed_enr(private_key: bytes) → eth_enr.enr.ENR¶
-
-
eth_enr.enr.pretty_print_enr_item(key: bytes, value: Union[int, bytes]) → str¶
eth_enr.enr_manager module¶
-
class
eth_enr.enr_manager.ENRManager(private_key: eth_keys.datatypes.PrivateKey, enr_db: eth_enr.abc.ENRDatabaseAPI, kv_pairs: Optional[Mapping[bytes, bytes]] = None, identity_scheme_registry: collections.UserDict = {b'v4': <class 'eth_enr.identity_schemes.V4IdentityScheme'>, b'v4-compat': <class 'eth_enr.identity_schemes.V4CompatIdentityScheme'>})¶ Bases:
eth_enr.abc.ENRManagerAPI-
enr¶
-
logger= <Logger eth_enr.ENRManager (WARNING)>¶
-
update(*kv_pairs) → None¶ Update the ENR record with the provided key/value pairs. Providing None for a value will result in the associated key being removed from the ENR.
-
eth_enr.identity_schemes module¶
-
class
eth_enr.identity_schemes.IdentitySchemeRegistry(**kwargs)¶ Bases:
collections.UserDict-
register(identity_scheme_class: Type[IdentitySchemeAPI]) → Type[eth_enr.abc.IdentitySchemeAPI]¶ Class decorator to register identity schemes.
-
-
class
eth_enr.identity_schemes.V4CompatIdentityScheme¶ Bases:
eth_enr.identity_schemes.V4IdentitySchemeAn identity scheme to be used for locally crafted ENRs representing remote nodes that don’t support the ENR extension.
ENRs using this identity scheme have a zero-length signature.
-
classmethod
create_enr_signature(enr: eth_enr.abc.CommonENRAPI, private_key: bytes) → bytes¶ Create and return the signature for an ENR.
-
id= b'v4-compat'¶
-
classmethod
validate_enr_signature(enr: eth_enr.abc.ENRAPI) → None¶ Validate the signature of an ENR.
-
classmethod
-
class
eth_enr.identity_schemes.V4IdentityScheme¶ Bases:
eth_enr.abc.IdentitySchemeAPI-
classmethod
create_enr_signature(enr: eth_enr.abc.CommonENRAPI, private_key: bytes) → bytes¶ Create and return the signature for an ENR.
-
classmethod
extract_node_id(enr: eth_enr.abc.CommonENRAPI) → NewType.<locals>.new_type¶ Retrieve the node id from an ENR.
-
classmethod
extract_public_key(enr: eth_enr.abc.CommonENRAPI) → bytes¶ Retrieve the public key from an ENR.
-
id= b'v4'¶
-
private_key_size= 32¶
-
public_key_enr_key= b'secp256k1'¶
-
classmethod
validate_compressed_public_key(public_key: bytes) → None¶
-
classmethod
validate_enr_signature(enr: eth_enr.abc.ENRAPI) → None¶ Validate the signature of an ENR.
-
classmethod
validate_enr_structure(enr: eth_enr.abc.CommonENRAPI) → None¶ Validate that the data required by the identity scheme is present and valid in an ENR.
-
classmethod
validate_signature(*, message_hash: bytes, signature: bytes, public_key: bytes) → None¶
-
classmethod
validate_uncompressed_public_key(public_key: bytes) → None¶
-
classmethod
eth_enr.sedes module¶
-
class
eth_enr.sedes.ENRContentSedes¶ Bases:
object-
classmethod
deserialize(serialized_enr: Sequence[bytes], identity_scheme_registry: collections.UserDict = {b'v4': <class 'eth_enr.identity_schemes.V4IdentityScheme'>, b'v4-compat': <class 'eth_enr.identity_schemes.V4CompatIdentityScheme'>}) → eth_enr.abc.UnsignedENRAPI¶
-
classmethod
serialize(enr: eth_enr.abc.ENRAPI) → Tuple[bytes, ...]¶
-
classmethod
-
class
eth_enr.sedes.ENRSedes¶ Bases:
object-
classmethod
deserialize(serialized_enr: Sequence[bytes], identity_scheme_registry: collections.UserDict = {b'v4': <class 'eth_enr.identity_schemes.V4IdentityScheme'>, b'v4-compat': <class 'eth_enr.identity_schemes.V4CompatIdentityScheme'>}) → eth_enr.abc.ENRAPI¶
-
classmethod
serialize(enr: eth_enr.abc.ENRAPI) → Tuple[bytes, ...]¶
-
classmethod