Generate a new Groestlcoin address (wallet) and list wallets and addresses using command line cli verson 25.0.0

This article an updated version of Generate a new Groestlcoin address (wallet) and list accounts and addresses, because it appeared many things handling the wallets and address with the command-line have changed.

main menu
new wallet and address

The generation of a new Groestlcoin address is relatively simple, just use the command line tool – groestlcoin-cli, which is a Groestlcoin Core RPC client talking to the Groestlcoin node. So a working and synchronized Groestlcoin node is needed. Check out Building from source and run a Groestlcoin node (cli only) under Ubuntu 22.04 LTS for more information how to build and run a Groestlcoin node.

DO NOT TRUST any online website or any other Internet source to generate your Groestlcoin wallet address for you. DO IT YOURSELF with the official software from the official site!
If the user followed the above link to build and run a Groestlcoin and has waited to synchronize, it is time to use the groestlcoin-cli to create a wallet and then generate addresses. In fact, the wallet contains Groestlcoin addresses and it may be encrypted for better security. The Groestlcoin node is running and synchronized.

STEP 1) Create a new or load an old Groestlcoin wallet.

There is no default wallet and no wallet is loaded automatically on start, by default (indeed a wallet may be automatically loaded, but it should be specified on loading).
List all the Groestlcoin wallets under the current user:

myuser@mydesktop:~$ cd groestlcoin-core/bin/
myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli listwallets
[
]
myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli listwalletdir
{
  "wallets": [
  ]
}
myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli listaddressgroupings
error code: -18
error message:
No wallet is loaded. Load a wallet using loadwallet or create a new one with createwallet. (Note: A default wallet is no longer automatically created)

Apparently, there are no wallets, so here is how to create a wallet:
Create a wallet with:

myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli createwallet my-groestlcoin-wallet
{
  "name": "my-groestlcoin-wallet"
}
myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli encryptwallet 'joo8laeW9Chietae&phu'
wallet encrypted; The keypool has been flushed and a new HD seed was generated (if you are using HD). You need to make a new backup.

When creating one wallet, it will become the default one, and all commands on groestlcoin-cli will use it. To specify exactly the name of the wallet with the command, the option “-rpcwallet=” should be used. In general, with one wallet there is no need to specify the wallet name, but when there are two or more loaded wallets, it is mandatory to specify with “-rpcwallet=” the wallet name.
Creating one more wallet with groestlcoin-cli will result in two loaded wallets, so after that, all commands should include “-rpcwallet=”.

myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli createwallet my-groestlcoin-wallet-2
{
  "name": "my-groestlcoin-wallet-2"
}
myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet-2" encryptwallet "ief0ahshao8ca8Dai-ng"
wallet encrypted; The keypool has been flushed and a new HD seed was generated (if you are using HD). You need to make a new backup.

Keep on reading!