With the Go client, one can use the following command to create new accounts/keystore in a specified data dir:

geth --datadir ./data account new

While using the C++ client, there is no such option:

eth --db-path ./data account new

It doesn't work. Any pointers please?


In eth, you cannot use the account new parameter with the other options like --db-path.

When the first parameter to eth is account, the code at eth/main.cpp#L425-L429 returns the account manager code execution status:

if (argc > 1 && (string(argv[1]) == "wallet" || string(argv[1]) == "account"))
    AccountManager accountm;
    return !accountm.execute(argc, argv);

The code does not then proceed to parse the other command line options.

If you do not specify the account parameter in your command line, the code execution will skip the section account manager code execution section above and proceed to parse the command line options including the code to set the datadir at eth/main.cpp#L589-L590:

else if ((arg == "-d" || arg == "--path" || arg == "--db-path" || arg == "--datadir") && i + 1 < argc)

So it looks like the accounts created with account new will have to remain in the default path, but you can change the data directory using the --db-path option.

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.