0

When I as a user make a transaction, where or what node(s) does it get sent to first? How does an Ethereum node, in terms of implementation details, determine that? Does it send a new transaction to, say, 1 random or multiple random node? Or to a certain one(s) that meet a certain criteria?

Or to the all nodes in the world?

Also, does an Ethereum node keep a list of all the nodes in the world, dynamically, in RAM, and periodically refreshe it? Or does it do it at startup and then simply works with that, never refreshing a list?

1

When I as a user make a transaction, where or what node(s) does it get sent to first?

The nodes your node knows about - its connected peers. This will be a subset of the entire network. (Explained in more detail later.)

How does an Ethereum node, in terms of implementation details, determine that?

Ethereum uses its own set of networking and peer-discovery protocols (under the devp2p umbrella).

When your client node joins the network it has a hard-coded set of boot nodes that it knows about and talks to. (The Geth client bootnodes can be found in bootnodes.go)

Having completed the initial boot from these bootnodes, it then uses a peer discovery protocol (part of devp2p) to develop a larger picture of the network. (Peer discovery is based around DHT/Kademlia, and is detailed here.)

Does it send a new transaction to, say, 1 random or multiple random node?

It sends the transaction to all known peers.

Also, does an Ethereum node keep a list of all the nodes in the world, dynamically, in RAM, and periodically refreshe it?

As mentioned above, Ethereum uses a Kademlia-like DHT-based protocol. (Kademlia is widely used in networking, it's not Ethereum specific.)

A node keeps its own version of a distributed hash table (DHT) detailing its set of neighbouring nodes, in memory. If it receives a newer version of the hash table from one of its peers, it updates its own.

"Neighbouring nodes" are defined in such a way that a node won't know about the entire network, just a subset. (The implementation details of how to calculate neighbouring nodes, and how many of them there are, is here.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.