Skip to main content

Token Delegation


Overview

This page will describe the mechanics of participating in delegation.

At a high level, anyone can delegate their tokens to a staking pool which is run by a validator. This is usually just called "Staking". This is possible even if your tokens are in a lockup contract (as most tokens are during the network's early release). Delegating to a staking pool allows you to receive some staking rewards (which will activate as part of the Phase II rollout and depend on the exact fees charged by the validator) and to participate in protocol governance by adding weight to the vote of the validator whose pool you have delegated to.

You can participate in delegation by using a website (GUI), using the view and call methods of the command-line interface (CLI) or via sending RPC calls directly. These are described below.

Reminder: If you haven't already, evaluate your token custody options from this documentation page.

Viewing and Choosing Validators

Currently, the staking pool contracts (code) allow validators to select what fee they will charge on rewards earned by pools they run. In the future, updated versions of the staking pool contracts may include more parameters (which is one of the nice features enabled by NEAR's contract-based delegation).

Several community-run lists of validators list who they are, how much stake they have, what their vote was for the Phase II transition and more. These can be helpful for selecting where to delegate your tokens. As always, do your own diligence.

OperatorURL (to copy and paste)
NEAR Explorerhttps://explorer.near.org/nodes/validators
DokiaCapitalhttps://staking.dokia.cloud/staking/near/validators
Stardust NEAR Poolhttps://near-staking.com/
YOUR OPERATORADD YOUR LINK HERE

GUI-based delegation (via a website or app)

Disclaimer: the list below is community-maintained, and is not an endorsement by NEAR to use any of them. Do your own research before staking your funds with them!

ProviderURL (to copy and paste)Added on
NEAR Wallethttps://help.mynearwallet.com/en/articles/44-how-to-recover-your-mynearwallet-accountOct 11 2020
DokiaCapitalhttps://staking.dokia.cloudSept 11 2020
Moonlet Wallethttps://moonlet.io/near-staking15 Oct 2020
add hereyour linkfirst come, first serve

CLI-based delegation

Disclaimer: the documentation below refers to the Github repository Core Contracts. Always check the source of the smart contract before delegating your funds to it!

You can use near-cli with NEAR Core Contracts to delegation via:

  1. Lockup Contract
  2. Staking Pool

Before starting, make sure you are running the latest version of near-cli, you are familiar with gas fees and you are sending transactions to the correct NEAR network. By default near-cli is configured to work with TestNet. You can change the network to MainNet by issuing the command

export NODE_ENV=mainnet

It will also be helpful to set some variables, which we will use in commands below. On Linux/macOS/Unix:

export ACCOUNT_ID=#your account id
export LOCKUP_ID=#your lockup contract address
export POOL_ID=#your staking pool

If you're using Windows, you can replace all the export commands with set:

set ACCOUNT_ID=#your account id

You can check that you set these correctly with echo:

echo $ACCOUNT_ID

Note that when you set variables with export you do not prefix them with the dollar sign, but when you use them elsewhere such as with echo, you need the dollar sign.

If you're using a secondary account on a Ledger Nano device, you will also want to create an HD_PATH variable. For example:

export HD_PATH="44'/397'/0'/0'/2'"

The default HD path for the NEAR app on Ledger devices is 44'/397'/0'/0'/1'. See more info on using near-cli with Ledger here.

Heads up

Signing a transaction with the wrong Ledger key can help associating multiple accounts of a user, since even failed transactions are recorded to the blockchain and can be subsequently analyzed.

1. Lockup Contracts Delegation

The Lockup Contract is common among NEAR contributors and, essentially, anyone who didn't acquire tokens through an exchange. This contract acts as an escrow that locks and holds an owner's tokens for a lockup period (such as vesting). You can learn more about lockups and their implementation in the this documentation page.

The owner may want to stake these tokens (including locked ones) to help secure the network and also earn staking rewards that are distributed to the validator. The lockup contract doesn't allow to directly stake from its account, so the owner delegates the tokens using the contract built-in functions.

heads up

The commands below are tested with build 877e2db of the Core Contracts.

They also use formatting only available on Linux/macOS/Unix. If you are using Windows, you will need to replace dollar variables, $LOCKUP_ID, with percent variables, %LOCKUP_ID%. And you will need to use all double quotes, so things like '{"account_id": "'$ACCOUNT_ID'"}' become "{\"account_id\": \"%ACCOUNT_ID%\"}\".

Before proceeding with the tutorial below, check that you have control of your lockup contract, by issuing the command

near view $LOCKUP_ID get_owner_account_id ''

You should expect a result like:

$ near view meerkat.stakewars.testnet get_owner_account_id ''
View call: meerkat.stakewars.testnet.get_owner_account_id()
'meerkat.testnet'

Note that this example us using NEAR_ENV=testnet with $LOCKUP_ID set to meerkat.stakewars.testnet and ACCOUNT_ID set to meerkat.testnet, which matches the returned result above.

You can stake with Lockup contracts in three steps:

  1. Set up the staking pool
  2. Deposit and stake the tokens
  3. Measure the rewards

a. Set the staking pool

Lockup contracts can stake to one staking pool at a time, so this parameter can be changed only while no funds are staked.

You can select the staking pool by calling the method select_staking_pool from the lockup contract:

near call $LOCKUP_ID select_staking_pool '{
  "staking_pool_account_id": "'$POOL_ID'"
}' --accountId $ACCOUNT_ID

If using a Ledger:

near call $LOCKUP_ID select_staking_pool '{
  "staking_pool_account_id": "'$POOL_ID'"
}' --accountId $ACCOUNT_ID --useLedgerKey $HD_PATH

