Chain-Maind Auto-Compound (Windows)

Auto-Compound your staking rewards on the chain!


This guide is purposely not going into details to keep it short and (hopefully) simple. I am assuming that you know how to work with the different tools mentioned. As terminal, I’ll be using PowerShell 5.1.

Get Chain-Maind

Note: as of writing, the script is only compatible with version 2.1.2. Newer releases supporting croeseid (version 3.0.0 and higher) are not working yet!

Download the latest stable release from GitHub:
Please make sure you get the correct URL from the Releases page as this one may be outdated in the future!

Version 2.1.2

# Download Archive
Invoke-WebRequest -Uri "" -OutFile "./"

# Unpack Archive
Expand-Archive -Path "./" -DestinationPath "./" -Force

Now there should be a directory called bin in the current directory. In this directory is the main executable chain-maind.exe.

Configure Chain-Maind

Now we have chain-maind available and ready to use. Next is configuring it by adding your wallet. You can change the name of your wallet, I’ve chosen “DeFiWallet” in this example, but the name really doesn’t matter honestly.

Invoke-Expression ".\bin\chain-maind.exe keys add DeFiWallet --interactive"

This command will now prompt you to enter your mnemonic phrase. Make sure you only separate the words by a blank space and not a comma or anything else, otherwise the command will fail.

The result should look something like this:

- name: DeFiWallet
  type: local
  address: cro1ecwcn9tnla7tuzruhfc67z2ulvtl3340227a3w
  pubkey: cropub1addwnpepqvdajxswcsnfhj9j08key8xagauendryg840en76xtsmnxtmcqhrvvy6h8r
  mnemonic: ""
  threshold: 0
  pubkeys: []

With this being done, you can now already interact with the chain and execute transactions from your wallet.

Setup Python

In order to run the script provided by Samuel, we must make sure that Python3 and all required dependencies are installed:

First, get the latest version of Python3 from their downloads page and install it:

Make sure you also add Python to your PATH variable. The rest of this post is assuming you did that.

If python is not a known command to Windows after installing, you have to reopen PowerShell. In some cases even restart Windows.

Afterward, it’s time to install the required dependencies:

pip3 install pexpect

Download & Configuration of the script

Next, you have to download the script and modify all required parameters.
This is a modified version which fixes a few issues/bugs that were not covered in the original script. Also, a few changes were made, because the code from the pexpect module was not compatible with Windows.

Invoke-WebRequest -Uri "" -OutFile "./"

Once the download is completed, we have to set the files permission. With Windows ACLs being pretty complicated, it is easier to do this in the GUI. (Rightclick -> Properties)
Windows does not ask for any password for your keyring (at least on my machine) so you could ignore this step but I’ll do it for good measure anyway.

Click on one of the images to see them full screen.

After settings the permissions, open the file with any text editor and adjust the following variables:

Note: As of writing this article, Windows does not ask for a password for the keyring on my machine. Therefore the password field will be ignored in the current version of the script. If this is the case on other systems, please let me know and I’ll update the script.

# Address of the validator
# this is the address of X Staking
validator = 'crocncl14vxzdsxtmat7hvz58trk823adg3pjh4xh6ghm6'

# Your own CRO Address
own_address = 'cro1ecwcn9tnla7tuzruhfc67z2ulvtl3340227a3w'

# Password of your keyring
password = 'HiI!mP4ssw0rd'

# Folder in which the chain-maind executable is
# Use the full path and don't use relative paths!
chain_maind_directory = 'C:\\Users\\simon\\Desktop\\CRO-TEST\\bin'

Make sure you replace single \ by double \\ in the path

Note: If you have questions about the default validator X Staking, you can find more information about him below (here).

Everything is set up now. Every time you want to compound your stake just call the script and all your CRO from your wallet (and staking rewards) will be staked.


Example Output:

> python3

Claiming rewards from crocncl14vxzdsxtmat7hvz58trk823adg3pjh4xh6ghm6 ... [OK]
Waiting 7sec for the transaction to be processed ... [OK]
Querying wallet balance ... [OK]
Staking 2cro with crocncl14vxzdsxtmat7hvz58trk823adg3pjh4xh6ghm6 ... [OK]


Open the Task Scheduler and click on “Create new Basic Task”. Now follow the images below.

  • In Trigger, just define some trigger that fits your need
  • In Start a Program, make sure you use the absolute path to your python script
  • Make sure you replace single \ by double \\ in the path

Click on one of the images to see them full screen.

You can now modify the task in the Task Scheduler by for example adding additional triggers. Or you can also manually start the task.

Note: I still had Python2 installed as well as Python3 and thus the Scheduler decided to run the script using Python2. If this is the case either uninstall Python2 if you don’t need it anymore, or replace the program “python” (4th screenshot) with the absolute path to the python3.exe

Security Note

We’ve already set file permissions so that nobody else can get the password from the python script. But what about your system, especially if you’re running it on a server?

It does not matter if you’re running it on a Windows Server or your home PC. Everyone who has access to your Windows user account can access your coins!

Make sure you take care of at least the following:

  • Make sure you use a strong password
  • Disable automatic login
  • Lock your screen whenever you leave your PC (CTRL + L)


A huge thanks to Samuel (X Staking) for doing the hard work and providing this script!
You can find more information about him here:


Future updates of the Chain can and will modify chain-maind. Make sure you are always running the same version that all validators are using.

The software is provided “AS IS” and the author disclaims all warranties with regard to this software including all implied warranties of merchantability and fitness. In no event shall the author be liable for any special, direct, indirect, or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in connection with the use or performance of this software.

If you have any further questions, feel free to ask on Telegram.