ethereumjs-monorepo

@ethereumjs/devp2p / ENR

Class: ENR

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new ENR()

Properties

BRANCH_PREFIX

Static Readonly BRANCH_PREFIX: "enrtree-branch:"

Defined in

packages/devp2p/src/dns/enr.ts:34


RECORD_PREFIX

Static Readonly RECORD_PREFIX: "enr:"

Defined in

packages/devp2p/src/dns/enr.ts:32


ROOT_PREFIX

Static Readonly ROOT_PREFIX: "enrtree-root:"

Defined in

packages/devp2p/src/dns/enr.ts:35


TREE_PREFIX

Static Readonly TREE_PREFIX: "enrtree:"

Defined in

packages/devp2p/src/dns/enr.ts:33

Methods

_getIpProtocolConversionCodes

Static _getIpProtocolConversionCodes(protocolId): ProtocolCodes

Gets relevant multiaddr conversion codes for ipv4, ipv6 and tcp, udp formats

Parameters

Name Type
protocolId Uint8Array

Returns

ProtocolCodes

Defined in

packages/devp2p/src/dns/enr.ts:182


parseAndVerifyRecord

Static parseAndVerifyRecord(enr): PeerInfo

Converts an Ethereum Name Record (EIP-778) string into a PeerInfo object after validating its signature component with the public key encoded in the record itself.

The record components are:

signature: cryptographic signature of record contents seq: The sequence number, a 64-bit unsigned integer which increases whenever the record changes and is republished. A set of arbitrary key/value pairs

Parameters

Name Type
enr string

Returns

PeerInfo

Defined in

packages/devp2p/src/dns/enr.ts:50


parseAndVerifyRoot

Static parseAndVerifyRoot(root, publicKey): string

Extracts the branch subdomain referenced by a DNS tree root string after verifying the root record signature with its base32 compressed public key. Geth’s top level DNS domains and their public key can be found in: go-ethereum/params/bootnodes

Parameters

Name Type Description
root string (See EIP-1459 for encoding details)
publicKey string -

Returns

string

subdomain subdomain to retrieve branch records from.

Defined in

packages/devp2p/src/dns/enr.ts:101


parseBranch

Static parseBranch(branch): string[]

Returns subdomains listed in an ENR branch entry. These in turn lead to either further branch entries or ENR records.

Parameters

Name Type
branch string

Returns

string[]

Defined in

packages/devp2p/src/dns/enr.ts:170


parseTree

Static parseTree(tree): ENRTreeValues

Returns the public key and top level domain of an ENR tree entry. The domain is the starting point for traversing a set of linked DNS TXT records and the public key is used to verify the root entry record

Parameters

Name Type Description
tree string (See EIP-1459 )

Returns

ENRTreeValues

Defined in

packages/devp2p/src/dns/enr.ts:147