You should expect a result like:

Scheduling a call: meerkat.stakewars.testnet.select_staking_pool({"staking_pool_account_id": "zpool.pool.f863973.m0"})
Receipts: HEATt32tHqWdjkZoSxLhd43CYVBCUp1cFHexgWBEeKJg, EUP7tncJfKDPpKYdunx2qySZ6JmV3injBigyFBiuD96J, 99hdXWmaTQE7gR5vucxMWFNMw7ZLtzJ6WNMSVJHPGJxh
    Log [meerkat.stakewars.testnet]: Selecting staking pool @zpool.pool.f863973.m0. Going to check whitelist first.
Transaction Id 4Z2t1SeN2rdbJcPvfVGScpwyuGGKobZjT3eqvDu28sBk
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/4Z2t1SeN2rdbJcPvfVGScpwyuGGKobZjT3eqvDu28sBk
true

The true statement means that your call was successful, and the lockup contract accepted the $POOL_ID parameter.

b. Deposit and stake the tokens

Lockup contracts can stake their balance, regardless of their vesting schedule. You can proceed in two steps:

  1. check the lockup balance
  2. stake the balance
  3. To know how many tokens you can stake, use the view method get_balance:
near view $LOCKUP_ID get_balance ''

You should expect a result like:

$ near view meerkat.stakewars.testnet get_balance ''
View call: meerkat.stakewars.testnet.get_balance()
'100000499656128234500000000'

Where the resulting balance (in yoctoNEAR) is 100000499656128234500000000 or 100 $NEAR.

heads up

You have to leave 35 $NEAR in the lockup contract for the storage fees. If you have 100 tokens, you can stake up to 65 tokens. If you have 1000 tokens, you can stake up to 965 tokens.

You may want to npm i -g near-units to easily convert yoctoNEAR amounts to human-readable representations, and to go from human-typeable numbers to yoctoNEAR. Examples:

near-units -h 100000499656128234500000000 yN
near-units 965 N

On Linux/macOS/Unix, you can also use this directly in the following commands:

near call $LOCKUP_ID deposit_and_stake '{
  "amount": "'$(near-units 965N)'"
}' --accountId $ACCOUNT_ID --gas $(near-units 200Tgas)

You may want to set your desired amount-to-stake to a variable:

export AMOUNT=# your desired amount to stake

To stake the balance, use the call method deposit_and_stake:

near call $LOCKUP_ID deposit_and_stake '{
  "amount": "'$AMOUNT'"
}' --accountId $ACCOUNT_ID --gas 200000000000000

If using a Ledger:

near call $LOCKUP_ID deposit_and_stake '{
  "amount": "'$AMOUNT'"
}' --accountId $ACCOUNT_ID --gas 200000000000000 --useLedgerKey $HD_PATH 

Heads up

This sets the gas parameter to 200000000000000 gas units, or 200 Tgas (Teragas), as the near-cli default allocation of 30Tgas is too low.

You should expect a result like:

