Staking on NEAR
Staking is a process of sending StakeTransaction
that informs the network that a given node intends to become a validator in upcoming epochs. This particular type of transaction must provide a public key and staking amount. After the transaction is sent, a node that has a private key associated with the public key in the staking transaction must wait until two epochs to become a validator.
What is a minimum amount to stake as a validator?β
A node can become a NEAR validator only if the amount in the staking transaction is above the seat price defined by the protocol. The seat price for becoming a validator on the NEAR blockchain can fluctuate based on several factors, including the total number of tokens staked on the network and the number of validators.
The current seat price for validator is available here: nearblocks.io/node-explorer
Smart Contract Based Stakingβ
Delegation on NEAR is not implemented on the protocol level, which allows each validator to create or customize their own contract that they use to attract delegators. If validators want to accept delegated stake, they must deploy a staking pool contract, which defines commission fees and reward distribution split, and advertise that contract as the destination to delegate.
Unlike other PoS networks, NEAR uses a staking pool factory with a whitelisted staking smart contract to ensure delegatorsβ funds are safe. Therefore, in order to run a validator node on NEAR, a staking pool must be deployed to a NEAR account and integrated into a NEAR validator node.
Each validator may decide their own commission fees and how reward distribution works.
Stake with the NEAR CLIβ
For validators, there is an option to staking without deploying a staking pool smart contract. However, in choosing this option to stake directly without deploying a staking pool, you will prevent other delegators from delegating to you and will reduce your potential commission. If this is the approach you'd like to take:
- Please install the near-cli
- The following commands may help you stake and unstake your NEAR.
To Stake NEAR Directly Without a Staking Poolβ
near stake <accountId> <publicKey> --amount <amount>
To Unstake NEAR Directly Without a Staking Poolβ
The unstaking command is simply changing the staking command to have a staking amount of 0.
near stake <accountId> <publicKey> --amount 0
Delegation on NEAR
How does delegating staking work?β
NEAR token holders are encouraged to earn rewards by delegating their tokens. By staking your NEAR tokens, you help to secure the network and earn rewards. When you delegate your tokens, you are depositing and staking your token with a specific staking pool that has been deployed by a validator.
How to choose your validator(s)?β
A list of available pools for delegation (one per validator) is available on the Explorer Validator page. Delegators should review validators' performance and commission charged to decide how best to delegate.
Delegators may use the NEAR wallet or the NEAR CLI to delegate to existing staking pools.
Delegate with the NEAR Walletβ
For delegators, who would like to delegate using the NEAR wallet, please create your mainnet
wallet:
- Go to wallet.near.org and create an account.
- Navigate to the staking tab to select an available staking pool to delegate your tokens.
Delegate with the NEAR CLIβ
For delegators, who would like to delegate using the command line:
- Please install the near-cli
- The following commands may help you stake, unstake, and withdraw your NEAR.
To Deposit and Stake NEARβ
near call <stakingPoolId> deposit_and_stake --amount <amount> --accountId <accountId> --gas=300000000000000
Unstake Allβ
Unstaking takes 2-3 epochs to complete. After the unstaking period, you may withdraw your NEAR from staking pool.
near call <stakingPoolId> unstake_all --accountId <accountId> --gas=300000000000000
Unstake a Specified Amountβ
Please note the amount in yoctoNEAR. NB: Unstaking takes 2-3 epochs to complete. After the unstaking period, you may withdraw your NEAR from staking pool.
near call <stakingPoolId> unstake '{"amount": "<amount yoctoNEAR>"}' --accountId <accountId> --gas=300000000000000
Withdraw Allβ
near call <stakingPoolId> withdraw_all --accountId <accountId> --gas=300000000000000
Withdraw a Specified Amountβ
Please note the amount in yoctoNEAR.
near call <stakingPoolId> withdraw '{"amount": "<amount yoctoNEAR>"}' --accountId <accountId> --gas=300000000000000
See Updated Balanceβ
If a staking pool hasn't had an action applied to it recently, it may show an old balance on all staked accounts. To see an updated balance, you can ping the pool.
near call <stakingPoolId> ping '{}' --accountId <accountId> --gas=300000000000000
Got a question?
Ask it on StackOverflow!