## Ethereum from scratch - Part 1: Ping

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

0 rickw 4 months 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 8 months, 3 weeks ago

There is a Ping message in ÐΞVp2p (https://github.com/ethereum/wiki/wiki/%C3%90%CE%9EVp2p-Wire-Protocol) and a Ping payload in RLPx (https://github.com/ethereum/devp2p/blob/master/rlpx.md). What is the relationship between the two?

0 mikejf 8 months, 3 weeks 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 8 months, 2 weeks 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 8 months, 2 weeks 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 9 months 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 9 months 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 ago

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

0 mikejf 9 months ago

I think you forgot to do

pip install rlp