Scheduling a call: meerkat.stakewars.testnet.deposit_and_stake({"amount": "65000000000000000000000000"})
Receipts: BFJxgYMbPLpKy4jae3b5ZJfLuAmpcYCBG2oJniDgh1PA, 9sZSqdLvPXPzpRg9VLwaWjJaBUnXm42ntVCEK1UwmYTp, CMLdB4So6ZYPif8qq2s7zFvKw599HMBVcBfQg85AKNQm
    Log [meerkat.stakewars.testnet]: Depositing and staking 65000000000000000000000000 to the staking pool @zpool.pool.f863973.m0
Receipts: 3VpzWTG9Y2nbZmuJhmsub9bRLnwHCFtnW5NQqcMBWawF, 4BrEKDPmz3mAhnq5tTFYRQp8y9uRxGFwYffJFkPMdQ5P, HJPqqJDTajFfeEA8vFXTLDpxh4PYZCMJ2YLKpWVtwSMF
    Log [meerkat.stakewars.testnet]: Epoch 105: Contract received total rewards of 20383576173536987339742291104 tokens. New total staked balance is 104251712242552700026473040909. Total number of shares 77295581098329153455984430997
    Log [meerkat.stakewars.testnet]: Total rewards fee is 1511304065231935217653387665 stake shares.
    Log [meerkat.stakewars.testnet]: @meerkat.stakewars.testnet deposited 65000000000000000000000000. New unstaked balance is 65000000000000000000000000
    Log [meerkat.stakewars.testnet]: @meerkat.stakewars.testnet staking 64999999999999999999999999. Received 48193095953206307331949682 new staking shares. Total 1 unstaked balance and 48193095953206307331949682 staking shares
    Log [meerkat.stakewars.testnet]: Contract total staked balance is 104316712242552700026473040909. Total number of shares 77343774194282359763316380679
Receipt: FsJLXXEa8Jp8UNyiyG3XQhyHHSWzZ2bCjgWr8kPVjGmG
    Log [meerkat.stakewars.testnet]: The deposit and stake of 65000000000000000000000000 to @zpool.pool.f863973.m0 succeeded
Transaction Id AW9pFb5RjkCjsyu8ng56XVvckvd3drPBPtnqVo6bJhqh
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/AW9pFb5RjkCjsyu8ng56XVvckvd3drPBPtnqVo6bJhqh
true

The true statement at the end means the transaction was successful.

c. Measure the rewards

Since NEAR automatically re-stakes all staking pool rewards, you have to update your staked balance to know the amount of tokens you earned with your validator.

Use the call method refresh_staking_pool_balance to check your new balance:

near call $LOCKUP_ID refresh_staking_pool_balance '' \
  --accountId $ACCOUNT_ID

If using a Ledger:

near call $LOCKUP_ID refresh_staking_pool_balance '' \
  --accountId $ACCOUNT_ID --useLedgerKey $HD_PATH

You should expect a result like:

$ near call $LOCKUP_ID refresh_staking_pool_balance '' \
  --accountId $ACCOUNT_ID | grep "current total balance"
    Log [meerkat.stakewars.testnet]: The current total balance on the staking pool is 65000000000000000000000000

Note that in this example, the result is piped to grep (| grep "current total balance") to display only the relevant output.

Please refer to the Lockup Contract readme if you need to know how to withdraw the staking rewards to your main wallet.

Unstake and withdraw your lockup tokens

NEAR Protocol automatically re-stakes all the rewards back to the staking pools, so your staked balance increases over time, accruing rewards.

Before starting, it's highly recommended to read the Lockup contracts documentation to understand which portion of the tokens is liquid, and which one is still locked even after the three epochs.

If you want to withdraw funds, you have to issue two separate commands:

  1. Manually unstake tokens from the staking pool, and wait three epochs
  2. Manually withdraw tokens back to your main account

Both these command require the amount in yoctoNEAR, which is the smallest unit of account for NEAR tokens. You can use the table below for the conversion, or install near-units (npm i -g near-units) and use commands like near-units 1,000N:

NEARYoctoNEARYoctoNEAR
11*10^241000000000000000000000000
101*10^2510000000000000000000000000
1001*10^26100000000000000000000000000
1,0001*10^271000000000000000000000000000
10,0001*10^2810000000000000000000000000000

As an example, if you want to unstake 10 NEAR tokens from the staking pool, you have to call the method unstake with 10000000000000000000000000 (1*10^24, 10 power 24, or 10 with 24 zeros) as an argument.

a. Unstake the tokens

Before unstaking any tokens, use the the view method get_account introduced above to know what is the available balance:

near view $POOL_ID get_account '{"account_id": "'$LOCKUP_ID'"}'

You should expect a result like:

