- Any notes or instructions assume your using Ubuntu
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).
- To set your current session env to the correct network you can use
export NODE_ENV=guildnet
- To make the change load for every new session
echo "export NODE_ENV=guildnet" >> ~/.profile
- To make the change immediate use
source ~/.profile
If you get stuck, give a look to the troubleshooting page, open an issue, or join near.chat on Discord
This uses the staking pool factory to deploy a staking pool. On the guildnet network you are free to deploy your own contracts if you choose. All pools deployed with this method on guildnet will end with the .stake.guildnet suffix.
near call stake.guildnet create_staking_pool '{"staking_pool_id": "nearkat", "owner_id": "pool_admin.nearkat", "stake_public_key": "ed25519:00000000000000000000000000000000000000000042", "reward_fee_fraction": {"numerator": 10, "denominator": 100}}' --accountId="pool_admin.nearkat" --amount=30 --gas=300000000000000
From the example above, you have to replace:
nearkatwith the name of your staking pool (HEADS UP: the factory automatically adds its name to this parameter, creatingnearkat.stakingpool)pool_admin.nearkatwith the wallet that will control the staking pooled25519:0..042with the public key in yourvalidator.jsonfile25with the fees that you like (in this case 25 over 100 is 25% of fees!)pool_admin.nearkatin the --accountId with your pool admin account- be sure to have
30NEAR available in your account (HEADS UP: keep the minimum balance to pay the storage stake)
This method 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).
- HINT: Copy/Paste everything after this line into a text editor and use search and replace
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