Skip to content

Commit

Permalink
Automatically merged updates to draft EIP(s) 778 (#2087)
Browse files Browse the repository at this point in the history
Hi, I'm a bot! This change was automatically merged because:

 - It only modifies existing Draft or Last Call EIP(s)
 - The PR was approved or written by at least one author of each modified EIP
 - The build is passing
  • Loading branch information
fjl authored and eip-automerger committed May 27, 2019
1 parent ae0c0d8 commit 9b1c22d
Showing 1 changed file with 30 additions and 26 deletions.
56 changes: 30 additions & 26 deletions EIPS/eip-778.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@ The components of a node record are:
A record's signature is made and validated according to an *identity scheme*. The identity
scheme is also responsible for deriving a node's address in the DHT.

The keys in key/value pairs can technically be any byte sequence, but ASCII text is
preferred. Keys in the table below have pre-defined meaning.

| Key | Value |
|:------------|:------------------------------------------|
| `id` | name of identity scheme, e.g. "v4" |
| `secp256k1` | compressed secp256k1 public key, 33 bytes |
| `ip` | IPv4 address, 4 bytes |
| `ip6` | IPv6 address, 16 bytes |
| `tcp` | TCP port, big endian integer |
| `udp` | UDP port, big endian integer |

All keys except `id` are optional.

### RLP Encoding

The canonical encoding of a node record is an RLP list of `[signature, seq, k, v, ...]`.
Expand All @@ -57,18 +71,10 @@ Records are signed and encoded as follows:
signature = sign(content)
record = [signature, seq, k, v, ...]

### Key/Value Pairs
### Text Encoding

The keys in key/value pairs can technically be any byte sequence, but ASCII text is
preferred. The following keys are pre-defined:

| Key | Value |
|:------------|:------------------------------------------|
| `id` | name of identity scheme, e.g. "v4" |
| `secp256k1` | compressed secp256k1 public key, 33 bytes |
| `ip` | IP address, 4 or 16 bytes |
| `tcp` | TCP port, big endian integer |
| `udp` | UDP port, big endian integer |
The textual form of a node record is the base64 encoding of its RLP representation,
prefixed by `enr:`.

### "v4" Identity Scheme

Expand Down Expand Up @@ -101,17 +107,23 @@ metadata.

# Test Vectors

Example (valid) record:
This is an example record containing the IPv4 address `127.0.0.1` and UDP port `30303`.
The node ID is `a448f24c6d18e575453db13171562b71999873db5b286df957af199ec94617f7`.

```text
f884b8407098ad865b00a582051940cb9cf36836572411a4727878307701
1599ed5cd16b76f2635f4e234738f30813a89eb9137e3e3df5266e3a1f11
df72ecf1145ccb9c01826964827634826970847f00000189736563703235
366b31a103ca634cae0d49acb401d8a4c6b6fe8c55b70d115bf400769cc1
400f3258cd31388375647082765f
enr:+IS4QHCYrYZbAKWCBRlAy5zzaDZXJBGkcnh4MHcBFZntXNFrdvJjX04jRzjzCBOonrkTfj
499SZuOh8R33Ls8RRcy5wBgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQPKY0yuDUmstAHYpMa2
/oxVtw0RW/QAdpzBQA8yWM0xOIN1ZHCCdl8=
```

The raw RLP structure of this record is:
The record is signed using the "v4" identity scheme using sequence number `1` and this
private key:

```text
b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291
```

The RLP structure of the record is:

```text
[
Expand All @@ -128,14 +140,6 @@ The raw RLP structure of this record is:
]
```

The record contains sequence number `1`.

A v4 enode URL containing the same information (but no signature or sequence number):

```text
enode://ca634cae0d49acb401d8a4c6b6fe8c55b70d115bf400769cc1400f3258cd31387574077f301b421bc84df7266c44e9e6d569fc56be00812904767bf5ccd1fc7f@127.0.0.1:0?discport=30303
```

# Copyright

Copyright and related rights waived via CC0.

0 comments on commit 9b1c22d

Please sign in to comment.