获取代币的信息
获取标准代币的信息。使用方式 cleos get currency [OPTIONS] SUBCOMMAND。
1. 获取指定代币和账户的余额
$ cleos get currency balance eosio.token eosio EOS
39999900.0000 EOS
其中:
- eosio.token 是合约名称
- eosio 是账户名称
- EOS 是系统代币符号
2. 获取代币的状态信息
$ cleos get currency stats eosio.token EOS
{
"EOS": {
"supply": "1060011818.7401 EOS",
"max_supply": "10000000000.0000 EOS",
"issuer": "eosio"
}
}
其中:
- eosio.token 是合约名称
- EOS 是系统代币符号
3. 代币转账
将代币从一个账户转给另一个账户。使用方式 cleos transfer [OPTIONS] sender recipient amount [memo]。
$ cleos transfer eosio alice "1 EOS" "memo"
executed transaction: 42614070224aea6b30315a1a6e25f6e743dfd603cc51ffd63d6bb87bd5a9cb5a 136 bytes 391 us
# eosio.token <= eosio.token::transfer {"from":"eosio","to":"alice","quantity":"1.0000 EOS","memo":"memo"}
# eosio <= eosio.token::transfer {"from":"eosio","to":"alice","quantity":"1.0000 EOS","memo":"memo"}
# alice <= eosio.token::transfer {"from":"eosio","to":"alice","quantity":"1.0000 EOS","memo":"memo"}
warning: transaction executed locally, but may not be confirmed by the network yet ]
其中:
- eosio 是 sender
- alice 是 recipient
- "1 EOS" 是资产数量
- "memo" 是备注信息
使用选项
$ cleos transfer eosio alice "1 EOS" "memo" --contract eosio.token
executed transaction: 3572f5459e92dd4de1dea905fc757c8d123da62498d8b8475b76ee7dddb668f2 136 bytes 342 us
# eosio.token <= eosio.token::transfer {"from":"eosio","to":"alice","quantity":"1.0000 EOS","memo":"memo"}
# eosio <= eosio.token::transfer {"from":"eosio","to":"alice","quantity":"1.0000 EOS","memo":"memo"}
# alice <= eosio.token::transfer {"from":"eosio","to":"alice","quantity":"1.0000 EOS","memo":"memo"}
warning: transaction executed locally, but may not be confirmed by the network yet ]
附录 1. action
$ cleos push action eosio.token issue '{"to" : "eosio", "quantity" : "10000000.0000 EOS", "memo" : "memo"}' -p eosio@active
项目源代码
项目源代码会逐步上传到 Github,地址为 https://github.com/windstamp/blockchain。
Contributor
- Windstamp, https://github.com/windstamp