$ near view zpool.pool.f863973.m0 get_account '{"account_id": "meerkat.stakewars.testnet"}'
View call: zpool.pool.f863973.m0.get_account({"account_id": "meerkat.stakewars.testnet"})
{
  account_id: 'meerkat.stakewars.testnet',
  unstaked_balance: '5',
  staked_balance: '86236099167204810592552675',
  can_withdraw: false
}

The result of this method shows:

  • An unstaked balance of 5 yocto
  • A staked balance of 86236099167204810592552675 yocto, or 86.23 $NEAR
  • can_withdraw is false (see below)

Check your rewards

From the examples above, the initial stake of 65 NEAR tokens increased to 86.23 tokens, with 21.23 tokens as a reward!

You can unstake an amount of funds that is equal or lower than your staked_balance, by calling the metod unstake. You may first want to set the amount you want to unstake to a variable AMOUNT:

export AMOUNT=# amount to unstake

Check that it looks correct:

echo $AMOUNT

And maybe also using near-units:

near-units -h $AMOUNT yN

And now unstake:

near call $LOCKUP_ID unstake '{
  "amount": "'$AMOUNT'"
}' --accountId $ACCOUNT_ID --gas 200000000000000

Or with a Ledger:

near call $LOCKUP_ID unstake '{
  "amount": "'$AMOUNT'"
}' --accountId $ACCOUNT_ID --gas 200000000000000 --useLedgerKey $HD_PATH

You should expect a result like:

Scheduling a call: meerkat.stakewars.testnet.unstake({"amount": "42000000000000000000000000"})
Waiting for confirmation on Ledger...
Using public key: ed25519:5JgsX9jWUTS5ttHeTjuDFgCmB5YX77f7GHxuQfaGVsyj
Waiting for confirmation on Ledger...
Ledger app version: 1.1.3
Receipts: D5fCCWa5b5N8X9VtxsbRvGhSSCQc56Jb312DEbG4YY8Z, 72rgHrMb1zkUU2RiEz2EMCAuMWFgRJTf8eovwAUkuo31, A2dvSgxpDXfNZUrDVdpewk1orVTVxCMiicjk7qyNq3dW
    Log [meerkat.stakewars.testnet]: Unstaking 42000000000000000000000000 from the staking pool @zpool.pool.f863973.m0
Receipts: 9MbLXn28nQyL6BopMEUggBD9NA1QfVio9VB3LTNJ6P5b, 5g7F6HehoGZ2DHS7w54xHAjAeHCsHaAsKpVed76MFYru, BKbtF77i1WEqpuFLtEjWerM2LVZW1md9ecQ5UcBpMNXj
    Log [meerkat.stakewars.testnet]: Epoch 162: Contract received total rewards of 9488161121527521670023204339 tokens. New total staked balance is 142388816229749953331375665038. Total number of shares 79574075700231185032355056920
    Log [meerkat.stakewars.testnet]: Total rewards fee is 530246455678218748147822292 stake shares.
    Log [meerkat.stakewars.testnet]: @meerkat.stakewars.testnet unstaking 42000000000000000000000001. Spent 23471725293488513736732361 staking shares. Total 42000000000000000000000002 unstaked balance and 24721370659717793595217321 staking shares
    Log [meerkat.stakewars.testnet]: Contract total staked balance is 142346816229749953331375665038. Total number of shares 79550603974937696518618324559
Receipt: 3DXSx8aMvhwtJUB6mhTueNbDiqz5wYu3xzzYkZrgjw1u
    Log [meerkat.stakewars.testnet]: Unstaking of 42000000000000000000000000 at @zpool.pool.f863973.m0 succeeded
Transaction Id 2rRpdN8AAoySfWsgE7BRtRfz7VFnyFzRhssfaL87rXGf
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/2rRpdN8AAoySfWsgE7BRtRfz7VFnyFzRhssfaL87rXGf
true

The true statement at the end means the transaction was successful.

Wait three epochs, or ~36 hours before using the withdraw command

For security reasons, NEAR Protocol keeps your unstaked funds locked for three more epochs (~36 hours). Use again the view method get_account to verify if can_withdraw is true:

near view $POOL_ID get_account '{"account_id": "'$LOCKUP_ID'"}'

The result should be as follows:

View call: zpool.pool.f863973.m0.get_account({"account_id": "meerkat.stakewars.testnet"})
{
  account_id: 'meerkat.stakewars.testnet',
  unstaked_balance: '42000000000000000000000006',
  staked_balance: '44244760537191121230392104',
  can_withdraw: true
}

