Categories
Getting Started Staking

Staking with CLI

The safest method to delegate your stake is remotely to the validator. In this short guide I’ll show you how to create a local wallet, a stake account and how to delegate to your validator.

Make a note of your validator vote-account address as this is needed in order to delegate a stake-account to your chosen validator.

To complete this guide your will need to build/acquire the safecoin and the safecoin-keygen binaries. If you don’t have access to the binaries, you can build them as below.

You will need SSH/terminal access to an Ubuntu 20.04 system. Login to your system and build the binaries below.

Install dependencies, modules and build binaries

apt update upgrade -y

curl https://sh.rustup.rs -sSf | sh

source $HOME/.cargo/env

rustup component add rustfmt

rustup update

sudo apt-get install libssl-dev libudev-dev pkg-config zlib1g-dev llvm clang make git screen -y

git clone https://github.com/Fair-Exchange/Safecoin.git

cd Safecoin

cargo build --release

mkdir ~/ledger

You now have the binaries built in the ~/SAFE/target/release folder.

Creating a Local Wallet, a Stake-Account and Delegating

The steps below will create a local wallet keypair, a stake account and will delegate your stake-account to your desired validator vote account.

Create a keypair for your Local Wallet

# create local wallet

~/Safecoin/target/release/safecoin-keygen new -o ~/ledger/wallet.json

# set config to default to local wallet

~/Safecoin/target/release/safecoin config set --keypair ~/ledger/wallet.json

Make sure to keep a backup of your keypair seed and private key, which you can find in ~/ledger/wallet.json file.

Send funds to your Local Wallet

# send some funds to the local wallet address

~/Safecoin/target/release/safecoin address

# check the balance, are they there?

~/Safecoin/target/release/safecoin balance

Create a keypair for your Stake-Account

Make sure to keep a backup of your keypair seed and private key, which you can find in ~/ledger/stake-account.json file.

# create local stake keypair

~/Safecoin/target/release/safecoin-keygen new -o ~/ledger/stake-account.json

Create and Credit your Stake-Account

Ensure there are enough funds in your local wallet. If you want to stake 10,000 SAFE then sent 10,001 SAFE so that you have a little extra to cover the transaction fees.

# create and fund stake account 

~/Safecoin/target/release/safecoin create-stake-account ~/ledger/stake-account.json <AMOUNT> --from ~/ledger/wallet.json --stake-authority ~/ledger/wallet.json --withdraw-authority ~/ledger/wallet.json --fee-payer ~/ledger/wallet.json

Delegate your Stake-Account to a Validator

This final step commits your stake-account and begins activation. This is the point of no return.

# delegate to the vote account of your chosen validator

~/Safecoin/target/release/safecoin delegate-stake ~/ledger/stake-account.json <VOTE ADDRESS OF CHOSEN VALIDATOR> --fee-payer ~/ledger/wallet.json --stake-authority ~/ledger/wallet.json

At this point, you will be given a transaction id which confirms your stake is now delegated.

You can view your stake-account address on the SafeCoin explorer to see how much of your stake is active, and how much is activating.

You can also see the Validator commission fee.

Note: You cannot send coins to your stake-account once it is delegated. To stake more coins you need to create a new stake account. Simply repeat the process above with a new stake-account keypair and delegate to your desired validator.