一般创建账号,或者三方购买的账号都是最低的资源创建的 (cleos system newaccount 消耗最少的EOS资源)
基本账号下CPU和NET都是零,RAM 3kb以下,因为RAM收费逻辑(EOS零手续费免费?你不知道的EOS收费细节)
- 只要action中执行了持久化存储相关的逻辑就需要收取ram使用费,比如系统合约的newaccount ,updateauth, setcode, setabi, schedule_deferred_transaction, eosio.token的transfer
所以在账号资源不足的情况下,转账操作会提示以下错误
surou@surou-C-H110M-K-Pro:~/.local/share/eosio/nodeos/config$ cleos push action eosio.token transfer '["eosio", "bcskillsurou","100.0000 EOS","vote"]' -p eosio
executed transaction: e233ccc335b833ac9d7746a43e3b4e591795151c95f989a36976f8ceb98a08c7 136 bytes 562 us
# eosio.token <= eosio.token::transfer {"from":"eosio","to":"bcskillsurou","quantity":"100.0000 EOS","memo":"vote"}
# eosio <= eosio.token::transfer {"from":"eosio","to":"bcskillsurou","quantity":"100.0000 EOS","memo":"vote"}
# bcskillsurou <= eosio.token::transfer {"from":"eosio","to":"bcskillsurou","quantity":"100.0000 EOS","memo":"vote"}
warning: transaction executed locally, but may not be confirmed by the network yet
surou@surou-C-H110M-K-Pro:~/.local/share/eosio/nodeos/config$ cleos get currency balance eosio.token bcskillsurou
100.0000 EOS
surou@surou-C-H110M-K-Pro:~/.local/share/eosio/nodeos/config$ cleos push action eosio.token transfer '["bcskillsurou", "eosio","1.0000 EOS","vote"]' -p bcskillsurou
Error 3080001: account using more than allotted RAM usage
提示RAM不足已支持转账
如果自己给自己直接购买RAM的话
surou@surou-C-H110M-K-Pro:~/.local/share/eosio/nodeos/config$ cleos system buyram bcskillsurou bcskillsurou "0.1000 EOS"
3536793ms thread-0 main.cpp:429 create_action ] result: {"binargs":"a0e9d5384607313aa0e9d5384607313ae80300000000000004454f5300000000"} arg: {"code":"eosio","action":"buyram","args":{"payer":"bcskillsurou","receiver":"bcskillsurou","quant":"0.1000 EOS"}}
Error 3080002: transaction exceeded the current network usage limit imposed on the transaction
提示NET不足
如果自己给自己抵押换取NET和CPU时
surou@surou-C-H110M-K-Pro:~/.local/share/eosio/nodeos/config$ cleos system delegatebw bcskillsurou bcskillsurou '0.1000 EOS' '0.1000 EOS' -p bcskillsurou
48402ms thread-0 main.cpp:1084 operator() ] act_payload: {"from":"bcskillsurou","receiver":"bcskillsurou","stake_net_quantity":"0.1000 EOS","stake_cpu_quantity":"0.1000 EOS","transfer":false}
48403ms thread-0 main.cpp:429 create_action ] result: {"binargs":"a0e9d5384607313aa0e9d5384607313ae80300000000000004454f5300000000e80300000000000004454f530000000000"} arg: {"code":"eosio","action":"delegatebw","args":{"from":"bcskillsurou","receiver":"bcskillsurou","stake_net_quantity":"0.1000 EOS","stake_cpu_quantity":"0.1000 EOS","transfer":false}}
Error 3080001: account using more than allotted RAM usage
又提示RAM不足...先有鸡还是先有蛋,死循环。所以只能让其他RAM资源充足的账号例如 eosio
帮此账号bcskillsurou
购买
surou@surou-C-H110M-K-Pro:~/.local/share/eosio/nodeos/config$ cleos system buyram eosio bcskillsurou "0.1000 EOS"
177473ms thread-0 main.cpp:429 create_action ] result: {"binargs":"0000000000ea3055a0e9d5384607313ae80300000000000004454f5300000000"} arg: {"code":"eosio","action":"buyram","args":{"payer":"eosio","receiver":"bcskillsurou","quant":"0.1000 EOS"}}
executed transaction: f5aa4dd7f6a850b65884174a4f86285414ca5c50ba1ab6ddc2a7f9ba5b65c051 128 bytes 1814 us
# eosio <= eosio::buyram {"payer":"eosio","receiver":"bcskillsurou","quant":"0.1000 EOS"}
# eosio.token <= eosio.token::transfer {"from":"eosio","to":"eosio.ram","quantity":"0.0995 EOS","memo":"buy ram"}
# eosio <= eosio.token::transfer {"from":"eosio","to":"eosio.ram","quantity":"0.0995 EOS","memo":"buy ram"}
# eosio.ram <= eosio.token::transfer {"from":"eosio","to":"eosio.ram","quantity":"0.0995 EOS","memo":"buy ram"}
# eosio.token <= eosio.token::transfer {"from":"eosio","to":"eosio.ramfee","quantity":"0.0005 EOS","memo":"ram fee"}
# eosio <= eosio.token::transfer {"from":"eosio","to":"eosio.ramfee","quantity":"0.0005 EOS","memo":"ram fee"}
# eosio.ramfee <= eosio.token::transfer {"from":"eosio","to":"eosio.ramfee","quantity":"0.0005 EOS","memo":"ram fee"}
warning: transaction executed locally, but may not be confirmed by the network yet
当bcskillsurou
RAM足够后,就可以自己或者其他账号抵押购买CPU和NET了
surou@surou-C-H110M-K-Pro:~/.local/share/eosio/nodeos/config$ cleos system delegatebw bcskillsurou bcskillsurou '0.1000 EOS' '0.1000 EOS' -p bcskillsurou
214840ms thread-0 main.cpp:1084 operator() ] act_payload: {"from":"bcskillsurou","receiver":"bcskillsurou","stake_net_quantity":"0.1000 EOS","stake_cpu_quantity":"0.1000 EOS","transfer":false}
214841ms thread-0 main.cpp:429 create_action ] result: {"binargs":"a0e9d5384607313aa0e9d5384607313ae80300000000000004454f5300000000e80300000000000004454f530000000000"} arg: {"code":"eosio","action":"delegatebw","args":{"from":"bcskillsurou","receiver":"bcskillsurou","stake_net_quantity":"0.1000 EOS","stake_cpu_quantity":"0.1000 EOS","transfer":false}}
executed transaction: b57bad80a397c6fee9aab0519600b9c063f6084fadd542402fe07ce93d2643bb 144 bytes 1720 us
# eosio <= eosio::delegatebw {"from":"bcskillsurou","receiver":"bcskillsurou","stake_net_quantity":"0.1000 EOS","stake_cpu_quanti...
# eosio.token <= eosio.token::transfer {"from":"bcskillsurou","to":"eosio.stake","quantity":"0.2000 EOS","memo":"stake bandwidth"}
# bcskillsurou <= eosio.token::transfer {"from":"bcskillsurou","to":"eosio.stake","quantity":"0.2000 EOS","memo":"stake bandwidth"}
# eosio.stake <= eosio.token::transfer {"from":"bcskillsurou","to":"eosio.stake","quantity":"0.2000 EOS","memo":"stake bandwidth"}
warning: transaction executed locally, but may not be confirmed by the network yet
此时再次转账的话
surou@surou-C-H110M-K-Pro:~/.local/share/eosio/nodeos/config$ cleos get currency balance eosio.token bcskillsurou
99.8000 EOS
surou@surou-C-H110M-K-Pro:~/.local/share/eosio/nodeos/config$ cleos push action eosio.token transfer '["bcskillsurou", "eosio","1.0000 EOS","vote"]' -p bcskillsurou
executed transaction: cd9a0780b51db71a0efd096578dc453d26a528af6fa4e4e7ab0b139e9d9753ae 136 bytes 548 us
# eosio.token <= eosio.token::transfer {"from":"bcskillsurou","to":"eosio","quantity":"1.0000 EOS","memo":"vote"}
# bcskillsurou <= eosio.token::transfer {"from":"bcskillsurou","to":"eosio","quantity":"1.0000 EOS","memo":"vote"}
# eosio <= eosio.token::transfer {"from":"bcskillsurou","to":"eosio","quantity":"1.0000 EOS","memo":"vote"}
warning: transaction executed locally, but may not be confirmed by the network yet
surou@surou-C-H110M-K-Pro:~/.local/share/eosio/nodeos/config$ cleos get currency balance eosio.token bcskillsurou
98.8000 EOS
就一切OK了