Stake using Creditcoin-CLI
Before continuing, please make sure you have setup a Stash and Controller address, as mentioned in the Account Setup section.
Running from the Docker image
Make sure your Creditcoin Node container is running and use Creditcoin-CLI via the docker exec
command.
Security notes:
When using docker, employ
docker exec
as specified in these docs to keep sensitive values out of the container's logs on your system.Only use the Creditcoin CLI to administer a validator from its own machine or container. Do not use the Creditcoin CLI to remotely administer a validator even on the same LAN or virtual network. Connections to the node, from the Creditcoin CLI, are made over unencrypted and unauthenticated websockets and are only safe for use on the loopback interface. (i.e
localhost
,127.0.0.1
)Remember that, when using any terminal or command line tool, commands entered in your terminal window are visible to other users and services on your system. Only enter secrets like seed phrases when prompted by the Creditcoin CLI.
Creating Accounts
Create two accounts using the new
command and write down their seed phrases.
Each output should look like the following:
Use show-address
to get the address of the accounts, so you can fund them both with a transfer. One will be the Stash account and hold all tokens meant for staking. The other one will be the Controller, a secondary account that will manage the validator.
Funding Your Accounts
Once your accounts are created, make sure they both have enough CTC to cover the desired staking amount plus transaction fees. To fund your accounts, you can transfer from another wallet using a number of tools such as the PolkadotJS extension or Creditcoin CLI.
You can confirm the balance of your accounts by following the directions mentioned in the Checking your Balance section of the Creditcoin CLI page.
Validator Wizard
Creditcoin-CLI provides a simple Wizard to set up validators. It will prompt you for the previously generated seed phrases as needed. After launching the wizard and providing it with our seed phrases, it will show us the complete validator setup options and prompt us to continue.
Security note:
Accounts' private keys are derived from these seed phrases.
Every account must have a unique seed phrase.
Remember to use separate accounts (i.e. new seed phrases) for testnet and mainnet validators.
It will show the current staking settings, make sure to check them before continuing.
After continuing, the Wizard will create all required extrinsics (i.e. transactions) and communicate with the node to pair it with the stash and controller accounts.
Once the transactions are sent, the new validator should be in the waiting queue.
Use the status
command to get information about the status of a particular validator by entering its Stash address.
The validator status will be shown:
If the validator shows up as Waiting
the setup has been successful and it will become active if it gets enough backing.
Manual Setup
Setting a validator can also be done by sending each required command manually.
After creating two accounts, first bond CTC using your Stash account and designate your Controller account using the --controller
or -c
option.
Set the validator node keys using the controller account. The rotate flag specifies that the node will generate new keys. Existing keys can be used with the --keys <key-string>
option.
Once keys are set up, the last step is signaling the network the intention to validate. Use the --commission
option to set up a portion of the block reward that will not be shared with nominators.
Distributing Rewards
It is conventionally the validator operator's responsibility to trigger the reward distribution at the end of every era. The address of the stash account doubles as the validator's ID when distributing rewards.
Remember, you can compute the stash account's address by running the following and providing the stash account's seed phrase when prompted.
With the stash address in hand, run the distribute-rewards
command.
Stopping a Validator
Stop a running validator with the chill
command. This will remove the validator from the active/waiting set in the next session.
Unbonding CTC
To unbond locked CTC, validators must first mark their tokens for unbonding, then wait for the unlocking period to end and finally withdraw the unbonded funds.
The status command shows when the next unlocking chunk will be available to withdraw.
After the unbonding period has passed, withdraw the funds.
Last updated