This low-maintained cheatsheet supports Validators and Delegators who use near-cli to manage their stake.
Replace nearkat.stakingpool
with the name of your pool, and pool_admin.nearkat
with the owner/administrator of the pool (or the account that is staking the tokens).
If you get stuck, give a look to the troubleshooting page, open an issue, or join near.chat on Discord
This is the only method allowed to deploy a staking pool on TestNet and MainNet, and uses the staking pool factory. All pools deployed with this method on TestNet will end with the .stakingpool
suffix.
near call stakingpool create_staking_pool '{"staking_pool_id":"nearkat", "owner_id":"pool_admin.nearkat", "stake_public_key":"ed25519:00000000000000000000000000000000000000000042", "reward_fee_fraction": {"numerator":25, "denominator": 100}}' --accountId pool_admin.nearkat --amount 30
From the example above, you have to replace:
nearkat
with the name of your staking pool (HEADS UP: the factory automatically adds its name to this parameter, creatingnearkat.stakingpool
)pool_admin.nearkat
with the wallet that will control the staking pooled25519:0..042
with the public key in yourvalidator.json
file25
with the fees that you like (in this case 25 over 100 is 25% of fees!)pool_admin.nearkat
in the --accountId with your pool admin account- be sure to have
30
NEAR available in your account (HEADS UP: keep the minimum balance to pay the storage stake)
Once your pool is deployed, you can issue the commands below
near call nearkat.stakingpool deposit '' --accountId pool_admin.nearkat --amount 10000
near call nearkat.stakingpool stake '{"amount": "10000000000000000000000000000"}' --accountId pool_admin.nearkat
near call nearkat.stakingpool ping '{}' --accountId pool_admin.nearkat
near view nearkat.stakingpool get_account_total_balance '{"account_id": "pool_admin.nearkat"}'
near view nearkat.stakingpool get_account_staked_balance '{"account_id": "pool_admin.nearkat"}'
near call nearkat.stakingpool unstake '{"amount": "10000000000000000000000000000"}' --accountId pool_admin.nearkat
near view nearkat.stakingpool get_account_unstaked_balance '{"account_id": "pool_admin.nearkat"}'
near view nearkat.stakingpool is_account_unstaked_balance_available '{"account_id": "pool_admin.nearkat"}'
near call nearkat.stakingpool withdraw '{"amount": "10000000000000000000000000000"}' --accountId pool_admin.nearkat
near view nearkat.stakingpool get_owner_id '{}'
near view nearkat.stakingpool get_staking_key '{}'
(replace the pubkey below with the key in your validator.json
file)
near call nearkat.stakingpool update_staking_key '{"stake_public_key": "ed25519:00000000000000000000000000000000000000000042"}' --accountId pool_admin.nearkat
near call nearkat.stakingpool pause_staking '{}' --accountId pool_admin.nearkat
near call nearkat.stakingpool resume_staking '{}' --accountId pool_admin.nearkat
This method can be used only on BetaNet, and allows you to run your own fork of the staking pool.
(replace my_cool_pool.nearkat
account with your cool pool name)
near deploy --accountId=my_cool_pool.nearkat --wasmFile=res/staking_pool_with_shares.wasm
(replace my_cool_pool.nearkat
, pool_admin.nearkat
, stake_public_key
and reward_fee_fraction
accordingly)
near call my_cool_pool.nearkat new '{"owner_id": "pool_admin.nearkat", "stake_public_key": "ed25519:00000000000000000000000000000000000000000042", "reward_fee_fraction": {"numerator": 25, "denominator": 100}}' --accountId pool_admin.nearkat
The pool above will have 25% of fees (25 numerator, 100 denominator).