Stake using Creditcoin-CLI
Running from the Docker image
Section titled “Running from the Docker image ”Make sure your Creditcoin Node container is running and use Creditcoin-CLI via the docker exec command.
docker exec -it creditcoin-validator creditcoin-cli --helpCreating Accounts
Section titled “Creating Accounts”Create two accounts using the new command and write down their seed phrases.
docker exec -it creditcoin-validator creditcoin-cli newEach output should look like the following:
Creating new seed phrase...Seed phrase: follow actual seven pill kit side apart column cattle kiss fat writeUse 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.
docker exec -it creditcoin-validator creditcoin-cli show-address# ? Specify seed phrase ›# Account address: 5CYEdiz9X5o5yrMMK8HM6Tb9LmzX1P4PcJekZrECeHv9UKH4Funding Your Accounts
Section titled “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
Section titled “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.
docker exec -it creditcoin-validator creditcoin-cli wizard -a <ctc-amount>It will show the current staking settings, make sure to check them before continuing.
🧙 Running staking wizard...Using the following parameters:💰 Stash account: 5CGBosx2Fw34u9jJtSgEQkoNTtHkPLKgsfjJiE3mDSWb44MW🕹️ Controller account: 5E1tpiU3SnunxwbtvTc7U7gykNYspTZu9yqTcch2pHamAvw5🪙 Amount to bond: 10000 CTC🎁 Reward destination: Staked📡 Node URL: ws://127.0.0.1:9945💸 Commission: 0🔐 Blocked: NoContinue? (y/n): yAfter 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.
docker exec -it creditcoin-validator creditcoin-cli status --validator 5CGBosx2Fw34u9jJtSgEQkoNTtHkPLKgsfjJiE3mDSWb44MWThe validator status will be shown:
Bonded: trueController: 5E1tpiU3SnunxwbtvTc7U7gykNYspTZu9yqTcch2pHamAvw5Validating: trueWaiting: trueActive: falseNext unbonding chunk: NoneIf the validator shows up as Waiting the setup has been successful and it will become active if it gets enough backing.
Manual Setup
Section titled “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.
docker exec -it creditcoin-validator creditcoin-cli bond -c <controller-address> -a <ctc-amount>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.
docker exec -it creditcoin-validator creditcoin-cli set-keys --rotateOnce 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.
docker exec -it creditcoin-validator creditcoin-cli validate --commission <commission-percent>Distributing Rewards
Section titled “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.
docker exec -it creditcoin-validator creditcoin-cli show-addressWith the stash address in hand, run the distribute-rewards command.
docker exec -it creditcoin-validator creditcoin-cli distribute-rewards --era <era number to distribute rewards for> --validator-id <validator-stash-address>Stopping a Validator
Section titled “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.
docker exec -it creditcoin-validator creditcoin-cli chillUnbonding CTC
Section titled “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.
docker exec -it creditcoin-validator creditcoin-cli unbond -a <amount>The status command shows when the next unlocking chunk will be available to withdraw.
docker exec -it creditcoin-validator creditcoin-cli status --validator <stash-address># Bonded: true# Controller: 5E1tpiU3SnunxwbtvTc7U7gykNYspTZu9yqTcch2pHamAvw5# Validating: true# Waiting: false# Active: true# Next unbonding chunk: 1000 CTC in 6 minutes, 5 secondsAfter the unbonding period has passed, withdraw the funds.
docker exec -it creditcoin-validator creditcoin-cli withdraw-unbonded