Skip to content

Instantly share code, notes, and snippets.

@BlinkyStitt
Last active April 25, 2021 23:06
Show Gist options
  • Save BlinkyStitt/89179917d209d10e6ea27c5f2f8f88f1 to your computer and use it in GitHub Desktop.
Save BlinkyStitt/89179917d209d10e6ea27c5f2f8f88f1 to your computer and use it in GitHub Desktop.

Running an Ethereum Node

There are several Ethereum nodes now, but I've had the best luck with Geth

OPTIONAL: open ports 30303 tcp and udp on your router to allow incoming network connections. this will use more CPU and bandwidth, but I've also had better luck syncing with it open.

DO NOT open ports 8545 or 8546. Those are for your own use on localhost only. If you do open these ports, you should put some sort of authentication in front of your node and probably enable less api modules.

OPTIONAL: add --snapshot to the geth command. it's an experimental feature that takes 15 GB more disk space, but it should make eth_calls faster. Be careful stopping your node abruptly or this state will have to be regenerated. If generation is going especially slow, start your node with --maxpeers 0, let the state generate, then restart without --maxpeers

RECOMMENDED: If you are going to be using ganache-cli --fork against this node, add --gcmode archive to the geth command. If we used --syncmode full this would take over 4TB. However, when combined with --syncmode fast, it will only keep archive state once it catches up (On May 23, 2020, my node with a couple weeks of archived state is at 304GB). If you do not do this, you will not be able to use ganache-cli --fork against this node for more than ~30 minutes (you will start to see errors about state tries missing)!

IMPORTANT: Do not try to sync on a computer with a Hard Disk! HDDs are just too slow to sync quickly. SSDs are faster, but you really want an NVME m.2 drive. I really like Samsung's drives: 970 Evo Plus

Recommended to start ASAP since this will take a few days:

geth --nat any --nousb --http --http.api admin,debug,eth,les,net,txpool,web3 --ws --ws.api admin,debug,eth,les,net,txpool,web3 --syncmode fast --snapshot

Once you plan on using ganache-cli --fork:

geth --nat any --nousb --http --http.api admin,debug,eth,les,net,txpool,web3 --ws --ws.api admin,debug,eth,les,net,txpool,web3 --syncmode fast --snapshot --gcmode archive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment