Hii, this is my first post here and I will be using this medium to curate my journey through the ethereum protocol fellowship.

My initial notes are actually here; there, you will find me going in on Ephemery, i also mention RIG's cryptoeconomic problems as well.

Running nodes and clients for the first time

The focus of today's post, will be on the the bugs i encountered while trying to reproduce the week2's Office hour tutorial organized by Mario on running a node and clients.

The first 50mins of the presentation was actually smooth sailing for me, until we got to the part about running public networks like Ephemery.

In retrospect all the bugs where directory related, and here they are:

  1. geth: geth command not found
    I got this error while trying to initialize ephemery's genesis state with:

    $ ./geth init /Downloads/ephemery/genesis.json

    This was a directory path problem. The geth installation was only executable in its folder. Which means if i wanted to use geth, i had to navigate to its directory to use it.

    A temporary solution was to copy ephemery into geth's folder, but that isn't optimal at all, as i would have to do the same for lighthouse, nimbus, et al.

    A more proper solution requires an understanding of directory paths and how they work when executing programs.

    For that we need PATH. We can call PATH on the terminal using:

    $ echo $PATH

    This will return something like this:

    usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin

    Here, PATH is returning directories that contain programs Linux executes globally from anywhere in the terminal.

    Thus i can solve this problem in two ways:

    • I can add geth to one of the current directories available under PATH f.e by using a symbolic link:

    $ sudo ln -s /home/yourusername/Downloads/geth /usr/local/bin/geth

    • I can add the geth directory itself to the PATH variable via the bash.src file using:

    $ export PATH=$PATH:/home/yourusername/Downloads/geth

    On closing and reopening the terminal, geth (or any other client for that matter) should work.

  2. Fatal: Failed to write genesis block: database contains incompatible genesis (have d4e56740f876aef8c010b86a40d5fmamamatrma
    I got this error also while trying to initialize ephemery's genesis state with the geth init command as above

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

    This was a bit obfuscating and solving it required being quite literal with the solution i found online (warning: it's in japanese!).

Apparently, the database geth was writing to, was the wrong one, and i needed to specify the right one using --datadir.

Solution:

$ geth init --datadir data genesis.json

This command pointed geth to the correct data directory and successfully initialized genesis.json.

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Successful initialization

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Failed initialization

Notice the difference in the database being written to in the terminal logs!

  1. ERROR Failed jwt authorization error: InvalidToken, service: exec
    I got this error while trying to run ephemery using lighthouse

    $ lighthouse bn --testnet-dir ~/Downloads/ephemery --execution-endpoint http://127.0.0.1:8551 --execution-jwt=" /home/yourusername/Downloads/ephemery/gethdata/geth/jwtsecret" --boot-nodes "enr:-Iq4QNMYHuJGbnXyBj6FPS2UkOQ-hnxT-mIdNMMr7evR9UYtLemaluorL6J10RoUG1V4iTPTEbl3huijSNs5_ssBWFiGAYhBNHOzgmlkgnY0gmlwhIlKy_CJc2VjcDI1NmsxoQNULnJBzD8Sakd9EufSXhM4rQTIkhKBBTmWVJUtLCp8KoN1ZHCCIyk"

    This was a whitespace error in the directory pointing to the jwtsecret folder! Clients like lighthouse and besu do not support trailing newline/whitespace characters.

Bonus Bugs