docs/02_cleos/02_how-to-guides/how-to-stake-resource.md
This how-to guide provides instructions on how to stake resources, NET and/or CPU, for your account using the cleos CLI tool.
Install the currently supported version of cleos.
Ensure the reference system contracts are deployed and used to manage system resources.
Understand the following:
delegatebw cleos sub-command.See the following reference guides for command line usage and related options for the cleos command:
The following steps show:
Run the following command to stake 0.01 SYS of NET bandwidth for alice account from bob account:
cleos system delegatebw alice bob "0.01 SYS" "0 SYS"
Where:
alice = the account for which the NET bandwidth is staked.bob = the account that pays the 0.01 SYS for the NET bandwidth staked.0.01 SYS = the amount of SYS tokens allocated to stake NET bandwidth.0 SYS = the amount of SYS tokens allocated to stake CPU bandwidth.Example output:
executed transaction: 5487afafd67bf459a20fcc2dbc5d0c2f0d1f10e33123eaaa07088046fd18e3ae 192 bytes 503 us
# eosio <= eosio::delegatebw {"from":"bob","receiver":"alice","stake_net_quantity":"0.01 SYS","stake_cpu_quanti...
# eosio.token <= eosio.token::transfer {"from":"bob","to":"eosio.stake","quantity":"0.01 EOS","memo":"stake bandwidth"}
# alice <= eosio.token::transfer {"from":"bob","to":"eosio.stake","quantity":"0.01 SYS","memo":"stake bandwidth"}
# eosio.stake <= eosio.token::transfer {"from":"bob","to":"eosio.stake","quantity":"0.01 SYS","memo":"stake bandwidth"}
Run the following command to stake 0.01 SYS of CPU bandwidth for alice account from bob account:
cleos system delegatebw alice bob "0 SYS" "0.01 SYS"
Where:
alice = the account for which the CPU bandwidth is staked.bob = the account that pays the 0.01 SYS for the CPU bandwidth staked.0 SYS = the amount of SYS tokens allocated to stake NET bandwidth.0.01 SYS = the amount SYS tokens allocated to stake CPU bandwidth.Example output:
executed transaction: 5487afafd67bf459a20fcc2dbc5d0c2f0d1f10e33123eaaa07088046fd18e3ae 192 bytes 503 us
# eosio <= eosio::delegatebw {"from":"bob","receiver":"alice","stake_net_quantity":"0.0000 SYS","stake_cpu_quanti...
# eosio.token <= eosio.token::transfer {"from":"bob","to":"eosio.stake","quantity":"0.01 EOS","memo":"stake bandwidth"}
# alice <= eosio.token::transfer {"from":"bob","to":"eosio.stake","quantity":"0.01 SYS","memo":"stake bandwidth"}
# eosio.stake <= eosio.token::transfer {"from":"bob","to":"eosio.stake","quantity":"0.01 SYS","memo":"stake bandwidth"}
Run the following command to stake 0.01 SYS of NET and 0.02 SYS of CPU bandwidth for alice account from bob account:
cleos system delegatebw alice bob "0.01 SYS" "0.02 SYS"
Where:
alice = the account for which the NET and CPU bandwidth is staked.bob = the account that pays 0.01 SYS for the NET and 0.02 SYS for the CPU bandwidth staked.0.01 SYS = the amount of SYS tokens allocated to stake NET bandwidth.0.02 SYS = the amount of SYS tokens allocated to stake CPU bandwidth.Example output:
executed transaction: 5487afafd67bf459a20fcc2dbc5d0c2f0d1f10e33123eaaa07088046fd18e3ae 192 bytes 503 us
# eosio <= eosio::delegatebw {"from":"bob","receiver":"alice","stake_net_quantity":"0.01 SYS","stake_cpu_quanti...
# eosio.token <= eosio.token::transfer {"from":"bob","to":"eosio.stake","quantity":"0.01 EOS","memo":"stake bandwidth"}
# alice <= eosio.token::transfer {"from":"bob","to":"eosio.stake","quantity":"0.01 SYS","memo":"stake bandwidth"}
# eosio.stake <= eosio.token::transfer {"from":"bob","to":"eosio.stake","quantity":"0.01 SYS","memo":"stake bandwidth"}
[[info|An account can stake to itself]]
| An account can stake resources to itself, that is, bob account can be substituted in the above examples with alice, provided alice account holds sufficient SYS tokens. That means alice account stakes resources to itself.
In conclusion, the above instructions show how to stake CPU and/or NET bandwidth from one account to another or to itself.