docs/02_cleos/02_how-to-guides/how-to-buy-ram.md
This guide provides instructions on how to buy RAM for an EOSIO blockchain account using the cleos CLI tool. RAM is a system resource used to store blockchain state such as smart contract data and account information.
The example uses cleos to buy RAM for the alice account. The alice account pays for the RAM and the alice@active permisssion authorizes the transaction.
Make sure you meet the following requirements:
cleos.
[[info | Note]]
| Cleos is bundled with the EOSIO software. Installing EOSIO will install the cleos and keosd command line tools.eosio.system reference contract from eosio.contracts repository is deployed and used to manage system resources.See the following reference guides for command line usage and related options:
The following step shows you how to buy RAM
SYS tokens for the alice account:cleos system buyram alice alice "0.1 SYS" -p alice@active
Where
alice = payer, the account paying for RAM.alice = receiver, the account receiving bought RAM.0.1 SYS = The amount of tokens to pay for RAM.-p alice@active = The permission used to authorize the payment, in this case the active permission.Example Output
executed transaction: aa243c30571a5ecc8458cb971fa366e763682d89b636fe9dbe7d28327d1cc4e9 128 bytes 283 us
# eosio <= eosio::buyram {"payer":"alice","receiver":"alice","quant":"0.1000 SYS"}
# eosio.token <= eosio.token::transfer {"from":"alice","to":"eosio.ram","quantity":"0.0995 SYS","memo":"buy ram"}
# eosio.token <= eosio.token::transfer {"from":"alice","to":"eosio.ramfee","quantity":"0.0005 SYS","memo":"ram fee"}
# alice <= eosio.token::transfer {"from":"alice","to":"eosio.ram","quantity":"0.0995 SYS","memo":"buy ram"}
# eosio.ram <= eosio.token::transfer {"from":"alice","to":"eosio.ram","quantity":"0.0995 SYS","memo":"buy ram"}
# alice <= eosio.token::transfer {"from":"alice","to":"eosio.ramfee","quantity":"0.0005 SYS","memo":"ram fee"}
# eosio.ramfee <= eosio.token::transfer {"from":"alice","to":"eosio.ramfee","quantity":"0.0005 SYS","memo":"ram fee"}
warning: transaction executed locally, but may not be confirmed by the network yet ]
In conclusion, by following these instructions you are able to purchase RAM, with a specified amount of tokens, for the specified accounts.