Ethereum from scratch - Part 1: Ping

by mikejf, July 20, 2017, 8:47 a.m., 9 comments



0 rickw 8 months, 1 week ago

The version byte '\x03' yields this error on rip.encode:

TypeError: Did not find sedes handling type str

installing rlp from GitHub fixes this

then this line needs an .encode()

payload = sig_serialized[0] + chr(sig_serialized[1]).encode() + payload

0 nsubrahm 1 year ago

There is a Ping message in ÐΞVp2p ( and a Ping payload in RLPx ( What is the relationship between the two?

0 mikejf 1 year ago

They are the same type of message, but are for different protocols. The Ping in the first link is for the "wire protocol", for sending data over the network, and the Ping in the second link is that for the "discovery protocol", for locating peers. Here I focus on the discovery protocol and after that is implemented I will implement the wire protocol.

0 nsubrahm 1 year ago

Ok. And, so the sequence is to do a RLPx Ping followed by a ÐΞVp2p Ping (of course, after successful Pong from RLPx)?

0 mikejf 1 year ago

RLPx is a subset of DEVp2p. If you are referring to the handshake then yes, you are correct. It goes [You: PING, Them: Pong, Them: Ping, You: Pong] and then you have an established relationship.

0 nsubrahm 1 year, 1 month ago

I am yet to test this. But, shouldn't you start up a `their_endpoint` instance with a running `udp_listen()` thread - ideally on a different machine?

0 mikejf 1 year, 1 month ago

I could do that, it was just easier with this set up to have `their_endpoint` be the same machine . In later parts I communicate with different machines using this protocol - in part 2 actually!

0 bikeshrestha 1 year, 4 months ago

Traceback (most recent call last):
File "", line 1, in <module>
from discovery import EndPoint, PingNode, PingServer
File "/home/gori/PyEthTutorial/pyethtutorial/", line 5, in <module>
import rlp
ImportError: No module named rlp

0 mikejf 1 year, 1 month ago

I think you forgot to do

pip install rlp