Stake tokens
Resources: Staking
This section is part of a series on the topic of Staking.
Docs:
Tools:
This tutorial describes how to stake using the smart contracts, the APIs, an Ethereum wallet, and a Vega Wallet. If you're looking for the easiest way to stake tokens, visit governance.vega.xyz ↗
- Tokenholders can stake tokens to validators on the Vega chain, also known as nominating validators.
- A Vega Wallet is required to create a Vega key and to stake (also known as nominate) validators.
- Vega tokens may be locked in a vesting schedule. This tutorial covers unlocked tokens, i.e. tokens that are in a user's Ethereum wallet.
- The staking bridge used to stake assets is different to the ERC20 bridge that allows asset withdrawal.
Staking unlocked tokens
Staking tokens from a tokenholder's Ethereum wallet follows the below process:
- On Ethereum, the tokens need to be associated with a Vega key
- On Vega, the Vega key is used to nominate a validator (stake)
- At the end of each epoch, rewards are paid out to the Vega key
Withdrawing unlocked and unassociated tokens
- On Vega, rewards and unassociated tokens can be withdrawn by submitting a withdrawal transaction
- On Ethereum, the withdrawal confirmation is submitted to the staking bridge, and the rewards are released to the specified Ethereum address
Staking unlocked tokens: step by step
1. Associating tokens
Tokens are associated by calling stake
on the Vega staking bridge. The two parameters are:
vega_public_key
- the Vega public key that will be used to nominate validators on Vegaamount
- the amount of tokens being associated with the Vega key
It will take ~50 block confirmations for the balance to update. You can see when the staking balance has been credited by using REST or gRPC.
2. Nominating a validator
Once the token balance is associated to a Vega key, you'll want to choose a validator or validators to nominate.
Fetch a list of validator nodes using REST.
Nominate a validator by sending a transaction with the Vega Wallet:
- Command line (Linux / OSX)
- Command line (Windows)
vegawallet transaction send --wallet "WALLET_NAME" --pubkey "VEGA_PUBKEY" --network "NETWORK_NAME" '{
"delegateSubmission": {
"nodeId":"INSERT_NODE_ID_FOR_NOMINATION",
"amount":"1000000000000000000"
}
}'
vegawallet.exe transaction send --wallet "WALLET_NAME" --pubkey "VEGA_PUBKEY" --network "NETWORK_NAME" ^
"{\"delegateSubmission\": ^
{ ^
\"nodeId\":\"INSERT_NODE_ID_FOR_NOMINATION", ^
\"amount\":\"1000000000000000000\" ^
} ^
}"
3. Claiming rewards
A nomination to a validator occurs in one epoch, and takes effect in the subsequent epoch.
That means that during the first epoch in which you nominate, no rewards will be received. For each subsequent epoch, rewards will be deposited to the Vega key, in the form of VEGA tokens. (Once trading is available on mainnet, rewards will be paid in a mix of VEGA tokens and settlement asset tokens.)
Specific reward payouts can be queried via REST.
After VEGA rewards have been credited to the Vega key they can used to nominate validators or withdrawn.
Withdrawing involves preparing a withdrawal request, which the validators will confirm and sign in order for you to be able to request the withdrawal on Ethereum. The funds will immediately be locked on Vega, so they can be withdrawn through the Ethereum bridge.
Withdrawing unlocked tokens: step by step
1. Getting multisig bundle for withdrawal
Your withdrawal should be confirmed within a few seconds.
You can retrieve the signature bundle, which you will submit to the ERC20 bridge in the next step, by using the REST.
2. Submitting withdrawal to Ethereum
With the signature bundle fetched above, the final step is to submit that withdrawal to the staking bridge. This can be done via the withdraw_asset
function on the Ethereum bridge.
amount
- the amount of Vega being withdrawnasset_source
- the contract address of the asset being withdrawntarget
- the Ethereum address to receive the rewardsnonce
- the nonce from step 4signatures
- signature bundle from step 4
Ethereum addresses
Name | Address | Ethereum network |
---|---|---|
ERC20 Bridge | 0x23872549cE10B40e31D6577e0A920088B0E0666a 🔍 | mainnet |
Staking bridge | 0x195064D33f09e0c42cF98E665D9506e0dC17de68 🔍 | mainnet |
Token vesting | 0x23d1bFE8fA50a167816fBD79D7932577c06011f4 🔍 | mainnet |
Vega token | 0xcB84d72e61e383767C4DFEb2d8ff7f4FB89abc6e 🔍 | mainnet |