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.fairground.wtf ↗
- 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 fairground '{
"delegateSubmission": {
"nodeId":"INSERT_NODE_ID_FOR_NOMINATION",
"amount":"1000000000000000000"
}
}'
vegawallet.exe transaction send --wallet "WALLET_NAME" --pubkey "VEGA_PUBKEY" --network fairground ^
"{\"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 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
Important addresses
Name | Address | Network |
---|---|---|
Ethereum ERC20 Bridge | 0x7fe27d970bc8Afc3B11Cc8d9737bfB66B1efd799 🔍 | Ethereum (Sepolia) |
Staking bridge | 0xFFb0A0d4806502ceF491aF1141f66669A1Bd0D03 🔍 | Ethereum (Sepolia) |
Token vesting | 0x680fF88252FA7071CAce7398e77872d54D781d0B 🔍 | Ethereum (Sepolia) |
Vega token | 0xdf1B0F223cb8c7aB3Ef8469e529fe81E73089BD9 🔍 | Ethereum (Sepolia) |
Arbitrum Bridge | 0x927067717B0A9bd553fC421Ae63b3377694b4166 🔍 | Arbitrum (Sepolia) |