Deploy, Issue and Transfer Tokens
【Deploy, Issue and Transfer Tokens】
本例使用 eosio.token 合约来尝试发行Token.
1、签出 eosio.contracts。
git clone https://github.com/EOSIO/eosio.contracts --branch v1.4.0 --single-branch
这里头有很多eosio写的标准合约。

我们将使用上图中的 eosio.token 合约来练习发布 token。
2、eosio.token非常的简单,仅包含 eosio.token.hpp、eosio.token.cpp两件文件。其中提供了6个action:

3、建立一个 eosio.token account,此账户用于发布eosio.token合约。
cleos create account eosio eosio.token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
4、在 eosio.token 目录下编译合约
eosio-cpp -I include -o eosio.token.wasm src/eosio.token.cpp --abigen
5、用 eosio.token 账号发布合约
cleos set contract eosio.token /home/ubuntu/contracts/eosio.contracts/eosio.token --abi eosio.token.abi -p eosio.token@active
6、一个合约可以创建多个token。使用 create 方法创建一种token。
cleos push action eosio.token create '[ "eosio", "1000000000.0000 SYS"]' -p eosio.token@active
因为此处是创建token,所以需要 eosio.token 账户的权限。
it's a symbol_name type composed of two pieces of data, a maximum supply float and a symbol_name in capitalized alpha characters only, for example "1.0000 SYM".
The issuer will be the one with authority to call issue and or perform other actions such as freezing, recalling, and whitelisting of owners.
This command created a new token SYS with a precision of 4 decimals and a maximum supply of 1000000000.0000 SYS. To create this token requires the permission of the eosio.token contract. For this reason, -p eosio.token@active was passed to authorize the request.
7、发行token。
The issuer can issue new tokens to the "alice" account created earlier.
发行者(issuer)可以给其它用户发行token。
cleos push action eosio.token issue '[ "alice", "100.0000 SYS", "memo" ]' -p eosio@active
注意,因为此处是发行token,所以需要发行者(issuer)的权限。
To inspect the transaction, try using the -d -j options, they indicate "don't broadcast" and "return transaction as json," which you may find useful during development.
cleos push action eosio.token issue '["alice", "100.0000 SYS", "memo"]' -p eosio@active -d -j
8、转移 token。
cleos push action eosio.token transfer '[ "alice", "bob", "25.0000 SYS", "m" ]' -p alice@active
Now check if "bob" got the tokens using cleos get currency balance
cleos get currency balance eosio.token bob SYS
25.00 SYS
Check "alice's" balance, notice that tokens were deducted from the account
cleos get currency balance eosio.token alice SYS
75.00 SYS
参考:
1、https://developers.eos.io/eosio-home/docs/token-contract#section-step-3-compile-the-contract
Deploy, Issue and Transfer Tokens的更多相关文章
- Implement JSON Web Tokens Authentication in ASP.NET Web API and Identity 2.1 Part 3 (by TAISEER)
http://bitoftech.net/2015/02/16/implement-oauth-json-web-tokens-authentication-in-asp-net-web-api-an ...
- 零门槛,包教会。让你在5分钟内使用以太坊ERC20智能合约发行属于自己的空气币
前言 目前区块链是互联网中最最火的风口,没有之一.我周围的很多朋友也加入了“炒币”行列,但很不幸,几乎都被“割韭菜”了.而经过我的几天研究,发现,如果自己要发行一种空气币,简直太简单了.只需要下面几个 ...
- 发行NEO的NEP-5合约代币
NEO常见的资产有三种 TOKEN (全局资产) Share (全局资产,股份 ) NEP-5 (合约代币,相当于ETH的ERC20) NEP-5 合约代码 https://github.com/AN ...
- python3使用kivy生成安卓程序
技术背景 虽然现在苹果占据了很大一部分的市场,但是从销量数据来看,安卓还是占据了人口的高地.这里我们介绍一个用python的kivy+buildozer来进行安卓APP开发的简单教程,从整个过程中来看 ...
- OCP读书笔记(24) - 题库(ExamD)
327.You have a database with the following tablespaces: SYSTEM, SYSAUX, UNDO, USERS, TEMP.You want t ...
- 10分钟 5步 发布以太坊 ERC20 代币
1.安装 METAMASK Brings Ethereum to your browser 一个可以浏览器上进行操作的以太坊钱包,推荐 Chrome. Chrome 插件安装地址: https://c ...
- 【精解】EOS TPS 多维实测
本文主要研究EOS的tps表现,会从插件.cleos.EOSBenchTool以及eosjs四种方式进行分析研究. 关键字:eos, tps, cleos, txn_test_gen_plugin, ...
- ethereum/EIPs-1271 smart contract
https://github.com/PhABC/EIPs/blob/is-valid-signature/EIPS/eip-1271.md Standard Signature Validation ...
- ethereum发erc20token
以太坊发币智能合约代码简单介绍: 发币代码如下(https://ethereum.org/token#the-code网站中获得): pragma solidity ^; interface toke ...
随机推荐
- Gym - 101201E:Enclosure (点到凸包的切线)
题意:给点N棵树,前K棵是已经拥有的,现在可以再拥有一棵树,问形成的最大凸包面积. 思路:先求K棵树的凸包C,然后对于后面的N-K棵树,我们先判断是否在凸包内,如果不在,我们要求两个切线. 这里分类讨 ...
- 《从Lucene到Elasticsearch:全文检索实战》学习笔记一
今天,我主要给大家讲一下信息检索概念. 信息检索: 互联网时代的飞速发展使人们进入了信息爆炸时代,据统计全球的互联网用户已达到30亿,在各个网站及移动app在每个分钟 产生的数据量是巨大的,从而导致数 ...
- BIOS(Basic Input/Output System)是基本输入输出系统的简称
BIOS(Basic Input/Output System)是基本输入输出系统的简称 介绍 操作系统老师说,平时面试学生或者毕业答辩的时候他都会问这个问题,可见这个问题对于计算机专业的学生来说是如此 ...
- django 多对多 增 删 改 查
一.通过url方式实现多对多的:增加,删除,编辑 代码目录: urls.py 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ...
- python基础-闭包
def bibao(): li = [] n = [1] def inner(): li.append(n[0]) n[0] +=1 print(li) return inner b = bibao( ...
- 全志A33 lichee 开发板 Linux中断编程原理说明
开发平台 * 芯灵思SinlinxA33开发板 淘宝店铺: https://sinlinx.taobao.com/ 嵌入式linux 开发板交流 QQ:641395230 本节实验目标实现按键触发中断 ...
- immutable.js使用总结
1. immutable相当于 JSON.parse 和 JSON.stringify: 2.引入redux中,除了 在最外层 reducer中 import { combineReducers } ...
- 内存或磁盘空间不足 Microsoft Excel无法再次打开解决方法
在网络上下载的文件,使用EXCEL打开的时候提示“内存或磁盘空间不足,Microsoft Excel 无法再次打开或保存任何文档.”,针对这个问题,装机之家小编特地在网上搜罗了具体解决方法,但是网上提 ...
- Dockerfile之nginx(六)
一.Dokcerfile的基本指令 1)From 指定构建镜像的基础镜像 2)MAINTAINER 指定镜像的作者 3)RUN 使用前一条指令创建的镜像生产容器,并在容器中执行命令,执行结束后会自 ...
- Linux 释放cache化缓存
Linux 释放cache化缓存 free -g查看空余内存以及已使用内存 原文 https://blog.csdn.net/tomspcc/article/details/78131468 机械硬 ...