前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >EOSIO 转帐详解

EOSIO 转帐详解

作者头像
EOS中文社区
发布2018-05-10 23:33:26
1.4K1
发布2018-05-10 23:33:26
举报
文章被收录于专栏:区块链技术专栏

前言:最近有许多小伙伴问关于转账的一些操作,笔者在这里写一个教程进行详细说明。

EOS和EOS的不同之处

在EOS网络中存在两种货币,一种是EOS,还有一种是EOS网络中的代币。说到这里大家似乎有点疑惑,举个简单的例子,就好比ETH网络中的ETH,ETH网络中的其他代币。这样大家或许都清除了吧。

在目前EOS网络中可以通过合约eosio.token产生多种名称为EOS的代币。但是还有一种通过合约eosio.system合约发布的代币,它是EOS网络中真正的EOS,他会存储在用户的账户中。可以通过cleos transfer来交易。

通过eosio.token发布的EOS代币

  1. 发布bios合约
代码语言:txt
复制
cleos set contract eosio eosio.bios/
  1. 创建账户
代码语言:txt
复制
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...
  1. eostea发布代币EOS

发布合约:

代码语言:txt
复制
> 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...

创建代币:

代码语言:txt
复制
>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}

发布代币:

代码语言:txt
复制
$ 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

查看代币:

代码语言:txt
复制
$cleos get currency balance eostea eostea
10000 TEA
100000 EOS

下面笔者来做一个实验,用eosio再创建一种EOS代币,得到的结果:

代码语言:txt
复制
cleos get currency balance eosio eosio
10000 EOS

给eostea转账:

代码语言:txt
复制
cleos push action eosio transfer '["eosio","eostea","100 EOS",""]' -p eosio

查看eostea的代币:

代码语言:txt
复制
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

这样我发型了两种EOS代币。但是.....

看看数据库里面是这样的:

代码语言:txt
复制
{
    "_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;

发型EOS

代码语言:txt
复制
$ 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:

代码语言:txt
复制
{
    "_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" : {
        ........
    }
}

转账:

代码语言:txt
复制
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":""}

账户余额:

代码语言:txt
复制
{
    "_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" : {
        ........
    }
}

相信看完这些,大家都非常清楚了。

原文转自EOS中文社区: https://eosfans.io/topics/442

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文系转载前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • EOS和EOS的不同之处
  • 通过eosio.token发布的EOS代币
  • 发型EOS
相关产品与服务
对象存储
对象存储(Cloud Object Storage,COS)是由腾讯云推出的无目录层次结构、无数据格式限制,可容纳海量数据且支持 HTTP/HTTPS 协议访问的分布式存储服务。腾讯云 COS 的存储桶空间无容量上限,无需分区管理,适用于 CDN 数据分发、数据万象处理或大数据计算与分析的数据湖等多种场景。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档