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.
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.
The wallets are under the home directory/wallets –~/.groestlcoin/wallets/:
myuser@mydesktop:~/groestlcoin-core/bin$ ls -altr ~/.groestlcoin/wallets/ total 16 drwx------ 5 myuser myuser 4096 Aug 24 12:46 .. drwx------ 4 myuser myuser 4096 Aug 24 12:50 . drwx------ 2 myuser myuser 4096 Aug 24 12:53 my-groestlcoin-wallet drwx------ 2 myuser myuser 4096 Aug 24 12:53 my-groestlcoin-wallet-2 myuser@mydesktop:~/groestlcoin-core/bin$ ls -altr ~/.groestlcoin/wallets/my-groestlcoin-wallet total 68 drwx------ 4 myuser myuser 4096 Aug 24 12:50 .. drwx------ 2 myuser myuser 4096 Aug 24 12:53 . -rw------- 1 myuser myuser 16928 Aug 24 12:53 wallet.dat-journal -rw------- 1 myuser myuser 36864 Aug 24 12:53 wallet.dat myuser@mydesktop:~/groestlcoin-core/bin$ ls -altr ~/.groestlcoin/wallets/my-groestlcoin-wallet-2/ total 88 drwx------ 4 myuser myuser 4096 Aug 24 12:50 .. drwx------ 2 myuser myuser 4096 Aug 24 12:53 . -rw------- 1 myuser myuser 36864 Aug 24 12:54 wallet.dat -rw------- 1 myuser myuser 37448 Aug 24 12:54 wallet.dat-journal
When the wallet is loaded, there is an additional file wallet.dat-journal to keep track of the changes.
It is important to encrypt the wallet with a password because if the wallet is unprotected with a password anyone could steal it! Unload the wallet after each transaction, it does not need to be loaded all the time.
Unload the wallet with unloadwallet command:
myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli listwallets [ "my-groestlcoin-wallet", "my-groestlcoin-wallet-2" ] myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet-2" unloadwallet { } myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli listwallets [ "my-groestlcoin-wallet" ] myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet" unloadwallet { } myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli listwallets [ ]
All wallets are unloaded, and no operations could be performed on them.
Load a wallet is simple enough, too:
myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli listwallets [ ] myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli loadwallet "my-groestlcoin-wallet" { "name": "my-groestlcoin-wallet" } myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli loadwallet "my-groestlcoin-wallet-2" { "name": "my-groestlcoin-wallet-2" } myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli listwallets [ "my-groestlcoin-wallet", "my-groestlcoin-wallet-2" ]
Get the wallet information including the total balance of all addresses:
myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet" getwalletinfo { "walletname": "my-groestlcoin-wallet", "walletversion": 216300, "format": "sqlite", "balance": 0.00000000, "unconfirmed_balance": 0.00000000, "immature_balance": 0.00000000, "txcount": 0, "keypoolsize": 3999, "keypoolsize_hd_internal": 4000, "unlocked_until": 0, "paytxfee": 0.00000000, "private_keys_enabled": true, "avoid_reuse": false, "scanning": false, "descriptors": true, "external_signer": false }
Get only the balance:
myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet" getbalance 0.00000000 myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet" getbalances { "mine": { "trusted": 0.00000000, "untrusted_pending": 0.00000000, "immature": 0.00000000 } }
STEP 2) Generate Groestlcoin address and list coin balance.
Here is how to generate a valid Groestlcoin address belonging to one of the Groestlcoin wallets, which are already loaded:
myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet" getnewaddress grs1qmeyn6jnhx223hpc94eys9q49rf323mc9u5jz9t
This sequence of numbers and alphabets grs1qmeyn6jnhx223hpc94eys9q49rf323mc9u5jz9t is a public Groestlcoin address, which could be used to receive Groestlcoins – the coins of the Groestlcoin network. This address could be given to anyone and can be tracked with sites for blockchain explorers.
After generating the address three things must be done:
- Backup the password of the wallet.
- Backup the Groestlcoin wallet:
myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet" backupwallet ~/my-groestlcoin-wallet.bkp myuser@mydesktop:~/groestlcoin-core/bin$ ls -al ~/my-groestlcoin-wallet.bkp -rw------- 1 myuser myuser 36864 Aug 24 13:40 /home/myuser/my-groestlcoin-wallet.bkp
- Set a label to the address, because it is easy to manage it.
myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet" setlabel "grs1qmeyn6jnhx223hpc94eys9q49rf323mc9u5jz9t" "myaddress1" myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet" listlabels [ "myaddress1" ] myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet" getaddressesbylabel "myaddress1" { "grs1qmeyn6jnhx223hpc94eys9q49rf323mc9u5jz9t": { "purpose": "receive" } }
Additional information for the address:
myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet" getaddressinfo grs1qmeyn6jnhx223hpc94eys9q49rf323mc9u5jz9t { "address": "grs1qmeyn6jnhx223hpc94eys9q49rf323mc9u5jz9t", "scriptPubKey": "0014de493d4a7732951b8705ae490282a51a62a8ef05", "ismine": true, "solvable": true, "desc": "wpkh([1fb10cad/84'/17'/0'/0/0]031f69201c82eab49beee7cfd6bfa6783a8e60a82d625d8b2e9fc421bb77d80816)#r7rx7ynt", "parent_desc": "wpkh([1fb10cad/84'/17'/0']xpub6CcBrqCYmR1tmjCgvXGtXo4kjCJTU8aNCAqdhFDvMFwzSBAh3nMRnVpyAMACS5agQWbL9LVyFJxaGU66fnDvHSd4G9hKGbfz3g2ummg8zX5/0/*)#0hq22m70", "iswatchonly": false, "isscript": false, "iswitness": true, "witness_version": 0, "witness_program": "de493d4a7732951b8705ae490282a51a62a8ef05", "pubkey": "031f69201c82eab49beee7cfd6bfa6783a8e60a82d625d8b2e9fc421bb77d80816", "ischange": false, "timestamp": 1692798924, "hdkeypath": "m/84'/17'/0'/0/0", "hdseedid": "0000000000000000000000000000000000000000", "hdmasterfingerprint": "1fb10cad", "labels": [ "myaddress1" ] }
STEP 3)List how many coins belong to wallets and addresses.
Here are some handful commands to list the belongings of the wallets:
Get the balances from all the wallets and addresses:
myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet" getbalance 0.00000000 myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet" getbalances { "mine": { "trusted": 0.00000000, "untrusted_pending": 0.00000000, "immature": 0.00000000 } }
Get the wallet information:
myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet" getwalletinfo { "walletname": "my-groestlcoin-wallet", "walletversion": 216300, "format": "sqlite", "balance": 0.00000000, "unconfirmed_balance": 0.00000000, "immature_balance": 0.00000000, "txcount": 0, "keypoolsize": 3999, "keypoolsize_hd_internal": 4000, "unlocked_until": 0, "paytxfee": 0.00000000, "private_keys_enabled": true, "avoid_reuse": false, "scanning": false, "descriptors": true, "external_signer": false }
This address has not received anything yet:
myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet" getreceivedbylabel "myaddress1" 0.00000000 myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet" getreceivedbyaddress "grs1qmeyn6jnhx223hpc94eys9q49rf323mc9u5jz9t" 0.00000000
List all labels and addresses with labels:
myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet" listlabels [ "myaddress1" ] myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet" getaddressesbylabel "myaddress1" { "grs1qmeyn6jnhx223hpc94eys9q49rf323mc9u5jz9t": { "purpose": "receive" } }
Here are some examples with wallets and addresses, that have Groistlcoins (GRS) (all labels, transactions IDs, names, addresses are changed for security reasons):
List all addresses with funds:
myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="groestlcoin_personal" listaddressgroupings [ [ [ "grs1vsrty5g56utyjfjghfgdfgdhtu67urytjgh56sdfh6jg7", 1532.55, "groestlcoin_personal" ] ] ]
List the wallet information with balances:
myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="groestlcoin_personal" getwalletinfo { "walletname": "groestlcoin_personal", "walletversion": 216300, "format": "sqlite", "balance": 1532.55, "unconfirmed_balance": 0.00000000, "immature_balance": 0.00000000, "txcount": 2, "keypoolsize": 4000, "keypoolsize_hd_internal": 4000, "unlocked_until": 0, "paytxfee": 0.00000000, "private_keys_enabled": true, "avoid_reuse": false, "scanning": false, "descriptors": true, "external_signer": false, "blank": false, "lastprocessedblock": { "hash": "000000000000780a6b9dcf84399fd092f7e28ddae0e3780a6b9dcf84399fd099", "height": 4727312 } } myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="groestlcoin_personal" getbalance 1532.55 myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="groestlcoin_personal" getbalances { "mine": { "trusted": 1532.55, "untrusted_pending": 0.00000000, "immature": 0.00000000 }, "lastprocessedblock": { "hash": "000000000000780a6b9dcf84399fd092f7e28ddae0e3780a6b9dcf84399fd099", "height": 4727312 } }
List labels and addresses in the wallet with balances and confirmations:
myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="groestlcoin_personal" listlabels [ "groestlcoin_personal" ] myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="groestlcoin_personal" getaddressesbylabel "groestlcoin_personal" { "grs1vsrty5g56utyjfjghfgdfgdhtu67urytjgh56sdfh6jg7": { "purpose": "receive" } } myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="groestlcoin_personal" listreceivedbyaddress [ { "address": "grs1vsrty5g56utyjfjghfgdfgdhtu67urytjgh56sdfh6jg7", "amount": 1532.55, "confirmations": 18881, "label": "groestlcoin_personal", "txids": [ "b60d6c5608237c9cdffd2839d816b323b60d6c5608237c9cdffd2839d816b323", "9a90917d1e369f36c4301a969f6ef2219a90917d1e369f36c4301a969f6ef221" ] } ] myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="groestlcoin_personal" listreceivedbylabel [ { "amount": 1532.55, "confirmations": 18882, "label": "groestlcoin_personal" } ]