Scenario -
Some of us run gaiad as a systemd service, using a specified user and gaiad home directory. Here’s an outdated script that creates the user and directory. It also starts gaiad using the specified home directory. The script is outdated, however the steps are the same for any testnet.
(Script written by @kwunyeung)
I’ve experienced confusion when declaring validator candidacy using this configuration. The confusion comes from having two different config directories -
~/.gaiad/config/ (This is the gaiad home directory of the user you’re logged-in as.)
/opt/gaiad/config/ (This is the gaiad home directory of the user the script runs gaiad as.)
I’m leaving the explanation in raw format. My hope is to come back to edit it. For now, I solved my issue by -
-stopping gaiad
-moving the priv_validator.json file in my /opt/gaiad/config/ to a different filename, effectively making it not usable by gaiad
-copying the priv_validator.json file from my ~/.gaiad/config/ to my /opt/gaiad/config/
-restarting gaiad
Here’s some raw feedback from @mattharrop and @kwunyeung explaining the issue in greater detail -
From @mattharrop -
This is a confusing issue. I don’t think I have 100% clarity on it, but let me see if I can help. Before you declare your candidacy, you use the gaiad tendermint … command to find your node’s ID, which you’ll use when you declare candidacy.
If you just the command like that, gaiad will run as your logged in user, look in ~/.gaiad/config for it’s configuration files, and if it doesn’t find any it will make them. Then, when you run the service, gaiad is running as user gaiad and looking in /opt/gaiad/config for it’s files, and if it doesn’t find any it will make them. So you now have two identities on your server.
So I think the solution here is to run gaiad tendermint … using sudo gaiad and make sure to specificy the home directory, exactly the way the service is configured to run it.
From @kwunyeung -
-
The key is associated with the delegator address
-
If your run the gaiad as a service and have already pointed to —home=/opt/gaiad then you don’t have to touch gaiad
-
Please be reminded that gaiad and gaiacli are two different things
-
All the config and priv_validator.json are for gaiad to run
-
gaiacli is accessing keys to send tx
-
Or query the data from the chain
-
As you are using gaiacli to create validator, you don’t have to think where the gaiad config are
-
You should consider what keys your are using to sign those operations
-
So the key “chainuser010” in your case is the key for the delegator address you defined in your command
-
Which holds the steak
-
Please be reminded that gaiad and gaiacli are two different things
That’s why when you want to see your node id and validator pubkey, you are calling gaiad, node_key.json and priv_validator.json are inside gaiad/config. When you send coin you use gaiacli as it reads your keys to access your account (wallet).
- If your problem is about priv_validator.json, then it’s about gaiad but not gaiacli command