tuweni / org.apache.tuweni.devp2p / EthereumNodeRecord

EthereumNodeRecord

class EthereumNodeRecord (source)

Ethereum Node Record (ENR) as described in EIP-778.

Parameters

signature - the record signature

seq - the sequence of the record, its revision number

data - the arbitrary data of the record

listData - the arbitrary data of the record as list

Constructors

<init>

Ethereum Node Record (ENR) as described in EIP-778.

EthereumNodeRecord(signature: Bytes, seq: Long, data: Map<String, Bytes>, listData: Map<String, List<Bytes>> = emptyMap(), rlp: Bytes)

Properties

data

the arbitrary data of the record

val data: Map<String, Bytes>

listData

the arbitrary data of the record as list

val listData: Map<String, List<Bytes>>

rlp

val rlp: Bytes

seq

the sequence of the record, its revision number

val seq: Long

signature

the record signature

val signature: Bytes

Functions

equals

fun equals(other: Any?): Boolean

hashCode

fun hashCode(): Int

ip

The ip associated with the ENR

fun ip(): InetAddress

nodeId

Derives the public key of an ethereum node record into a unique 32 bytes hash.

fun nodeId(): Bytes32

publicKey

The ENR public key entry

fun publicKey(): PublicKey

publicKeyBytes

The ENR public key entry bytes

fun publicKeyBytes(): Bytes

seq

fun seq(): Long

tcp

The TCP port of the ENR

fun tcp(): Int?

toRLP

fun toRLP(): Bytes

toString

fun toString(): String

udp

The UDP port of the ENR

fun udp(): Int?

validate

Validates an ENR to check that it conforms to a valid ENR scheme.

fun validate(): Unit

Companion Object Functions

create

Creates the serialized form of a ENR

fun create(signatureKeyPair: KeyPair, seq: Long = Instant.now().toEpochMilli(), data: Map<String, Bytes>? = null, listData: Map<String, List<Bytes>>? = null, ip: InetAddress, tcp: Int? = null, udp: Int? = null): EthereumNodeRecord

encode

fun encode(signatureKeyPair: KeyPair? = null, seq: Long = Instant.now().toEpochMilli(), ip: InetAddress? = null, tcp: Int? = null, udp: Int? = null, data: Map<String, Bytes>? = null, listData: Map<String, List<Bytes>>? = null, writer: RLPWriter): Unit

fromRLP

Creates an ENR from its serialized form as a RLP list

fun fromRLP(rlp: Bytes): EthereumNodeRecord
fun fromRLP(reader: RLPReader): EthereumNodeRecord
fun fromRLP(reader: RLPReader, rlp: Bytes): EthereumNodeRecord

nodeId

Derives the public key of an ethereum node record into a unique 32 bytes hash.

fun nodeId(publicKey: PublicKey): Bytes32

toRLP

Creates the serialized form of a ENR

fun toRLP(signatureKeyPair: KeyPair, seq: Long = Instant.now().toEpochMilli(), data: Map<String, Bytes>? = null, listData: Map<String, List<Bytes>>? = null, ip: InetAddress, tcp: Int? = null, udp: Int? = null): Bytes