EOS和EOS的不同之處
在EOS網(wǎng)絡(luò)中存在兩種貨幣垃喊,一種是EOS猾普,還有一種是EOS網(wǎng)絡(luò)中的代幣。說(shuō)到這里大家似乎有點(diǎn)疑惑本谜,舉個(gè)簡(jiǎn)單的例子初家,就好比ETH網(wǎng)絡(luò)中的ETH,ETH網(wǎng)絡(luò)中的其他代幣。這樣大家或許都清除了吧溜在。
在目前EOS網(wǎng)絡(luò)中可以通過(guò)合約eosio.token產(chǎn)生多種名稱為EOS的代幣陌知。但是還有一種通過(guò)合約eosio.system合約發(fā)布的代幣,它是EOS網(wǎng)絡(luò)中真正的EOS,他會(huì)存儲(chǔ)在用戶的賬戶中掖肋∑推希可以通過(guò)cleos transfer來(lái)交易。
通過(guò)eosio.token發(fā)布的EOS代幣
發(fā)布bios合約
cleos set contract eosio eosio.bios/
創(chuàng)建賬戶
cleos create account eosio eostea EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
>result
executed transaction: c10ba7625be38c823426ac9c974a7c3a774594ea80f600d95c88dc9d1053a3c6? 352 bytes? 102400 cycles
#? ? ? ? eosio <= eosio::newaccount? ? ? ? ? ? {"creator":"eosio","name":"eostea","owner":{"threshold":1,"keys":[{"key":"EOS6MRyAjQq8ud7hVNYcfnVPJq...
eostea發(fā)布代幣EOS 發(fā)布合約:
> cleos set contract eostea eosio.token/
Reading WAST...
Assembling WASM...
Publishing contract...
executed transaction: 7908bd47ae2c68ffa8f0f51bc2401e9deda2e06e16fc60356afa27f316ef529f? 8032 bytes? 2200576 cycles
#? ? ? ? eosio <= eosio::setcode? ? ? ? ? ? ? {"account":"eostea","vmtype":0,"vmversion":0,"code":"0061736d01000000018a011660067f7e7f7f7f7f0060057...
#? ? ? ? eosio <= eosio::setabi? ? ? ? ? ? ? ? {"account":"eostea","abi":{"types":[],"structs":[{"name":"transfer","base":"","fields":[{"name":"fro...
創(chuàng)建代幣:
>cleos push action eostea create '["eostea","10000000 EOS",0,0,0]' -p eostea
executed transaction: ae707244932ccd9c3b5a579d1e3875de6c0188d2024447c90df9ad716ad5ac41? 248 bytes? 104448 cycles
#? ? ? ? eostea <= eostea::create? ? ? ? ? ? ? {"issuer":"eostea","maximum_supply":"10000000 EOS","can_freeze":0,"can_recall":0,"can_whitelist":0}
發(fā)布代幣:
$ cleos push action eostea issue '["eostea","100000 EOS","issue"]' -p eostea
executed transaction: 8e37f71b607d4ec0fd9ef7582b296e0b738a13948fe9cc82090cb96c1db8054e? 256 bytes? 107520 cycles
#? ? ? ? eostea <= eostea::issue? ? ? ? ? ? ? ? {"to":"eostea","quantity":"100000 EOS","memo":"issue"}
>> issue
查看代幣:
$cleos get currency balance eostea eostea
10000 TEA
100000 EOS
下面筆者來(lái)做一個(gè)實(shí)驗(yàn)培遵,用eosio再創(chuàng)建一種EOS代幣,得到的結(jié)果:
cleos get currency balance eosio eosio
10000 EOS
給eostea轉(zhuǎn)賬:
cleos push action eosio transfer '["eosio","eostea","100 EOS",""]' -p eosio
查看eostea的代幣:
lome@lome:~/eos/build/contracts$ cleos get currency balance eostea eostea
10000 TEA
100000 EOS
lome@lome:~/eos/build/contracts$ cleos get currency balance eosio eostea
100 EOS
這樣我發(fā)型了兩種EOS代幣浙芙。但是..... 看看數(shù)據(jù)庫(kù)里面是這樣的:
{
? ? "_id" : ObjectId("5af41c653c27103f203a6beb"),
? ? "name" : "eostea",
? ? "eos_balance" : "0.0000 EOS",
? ? "staked_balance" : "0.0000 EOS",
? ? "unstaking_balance" : "0.0000 EOS",
? ? "createdAt" : "2018-05-10T10:18:13.008Z",
? ? "updatedAt" : "2018-05-10T10:19:34.007Z",
? ? "abi" : {
? ? ? ? ......
? ? }
}
eos_balance是0;
發(fā)型EOS
$ cleos push action eosio issue '["eosio","10000000.0000? EOS",""]' -p eosio
executed transaction: ad53e2b11f1b90f8cb3c5edff982fde7e87f4011773e179ca5a963df14c7227c? 248 bytes? 120832 cycles
#? ? ? ? eosio <= eosio::issue? ? ? ? ? ? ? ? {"to":"eosio","quantity":"10000000.0000 EOS"}
#? ? ? ? eosio <= eosio::transfer? ? ? ? ? ? ? {"from":"eosio","to":"eosio","quantity":"10000000.0000 EOS","memo":""}
然后查看賬戶eosio:
{
? ? "_id" : ObjectId("5af41b903c27103f203a6392"),
? ? "name" : "eosio",
? ? "eos_balance" : "10000000.0000 EOS",
? ? "staked_balance" : "0.0000 EOS",
? ? "unstaking_balance" : "0.0000 EOS",
? ? "createdAt" : "2018-05-10T10:14:40.258Z",
? ? "updatedAt" : "2018-05-10T11:44:28.506Z",
? ? "abi" : {
? ? ? ? ........
? ? }
}
轉(zhuǎn)賬:
cleos transfer eosio eostea 1000000
executed transaction: 76a8b7f4ab67d8205661c0848d6dd4566830e84ca2b86a2ae44cef58c6cea4e1? 256 bytes? 107520 cycles
#? ? ? ? eosio <= eosio::transfer? ? ? ? ? ? ? {"from":"eosio","to":"eostea","quantity":"100.0000 EOS","memo":""}
#? ? ? ? eostea <= eosio::transfer? ? ? ? ? ? ? {"from":"eosio","to":"eostea","quantity":"100.0000 EOS","memo":""}
賬戶余額:
{
? ? "_id" : ObjectId("5af4336c3c27100f643add5f"),
? ? "name" : "eostea",
? ? "eos_balance" : "100.0000 EOS",
? ? "staked_balance" : "0.0000 EOS",
? ? "unstaking_balance" : "0.0000 EOS",
? ? "createdAt" : "2018-05-10T11:56:28.501Z",
? ? "updatedAt" : "2018-05-10T12:05:38.507Z",
? ? "abi" : {
? ? ? ? ........
? ? }
}
相信看完這些籽腕,大家都非常清楚了嗡呼。
轉(zhuǎn)自:EOS中文社區(qū)
轉(zhuǎn)載請(qǐng)說(shuō)明文章出處