Note that the variable can_withdraw is true. This means that the unstaked_balance of 42000000000000000000000000 yoctoNEAR (42 NEAR tokens) is now available for withdraw.

b. Withdraw the tokens

Funds can be withdrawn after three epochs (~36 hours) from the unstake command. It is highly recommended to read the Lockup contracts documentation to understand which portion of the unstaked tokens is available for transfers, and which is still vesting and unavailable (even after three epochs).

Use the call method withdraw_all_from_staking_pool:

near call $LOCKUP_ID withdraw_all_from_staking_pool '' --accountId $ACCOUNT_ID --gas 200000000000000

Or if using a Ledger:

near call $LOCKUP_ID withdraw_all_from_staking_pool '' --accountId $ACCOUNT_ID --gas 200000000000000 --useLedgerKey $HD_PATH

You should expect a result like this one:

Scheduling a call: meerkat.stakewars.testnet.withdraw_all_from_staking_pool()
Waiting for confirmation on Ledger...
Using public key: ed25519:5JgsX9jWUTS5ttHeTjuDFgCmB5YX77f7GHxuQfaGVsyj
Waiting for confirmation on Ledger...
Ledger app version: 1.1.3
Receipts: 6dt3HNDrb7jM4F7cRtwgRSfRMWwFmE8BHeZSDghrpQtw, 7pNKTevct7Z4birAPec81LmnSpJSeJXbFq3cBdjFvsnM, A7yJXdaGcFyiBNQimFtHF479Jm6xiXHvfodTbtFf7Rww
    Log [meerkat.stakewars.testnet]: Going to query the unstaked balance at the staking pool @zpool.pool.f863973.m0
Receipts: 2ytgB57D6CJe3vkxdVTiVAytygpTteR4sDmpUNxo5Ltk, CZChcT1uDDxqojnZQq6r7zzx6FE3Z6E5fZ3F23Y1dnyM, GjrWhJgbCAAHUNyvw4QX5YKFpeUVNJ9GpuEdmUXFozeG
    Log [meerkat.stakewars.testnet]: Withdrawing 42000000000000000000000006 from the staking pool @zpool.pool.f863973.m0
Receipts: 9nHoqnQygqKYyyR5KDofkYy5KiJxbu2eymoGUUc2tSR3, 5RvBSb4BuHxRhc5U6nLgsCjAvJ88hJ2jwkr1ramk37mE, 5PDN1EYXnCJrTSU7zzJtmAuj9vvGSVurh94nvfHDHXpa, GTTGm4sXcSWD2gnohMJzD7TQcQxuSe7AFABZKqxPLgau
    Log [meerkat.stakewars.testnet]: Epoch 168: Contract received total rewards of 514182787298700000000 tokens. New total staked balance is 142377784876419564057032272059. Total number of shares 79552334320822393318832070510
    Log [meerkat.stakewars.testnet]: Total rewards fee is 28729510739826825657 stake shares.
    Log [meerkat.stakewars.testnet]: @meerkat.stakewars.testnet withdrawing 42000000000000000000000006. New unstaked balance is 0
Receipt: rS5KjvzkbaxEH7aG8VXyd9EEEfY7PygdLzSZ3W9qf3w
    Log [meerkat.stakewars.testnet]: The withdrawal of 42000000000000000000000006 from @zpool.pool.f863973.m0 succeeded
Transaction Id EjNpoU7BNfEQujckL8JiAP8kYDH1SMLw4wC32tL3uyaH
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/EjNpoU7BNfEQujckL8JiAP8kYDH1SMLw4wC32tL3uyaH
true

The true statement confirms the successful withdrawal.

By using again the view method:

near view $POOL_ID get_account '{"account_id": "'$LOCKUP_ID'"}'

The result should be as follows:

View call: zpool.pool.f863973.m0.get_account({"account_id": "meerkat.stakewars.testnet"})
{
  account_id: 'meerkat.stakewars.testnet',
  unstaked_balance: '0',
  staked_balance: '44244760947075774431066852',
  can_withdraw: true
}

At this point the unstaked_balance is 0, and the funds are back in the lockup contract balance.

Heads up

Lockup contracts allow you to transfer only the unlocked portion of your funds. In the example above, out of the 42 NEAR unstaked, only 21.23 can be transferred to another wallet or exchange.

c. Change staking pools

