Staking
For an overview of staking, read first the Staking and Inflation FAQ.
After you have received RENEC, you might consider putting it to use by delegating stake to a validator. Stake is what we call tokens in a stake account. Renec weights validator votes by the amount of stake delegated to them, which gives those validators more influence in determining then next valid block of transactions in the blockchain. Renec then generates new RENEC periodically to reward stakers and validators. You earn more rewards the more stake you delegate.
#
Create a Stake AccountTo delegate stake, you will need to transfer some tokens into a stake account. To create an account, you will need a keypair. Its public key will be used as the stake account address. No need for a password or encryption here; this keypair will be discarded right after creating the stake account.
The output will contain the public key after the text pubkey:
.
Copy the public key and store it for safekeeping. You will need it any time you want to perform an action on the stake account you create next.
Now, create a stake account:
<AMOUNT>
tokens are transferred from the account at the "from" <KEYPAIR>
to
a new stake account at the public key of stake-account.json.
The stake-account.json file can now be discarded. To authorize additional
actions, you will use the --stake-authority
or --withdraw-authority
keypair,
not stake-account.json.
View the new stake account with the renec stake-account
command:
The output will look similar to this:
#
Set Stake and Withdraw AuthoritiesStake and withdraw authorities
can be set when creating an account via the
--stake-authority
and --withdraw-authority
options, or afterward with the
renec stake-authorize
command. For example, to set a new stake authority,
run:
This will use the existing stake authority <KEYPAIR>
to authorize a new stake
authority <PUBKEY>
on the stake account <STAKE_ACCOUNT_ADDRESS>
.
#
Advanced: Derive Stake Account AddressesWhen you delegate stake, you delegate all tokens in the stake account to a
single validator. To delegate to multiple validators, you will need multiple
stake accounts. Creating a new keypair for each account and managing those
addresses can be cumbersome. Fortunately, you can derive stake addresses using
the --seed
option:
<STRING>
is an arbitrary string up to 32 bytes, but will typically be a
number corresponding to which derived account this is. The first account might
be "0", then "1", and so on. The public key of <STAKE_ACCOUNT_KEYPAIR>
acts
as the base address. The command derives a new address from the base address
and seed string. To see what stake address the command will derive, use renec create-address-with-seed
:
<PUBKEY>
is the public key of the <STAKE_ACCOUNT_KEYPAIR>
passed to
renec create-stake-account
.
The command will output a derived address, which can be used for the
<STAKE_ACCOUNT_ADDRESS>
argument in staking operations.
#
Delegate StakeTo delegate your stake to a validator, you will need its vote account address.
Find it by querying the cluster for the list of all validators and their vote
accounts with the renec validators
command:
The first column of each row contains the validator's identity and the second
is the vote account address. Choose a validator and use its vote account
address in renec delegate-stake
:
The stake authority <KEYPAIR>
authorizes the operation on the account with
address <STAKE_ACCOUNT_ADDRESS>
. The stake is delegated to the vote account
with address <VOTE_ACCOUNT_ADDRESS>
.
After delegating stake, use renec stake-account
to observe the changes
to the stake account:
You will see new fields "Delegated Stake" and "Delegated Vote Account Address" in the output. The output will look similar to this:
#
Deactivate StakeOnce delegated, you can undelegate stake with the renec deactivate-stake
command:
The stake authority <KEYPAIR>
authorizes the operation on the account
with address <STAKE_ACCOUNT_ADDRESS>
.
Note that stake takes several epochs to "cool down". Attempts to delegate stake in the cool down period will fail.
#
Withdraw StakeTransfer tokens out of a stake account with the renec withdraw-stake
command:
<STAKE_ACCOUNT_ADDRESS>
is the existing stake account, the stake authority
<KEYPAIR>
is the withdraw authority, and <AMOUNT>
is the number of tokens
to transfer to <RECIPIENT_ADDRESS>
.
#
Split StakeYou may want to delegate stake to additional validators while your existing
stake is not eligible for withdrawal. It might not be eligible because it is
currently staked, cooling down, or locked up. To transfer tokens from an
existing stake account to a new one, use the renec split-stake
command:
<STAKE_ACCOUNT_ADDRESS>
is the existing stake account, the stake authority
<KEYPAIR>
is the stake authority, <NEW_STAKE_ACCOUNT_KEYPAIR>
is the
keypair for the new account, and <AMOUNT>
is the number of tokens to transfer
to the new account.
To split a stake account into a derived account address, use the --seed
option. See
Derive Stake Account Addresses
for details.