ethereum / ethereum/devp2p

discv5: add FINDNODEATT message

Open
#151 8 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.1k
Forks
297
Avg merge
5h 50m
Merged PRs (30d)
1

Description

HI!
I've made another research, this one dedicated to efficiency, comparing ENR attribute and topic advertisement, and want to make a proposal which is going to dramatically improve search speed of ENR with certain attributes.
Here's a proposal:

---
In order to improve search time and reduce traffic for ENR attribute, make possible to find even smaller attributed fractions in network in small time and decrease traffic in all ENR search cases, following Discovery V5 API is proposed:

---

### FINDNODEATT Request (0x09)

message-data = [request-id, attribute-key, (attribute-value)]
message-type = 0x09
attribute-key = searched ENR attribute key
attribute-value = (optional) searched ENR attribute value for provided key

FINDNODEATT queries for nodes with non-null ENR attribute identified by `attribute-key`.
If optional parameter `attribute-value` is provided, only ENRs with `attribute-key == attribute-value` should be returned. Maximum number of returned records is `K-BUCKET`. If more than `K-BUCKET` records are found by search, it is recommended to return a random subset of `K-BUCKET` size from it.

---

Optionality of `attribute-value` could be used for other features, when most nodes in a network are in one of subnetworks, omitting this field doesn’t improve search speed and traffic, so we are going to use it with `attribute-value` provided. This should limit output only to nodes that belong to a subnetwork of search and provide the answer from each peer in one query. Let’s see the results with 64 nodes advertised in 10,000 peers network. We are going to find 8 of them. We also applied 16 nodes limit to topic advertisement too.

We got 1.4 seconds on average search and just 3.3 Kb of traffic per searcher!

![](https://i.imgur.com/KaBSfS8.png)

---

What do you think about it? I want it too be added to Discovery V5.
Full research if you are interested in is [here](https://hackmd.io/@zilm/BJGorvHzL)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.