To change from one staking pool to another, you must first withdraw all deposits in the currently selected staking pool. Then call unselect_staking_pool as follows (docs):

near call $LOCKUP_ID unselect_staking_pool --accountId $ACCOUNT_ID --gas 300000000000000

Or if using Ledger:

near call $LOCKUP_ID unselect_staking_pool --accountId $ACCOUNT_ID --useLedgerKey $HD_PATH --gas 300000000000000

Staking Pool Delegation

Any funds that are not stored inside lockup contracts can be directly delegated to a staking pool by using the call method deposit_and_stake:

near call $POOL_ID deposit_and_stake '' --accountId $ACCOUNT_ID --amount 100

Or if using Ledger:

near call $POOL_ID deposit_and_stake '' --accountId $ACCOUNT_ID --useLedgerKey $HD_PATH --amount 100

You should expect a result like:

Scheduling a call: valeraverim.pool.f863973.m0.deposit_and_stake() with attached 100 NEAR
Receipts: FEfNuuCSttu7m4dKQPUSgpSFJSB86i6T2sYJWSv7PHPJ, GPYhZsyUuJgvr7gefxac4566DVQcyGs4wSFeydkmRX7D, 8hfcJuwsstnFQ1cgU5iUigvfrq1JcbaKURvKf5shaB4g
    Log [valeraverim.pool.f863973.m0]: Epoch 106: Contract received total rewards of 545371217890000000000 tokens. New total staked balance is 75030000959768421358700000000. Total number of shares 75029067713856889417103116457
    Log [valeraverim.pool.f863973.m0]: Total rewards fee is 54536443439735902364 stake shares.
    Log [valeraverim.pool.f863973.m0]: @meerkat.testnet deposited 100000000000000000000000000. New unstaked balance is 100000000000000000000000000
    Log [valeraverim.pool.f863973.m0]: @meerkat.testnet staking 99999999999999999999999999. Received 99998756169666008195607157 new staking shares. Total 1 unstaked balance and 99998756169666008195607157 staking shares
    Log [valeraverim.pool.f863973.m0]: Contract total staked balance is 75130000959768421358700000000. Total number of shares 75129066470026555425298723614
Transaction Id FDtzMmusJgFbryeVrdQyNvp6XU2xr11tecgqnnSsvyxv
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/FDtzMmusJgFbryeVrdQyNvp6XU2xr11tecgqnnSsvyxv
''

The empty string at the end, '', means the call was successful.

If you want to check your staking rewards, use the view method get_account:

near view $POOL_ID get_account '{"account_id": "'$ACCOUNT_ID'"}'

You should expect a result like:

View call: valeraverim.pool.f863973.m0.get_account({"account_id": "meerkat.testnet"})
{
  account_id: 'meerkat.testnet',
  unstaked_balance: '1',
  staked_balance: '100663740438210643632989745',
  can_withdraw: true
}

The staked balance in this example is 100663740438210643632989745, or 100.66 $NEAR (reminder: you can easily convert these using near-units -h 100663740438210643632989745yN).

A pool's rewards only compound if it has been "pinged", which means either having a direct action performed on it (like someone delegating or undelegating) or if the ping method is called on it once within a particular epoch. This is important to do if you run a pool and want your delegators to see updated reward balances.

Use the call method ping to re-calculate the rewards up to the previous epoch:

near call $POOL_ID ping '{}' --accountId $ACCOUNT_ID

Or if using a Ledger:

near call $POOL_ID ping '{}' --accountId $ACCOUNT_ID --useLedgerKey $HD_PATH

You should expect a result like:

Scheduling a call: valeraverim.pool.f863973.m0.ping({})
Transaction Id 4mTrz1hDBMTWZx251tX4M5CAo5j7LaxLiPtQrDvQgcZ9
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/4mTrz1hDBMTWZx251tX4M5CAo5j7LaxLiPtQrDvQgcZ9
''

The '' result means that your call was successful, and the get_account view method will provide updated results.

Note that you can ping any pool, not just one you own.

Fun Facts

  1. pinging a pool technically removes 2 epochs of future compounding but it's an extremely small amount -- without considering compounding effect of epochs with 9 hour epochs, the reward per epoch is 5% / (365 * 24 / 9) + 1 or 1.00005136986

    It means this reward on top of reward is what you’re losing, so that's about 1.00000000264 or 0.000000264%... meaning for 10M stake it’s 0.02638862826 NEAR per epoch.

Got a question?

Ask it on StackOverflow!