Aug 5, 2024 by Arnaud Stoz | 252 views
If you have already played with geth, you probably have already noticed the --dev
option. This option is very handy when you want to quickly start a node to test something. However, you might have found that the developer account which is automatically set is a random account. This randomness can be annoying when trying to automate some testing tasks. The good news is that there is a way to set this developer account. That’s what will be explained in this small blog post.
The first step is to create an account. (If you already have a keystore and want to use that account, feel free to skip to the next section).
We will use clef to create the account. The following command will prompt you for a password and create the account in the keystore
folder:
clef newaccount --keystore keystore
Once the account is created, we can now define it as the developer account when starting the dev node. To set the developer account we will use the two geth options:
--keystore
to specify the path to the folder created by clef.--password
to specify the password to unlock the account.Note that the --password
option does not read directly from stdin but takes a path to a file which contains the password to unlock the account.
The full command is given below but other flags can obviously be added:
geth --keystore keystore --password password.txt --dev
This blog post is licensed under CC BY-SA 4.0