Skip to content

Instantly share code, notes, and snippets.

@kdeme
Last active June 21, 2021 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kdeme/36795f5deae7d02ce1785e9c7d501e53 to your computer and use it in GitHub Desktop.
Save kdeme/36795f5deae7d02ce1785e9c7d501e53 to your computer and use it in GitHub Desktop.
Portal wire interop

nim-eth Portal Wire interop

nim-eth Portal Wire implementation first interop tests with ddht and trin.

Similar as in this gist: https://gist.github.com/carver/f3c26d9adb28ea2b4e5d5bbe42b4f4b7

How to use nim-eth portalcli, a quick Portal Wire cli test tool: https://github.com/status-im/nim-eth/tree/master/eth/p2p/portal

Testing with ddht / trin as "bootnodes"

With ddht:

https://github.com/ethereum/ddht/

# Start ddht
ddht --listen-address <local network ip address> --disable-upnp --port 12345 --log-level-stderr 10 --private-key 7261696e626f7773756e69636f726e737261696e626f7773756e69636f726e73 alexandria
# Manually copy encoded ENR from logs

# Other shell: Launch Ping request from nim-eth portalcli
./eth/p2p/portal/portalcli --nat:extip:<local network ip address> --listen-address:<local network ip address> ping <encoded enr copied in above step>
# Or FindNodes
./eth/p2p/portal/portalcli --nat:extip:<local network ip address> --listen-address:<local network ip address> findnodes <encoded enr copied in above step>
# Or FindContent
./eth/p2p/portal/portalcli --nat:extip:<local network ip address> --listen-address:<local network ip address> findcontent <encoded enr copied in above step>
# Or just run the node
./eth/p2p/portal/portalcli --nat:extip:<local network ip address> --listen-address:<local network ip address> --bootnode:<encoded enr copied in above step>

With trin:

https://github.com/carver/trin

# Start trin
TRIN_INFURA_PROJECT_ID=<id> RUST_LOG=debug cargo run
# Manually copy encoded ENR from logs

# Other shell: Launch Ping request from nim-eth portalcli
./eth/p2p/portal/portalcli --nat:extip:<local network ip address> --listen-address:<local network ip address> ping <encoded enr copied in above step>

# FindNodes
./eth/p2p/portal/portalcli --nat:extip:<local network ip address> --listen-address:<local network ip address> findnodes <encoded enr copied in above step>

# FindContent requests are not implemented afaik

# Or just run the node
./eth/p2p/portal/portalcli --nat:extip:<local network ip address> --listen-address:<local network ip address> --bootnode:<encoded enr copied in above step>

Other way around:

# launch portalcli
./eth/p2p/portal/portalcli --nat:extip:<local network ip address>  --listen-address:<local network ip address>
# Manually copy encoded ENR from logs

ddht:

ddht --listen-address <local network ip address>  --disable-upnp --port 12345 --log-level-stderr 10  alexandria --bootnode <encoded enr copied in above step>

# ddht seems to send a lot of ping requests. But they all work and get responses.
# portalcli is currently only sending base layer ping/pongs

trin:

TRIN_INFURA_PROJECT_ID=<id> RUST_LOG=debug cargo run -- --bootnodes <encoded enr copied in above step>

# Portal ping/pong is occuring (baselayer talkreq/talkresp)
# portalcli is currently only sending base layer ping/pongs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment