Send coins in Groestlcoin network from command line with Groestlcoin Core 25 in year 2023

This article an updated version of Send coins in Groestlcoin network with Groestlcoin Core (cli), because it appeared many things handling the wallets with the command-line have changed.

main menu
groestlcoin-cli sendtoaddress

The basic notes to send and receive are:

  • a Groestlcoin address is required.
  • a Groestlcoin wallet contains Groestlcoin address
  • the Groestlcoin wallet application (i.e. Groestlcoin node, it is the same application) needs a synchronized Groestlcoin to operate properly, such as send and receive Groestlcoin coins.
  • the Groestlcoin wallet may be created, loaded or imported with the Groestlcoin tools.
  • if there is only one Groestlcoin wallet loaded it would be the default one and it would not require additional options to the Groestlcoin tool to specify, which wallet would be used for the current command.

Here are the steps needed to transfer funds under the Linux distro of Ubuntu securely. To be able to transfer money securely without any 3rd party involved (no online wallet or wallets, which is unclear which node they connect to) just funds from your personal Groestlcoin wallet address on your computer to another Groestlcoin wallet address it is needed a running Groestlcoin node using Groestlcoin Core command line tool:groestlcoin-cli – this is command line tool for managing the Groestlcoin wallets.

STEP 1) Install and run a Groestlcoin node with groestlcoind

The first step is to start a Groestlcoin node by following this updated article – Building from source and run a Groestlcoin node (cli only) under Ubuntu 22.04 LTS. It will help the user to build from the official source code the Groestlcoin Core software, which will include the Groestlcoin node and wallet functionalities. All of the file paths and application names are real and correct if the above article was used.
It’s worth mentioning, that the Groestlcoin node must be running and synced with the Groestlcoin network. Here is how to check it:

myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli getblockchaininfo
{
  "chain": "main",
  "blocks": 4734023,
  "headers": 4734023,
  "bestblockhash": "00000000000020d22b156e27af600fcdc3fd315f8896bbdb5ab748260fbfa3dd",
  "difficulty": 457347.0794165397,
  "time": 1693300370,
  "mediantime": 1693300091,
  "verificationprogress": 0.9999998125955512,
  "initialblockdownload": false,
  "chainwork": "00000000000000000000000000000000000000000000016eeb7afc66a3b219fb",
  "size_on_disk": 3040987475,
  "pruned": false,
  "warnings": ""
}


If blocks and headers are more than 0 and equal to each other, the current Groestlcoin is synced with the network and the wallet could be used to send (and receive) Groestlcoins (GRS).

STEP 2) List wallets and load a wallet

First, to use a wallet, that may contain many Groestlcoin coins, the wallet must be opened. To open a Groestlcoin wallet use the loadwallet command. There are list commands to show what and where wallets are available, too.
The send command will be issued from another computer (with the name “srv“) and then the receiving one (with the name “mydesktop“)
List all available wallets in the default path:

main menu
groestlcoin-cli listaddressgroupings getbalance

myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli listwalletdir
{
  "wallets": [
    {
      "name": "my-groestlcoin-wallet"
    },
    {
      "name": "my-groestlcoin-wallet-4"
    },
    {
      "name": "my-groestlcoin-wallet-3"
    },
    {
      "name": "my-groestlcoin-wallet-2"
    }
  ]
}

Load the wallet with

myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli loadwallet "my-groestlcoin-wallet"
{
  "name": "my-groestlcoin-wallet"
}

List if there are any addresses that could be used or generate a new one:

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"
{
  "grs1qmeyn6jnhx223hpc941111111111111112222": {
    "purpose": "receive"
  }
}

If the user wants to generate a new Groestlcoin address:

myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet" getnewaddress "myaddress2"
grs1qldvg546gq88anrv2nm3lfarpf4swjsuhhulyqv

It is a good idea to set labels to be able to list and remember the address purpose more easily.

Now, load and unlock the wallet on the other system, which will be used to send coins:

myuser@srv:~/groestlcoin-core/bin$ ./groestlcoin-cli loadwallet "mygroestlcoin_demo"
{
  "name": "mygroestlcoin_demo"
}
myuser@srv:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="mygroestlcoin_demo" listaddressgroupings
[
  [
    [
      "grs1q88s11234234342423423434546456342342344",
      153.00,
      "mygroestlcoin_demo"
    ]
  ]
]

STEP 3) Send Groestlcoins to a Groestlcoin address.

The simplest form of send is to use the Groestlcoin cli command sendtoaddress with only 2 arguments – the receiving address and the amount, which should be received by this address, the transaction fee is paid by the sender in this case.
First, decrypt the wallet (the wallet is encrypted in the previous article from the link above) for 300 seconds and then issue the sendtoaddress command.

myuser@srv:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="mygroestlcoin_demo" -stdinwalletpassphrase walletpassphrase 300
Wallet passphrase> 
myuser@srv:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="mygroestlcoin_demo" sendtoaddress "grs1qmeyn6jnhx223hpc941111111111111112222" 10
7b52e6f6c777f6ca36066d84dba06111111112222223333727f4f7c36454e8a

The output is just the transaction ID. The Groestlcoin address is grs1qmeyn6jnhx223hpc941111111111111112222 – the one above from the myuser@mydesktop system.

Back on the receiving system first the amount is unconfirmed, but after some minutes it got confirmed and the amount is trusted:

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": 10.00000000,
    "immature": 0.00000000
  }
}
myuser@mydesktop:~/groestlcoin-core/bin$ #after several minutes...
myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet" getbalances
{
  "mine": {
    "trusted": 10.00000000,
    "untrusted_pending": 0.00000000,
    "immature": 0.00000000
  }
}
myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet" listaddressgroupings
[
  [
    [
      "grs1qmeyn6jnhx223hpc941111111111111112222",
      10.00000000,
      "myaddress1"
    ]
  ]
]

The transaction information may be shown with:

myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet" listtransactions
[
  {
    "address": "grs1qmeyn6jnhx223hpc941111111111111112222",
    "parent_descs": [
      "wpkh(xpub661MyMwAqRbcGU5DntvPrfortsp4nSwwrQ3nsMgnnNSZbzuHVZxwVdA4FtDTHLAQZmUbJZdj9GphvS3XeZnvHriqsXofbbKk3MyqKqcgFjb/84'/17'/0'/0/*)#stk5upun"
    ],
    "category": "receive",
    "amount": 10.00000000,
    "label": "myaddress1",
    "vout": 1,
    "confirmations": 20,
    "blockhash": "000000000000206eeed471c0ff7b44d061bbf89177dbb82f159811d071649bcd",
    "blockheight": 4734067,
    "blockindex": 1,
    "blocktime": 1693303533,
    "txid": "7b52e6f6c777f6ca36066d84dba06111111112222223333727f4f7c36454e8a",
    "wtxid": "5995953e0cd4a35d4adbd6322c4dc28d711111111111122222222223333f8156",
    "walletconflicts": [
    ],
    "time": 1693303448,
    "timereceived": 1693303448,
    "bip125-replaceable": "no"
  }
]
myuser@mydesktop:~/groestlcoin-core/bin$ #after several minutes the confirmation are increasing
myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli -rpcwallet="my-groestlcoin-wallet" listtransactions
[
  {
    "address": "grs1qmeyn6jnhx223hpc941111111111111112222",
    "parent_descs": [
      "wpkh(xpub6623234Aq3bcGU5DntvPrfortsp4nSwwr111111111111122222222222223333333333444444444444444444qsXofbbKk3MyqKqcgFjb/84'/17'/0'/0/*)#stk5upun"
    ],
    "category": "receive",
    "amount": 10.00000000,
    "label": "myaddress1",
    "vout": 1,
    "confirmations": 40,
    "blockhash": "000000000000206eeed471c0ff7b44d061bbf89177dbb82f159811d071649bcd",
    "blockheight": 4734067,
    "blockindex": 1,
    "blocktime": 1693303533,
    "txid": "7b52e6f6c777f6ca36066d84dba06111111112222223333727f4f7c36454e8a",
    "wtxid": "7b52e6f6c777f6ca36066d84dba06111111112222223333727f4f7c36454e8a",
    "walletconflicts": [
    ],
    "time": 1693303448,
    "timereceived": 1693303448,
    "bip125-replaceable": "no"
  }
]

There are many sites, whose purpose is to show and explore the Groestlcoin blockchain in pretty web pages:

SCREENSHOT 1) The first confirmantion with this transcation hash.

The blockchain number is included and there is only one confirmation, i.e. in only one blockchain number this transaction is found. Therefore there is only one confirmation. The Block Height line shows the confirmation till this block

main menu
groestlcoin blockchain explorer site 1 confirmation

SCREENSHOT 2) 44 confirmation of the transcation, so it is much more sure to be real.

The Block Height line shows the confirmation till this block.

main menu
blockchain explorer site 44 confirmation

SCREENSHOT 2) Exploring the Groestlcoin address.

This Groestlcoin coin address has 10 coins as of the time this screenshot is taken and the blockchain number shown on the page.

main menu
blockchain explorer site GRS address

Bonus – sendtoaddress help with more options

This is the official help output of the sendtoaddress command:

myuser@mydesktop:~/groestlcoin-core/bin$ ./groestlcoin-cli help sendtoaddress
sendtoaddress "address" amount ( "comment" "comment_to" subtractfeefromamount replaceable conf_target "estimate_mode" avoid_reuse fee_rate verbose )

Send an amount to a given address.
Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.

Arguments:
1. address                  (string, required) The groestlcoin address to send to.
2. amount                   (numeric or string, required) The amount in GRS to send. eg 0.1
3. comment                  (string, optional) A comment used to store what the transaction is for.
                            This is not part of the transaction, just kept in your wallet.
4. comment_to               (string, optional) A comment to store the name of the person or organization
                            to which you're sending the transaction. This is not part of the 
                            transaction, just kept in your wallet.
5. subtractfeefromamount    (boolean, optional, default=false) The fee will be deducted from the amount being sent.
                            The recipient will receive less groestlcoins than you enter in the amount field.
6. replaceable              (boolean, optional, default=wallet default) Signal that this transaction can be replaced by a transaction (BIP 125)
7. conf_target              (numeric, optional, default=wallet -txconfirmtarget) Confirmation target in blocks
8. estimate_mode            (string, optional, default="unset") The fee estimate mode, must be one of (case insensitive):
                            "unset"
                            "economical"
                            "conservative"
9. avoid_reuse              (boolean, optional, default=true) (only available if avoid_reuse wallet flag is set) Avoid spending from dirty addresses; addresses are considered
                            dirty if they have previously been used in a transaction. If true, this also activates avoidpartialspends, grouping outputs by their addresses.
10. fee_rate                (numeric or string, optional, default=not set, fall back to wallet fee estimation) Specify a fee rate in gro/vB.
11. verbose                 (boolean, optional, default=false) If true, return extra information about the transaction.

Result (if verbose is not set or set to false):
"hex"    (string) The transaction id.

Result (if verbose is set to true):
{                          (json object)
  "txid" : "hex",          (string) The transaction id.
  "fee_reason" : "str"     (string) The transaction fee reason.
}

Examples:

Send 0.1 GRS
> groestlcoin-cli sendtoaddress "grs1qg5ujdyhf263a04hnym8j5we8v0d8mjgtkj0zp3" 0.1

Send 0.1 GRS with a confirmation target of 6 blocks in economical fee estimate mode using positional arguments
> groestlcoin-cli sendtoaddress "grs1qg5ujdyhf263a04hnym8j5we8v0d8mjgtkj0zp3" 0.1 "donation" "sean's outpost" false true 6 economical

Send 0.1 GRS with a fee rate of 1.1 gro/vB, subtract fee from amount, BIP125-replaceable, using positional arguments
> groestlcoin-cli sendtoaddress "grs1qg5ujdyhf263a04hnym8j5we8v0d8mjgtkj0zp3" 0.1 "drinks" "room77" true true null "unset" null 1.1

Send 0.2 GRS with a confirmation target of 6 blocks in economical fee estimate mode using named arguments
> groestlcoin-cli -named sendtoaddress address="grs1qg5ujdyhf263a04hnym8j5we8v0d8mjgtkj0zp3" amount=0.2 conf_target=6 estimate_mode="economical"

Send 0.5 GRS with a fee rate of 25 gro/vB using named arguments
> groestlcoin-cli -named sendtoaddress address="grs1qg5ujdyhf263a04hnym8j5we8v0d8mjgtkj0zp3" amount=0.5 fee_rate=25
> groestlcoin-cli -named sendtoaddress address="grs1qg5ujdyhf263a04hnym8j5we8v0d8mjgtkj0zp3" amount=0.5 fee_rate=25 subtractfeefromamount=false replaceable=true avoid_reuse=true comment="2 pizzas" comment_to="jeremy" verbose=true

There are 11 fields in total, but only two are mandatory – the first two. The order of the additional options is important and it should be preserved. If the user wants to include the 8th option, all the options till 8 should be included, too, as shown in the examples from the help above.

*Many Groestlcoin addresses were changed to fake ones before publishing this article for security reasons. These addresses grs1qmeyn6jnhx223hpc941111111111111112222 and grs1q88s11234234342423423434546456342342344a are not valid Groestlcoin because they were changed after the execution of all the commands above. All command output is authentic and all commands were actually executed on the Groestlcoin node.
More on Groestlcoin on this site with tag groestlcoin tag.

Leave a Reply

Your email address will not be published. Required fields are marked *