Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request peer ENR via discv5 PING on eth/v1/node/peers #3377

Open
twoeths opened this issue Oct 19, 2021 · 3 comments
Open

Request peer ENR via discv5 PING on eth/v1/node/peers #3377

twoeths opened this issue Oct 19, 2021 · 3 comments
Labels
meta-investigate Issues found that require further investigation and may not have a specific resolution/fix prio-low This is nice to have. scope-networking All issues related to networking, gossip, and libp2p.

Comments

@twoeths
Copy link
Contributor

twoeths commented Oct 19, 2021

Describe the bug

enr field is empty when I issue this curl

curl http://127.0.0.1:4000/eth/v1/node/peers/16Uiu2HAmSFKTBw2ydr3efM5QNZRBA9LYxpCBJw8SFWtA61rAmEzp
{"data":{"peer_id":"16Uiu2HAmSFKTBw2ydr3efM5QNZRBA9LYxpCBJw8SFWtA61rAmEzp","enr":"","last_seen_p2p_address":"/ip4/137.184.110.216/tcp/38254","direction":"inbound","state":"connected"}}

Expected behavior

enr should have some value inside like in the api spec https://ethereum.github.io/beacon-APIs/#/Node/getPeer

@twoeths twoeths self-assigned this Oct 20, 2021
@twoeths
Copy link
Contributor Author

twoeths commented Oct 20, 2021

Using this

const keypair = createKeypairFromPeerId(conn.remotePeer);
    const nodeIdValue = nodeId(keypair.publicKey);
    const enr = network.discv5?.getKadValue(nodeIdValue);
    if (enr) {
      enrStr = enr.encodeTxt();
    }

I can only find enr of 1 per 10-15 peers. I guess one of the reasons is not all peers go through discv5, they could come from libp2p.
@wemeetagain are there any apis to request enr of these peers somehow?

@wemeetagain
Copy link
Member

If we know that the peer is running discv5 (and we know which port), we can issue a discv5 PING to the peer, then the PONG will include their ENR.

@philknows philknows added the scope-networking All issues related to networking, gossip, and libp2p. label Jan 24, 2022
@dapplion dapplion added the prio-low This is nice to have. label Feb 4, 2022
@dapplion dapplion changed the title Missing enr field in peers api Request peer ENR via discv5 PING on eth/v1/node/peers May 24, 2023
@philknows philknows added the meta-investigate Issues found that require further investigation and may not have a specific resolution/fix label Nov 5, 2023
@wemeetagain
Copy link
Member

Currently, there is no foolproof way to retrieve a peer's ENR from their peer-id+ip+tcp since we don't know their discovery port.
We would need something like ethereum/consensus-specs#3861

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta-investigate Issues found that require further investigation and may not have a specific resolution/fix prio-low This is nice to have. scope-networking All issues related to networking, gossip, and libp2p.
Projects
None yet
Development

No branches or pull requests

4 participants