├── Mac下搭建EOS环境.md
├── README.md
├── Windows环境下Docker安装EOS教程.md
├── picture
├── Gettex.png
├── Hyper-V.png
├── LLVM_ERROR.png
├── LLVM_REINSTALL.jpg
├── NewChain.png
├── bash_profile.jpg
├── bios.png
├── boost.png
├── build_eos.png
├── change_image_resource.png
├── code_currency.png
├── code_currency2.png
├── contract_currency.png
├── create_success.png
├── currency.png
├── currency_account.png
├── currency_account2.png
├── eos.png
├── first_transfer.png
├── git_tag.png
├── install_docker.png
├── key.png
├── key2.png
├── kitematic.png
├── privatekey.png
├── publickey.png
├── send_success.png
├── sodfans.png
├── sodfans_account.png
├── start_docker.png
├── start_nodeos.png
├── test_image.png
├── wallet.png
└── 升级成功.png
├── 升级EOS系统.md
└── 发个[大宝SOD币].md
/Mac下搭建EOS环境.md:
--------------------------------------------------------------------------------
1 | # Mac下搭建EOS环境
2 |
3 |
4 | > 测试环境:
5 |
6 | > * 系统版本:macOS High Sierra 10.13.3
7 | > * EOS版本:Dawn 3.0.0
8 |
9 | ---
10 | ## 1.编译设置开发环境
11 | ### 1.1 获取EOS源码及其所有子模块
12 | 以下这行代码的意思是从Github代码仓库上把EOS弄到本地
13 | > $ git clone https://github.com/EOSIO/eos --recursive
14 |
15 | 如果在git clone中出现问题,多试几次
16 |
17 | ### 1.2 Boost
18 | 安装EOS会需要一些依赖的软件,大部分会自动安装。如果出现错误,提示你有些包版本不对,用`brew upgrade [软件名]`更新就是了。
19 | 其中要注意的是Boost的安装。Boost是EOS需要的C++资源库。如果原本没有安装,那么直接`brew install boost`即可。如果原来已安装旧的版本,那么不要升级,直接卸载重新安装。
20 | >brew uninstall --force boost
21 | brew install boost
22 |
23 | 安装完之后,用brew info boost查看,如图就说明你安装成功了!
24 | 
25 |
26 | ## 2.编译源码生成可执行文件
27 | ### 2.1 进入git clone下来的eos文件夹
28 | > cd eos
29 | ls
30 | ### 2.2 执行EOS的安装脚本
31 | > ./eosio_build.sh
32 |
33 | 安装成功出现下图,说明EOS环境搭建成功
34 | 
35 |
36 | ## 3.踩坑
37 | 如果在上面的过程中遇到任何的问题,可以先看看以下的方法能否解决
38 | ### 3.1 LLVM报错
39 | 
40 | > * 重新安装llvm
41 | `brew reinstall llvm`
42 | 
43 |
44 | > * 修改.bash_profile 文件
45 | `open .bash_profile`
46 | 在后面追加`export PATH="/usr/local/opt/llvm@4/bin:$PATH"`
47 | 如图
48 | `source .bash_profile` (使用刚才更新之后的内容)
49 | ### 3.2 Gettext报错
50 | > * 如图
51 | 
52 | > * 处理
53 | `brew link gettext --force`
54 |
55 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 《EOS开发从入门到放弃》
2 | ---
3 | > * [第一篇:Windows环境下Docker搭建EOS环境](https://github.com/PeterHuZQ/EOS-Development/blob/master/Windows%E7%8E%AF%E5%A2%83%E4%B8%8BDocker%E5%AE%89%E8%A3%85EOS%E6%95%99%E7%A8%8B.md)
4 |
5 | > * [第二篇:Mac搭建EOS环境](https://github.com/PeterHuZQ/EOS-Development/blob/master/Mac%E4%B8%8B%E6%90%AD%E5%BB%BAEOS%E7%8E%AF%E5%A2%83.md)
6 |
7 | > * [第三篇:发币教程](https://github.com/PeterHuZQ/EOS-Development/blob/master/%E5%8F%91%E4%B8%AA%5B%E5%A4%A7%E5%AE%9DSOD%E5%B8%81%5D.md)
8 |
9 | > * [第四篇:编写发布第一份智能合约](https://github.com/PeterHuZQ/EOS-Dapp/blob/master/contract/docs/motherday%E5%90%88%E7%BA%A6%E6%89%8B%E5%86%8C.md)
10 |
11 | > * [第五篇:在EOS上实现CRUD操作](https://github.com/PeterHuZQ/EOS-Dapp/blob/master/contract/docs/todo%E5%90%88%E7%BA%A6%E6%89%8B%E5%86%8C.md)
12 |
13 | > * [第六篇:将EOS系统升级到最新版本](https://github.com/PeterHuZQ/EOS-Development/blob/master/%E5%8D%87%E7%BA%A7EOS%E7%B3%BB%E7%BB%9F.md)
14 |
15 | >未完待续,如果你们觉得这些文章对您有点用的话不妨打赏点什么BTC、ETH、EOS,
16 | 各种我知道不知道的代币都砸过来吧!
17 | 比特币地址:33doDWEvundG2xzxvVvkWnAMmELauyXCRj
18 | 以太坊地址:0xaB759F765F2720D3d711B92b0bf277eeb90f527a
19 | 欢迎学习EOS智能合约的朋友加微信:hu350410796
--------------------------------------------------------------------------------
/Windows环境下Docker安装EOS教程.md:
--------------------------------------------------------------------------------
1 | # Windows环境下Docker安装EOS教程
2 | ---
3 |
4 | ## 1. Windows10下安装Docker的步骤
5 | ### 1.1、启用Hyper-V
6 | 打开控制面板 - 程序和功能 - 启用或关闭Windows功能,勾选Hyper-V,然后点击确定即可,如图:
7 | 
8 | 点击确定后,启用完毕会提示重启系统,我们可以稍后再重启。
9 |
10 | ### 1.2、安装Docker
11 | Docker下载地址为:https://store.docker.com/editions/community/docker-ce-desktop-windows
12 | 下载完成后运行安装包,安装完成后界面,如图:
13 | 
14 | 单击Close and log out,这个时候我们重启一次电脑
15 |
16 | ### 1.3、启动Docker
17 | * 在桌面找到Docker for Windows快捷方式,双击启动即可!
18 | 启动成功后托盘处会有一个小鲸鱼的图标。
19 | 打开命令行输入命令:`docker version`可以查看当前docker版本号,如图:
20 | 
21 |
22 |
23 | * 更换镜像源地址
24 | Docker 路径更改
25 | 网易镜像源地址为:http://hub-mirror.c.163.com
26 | 点击托盘处docker图标右键选择-Settings,然后修改,如图:
27 | 
28 | 点击Apply后会重启Docker。
29 |
30 | * 载入测试镜像测试
31 | 输入命名“docker run hello-world”可以加载测试镜像来测试,如图:
32 | 
33 | 这样即表示安装成功了!
34 |
35 | ## 2. Docker安装EOS的步骤
36 | ### 2.1、构建 EOSIO 镜像
37 | `git clone https://github.com/EOSIO/eos.git --recursive`
38 | `cd eos/Docker`
39 | `docker build . -t eosio/eos`
40 | 
41 |
42 | ### 2.2、启动nodeos容器
43 | `docker run --name nodeos -p 8888:8888 -p 9876:9876 -t eosio/eos nodeosd.sh arg1 arg2`
44 | 
45 |
46 | ### 2.3、关闭区块
47 |
48 | Docker有个图形化的容器管理工具,右下角Docker图标上点右键Kitematic,如果没有安装它会提示你去下载,是一个zip,告诉你下载完解压的位置“C:\Program Files\Docker\Kitematic”,放好之后就可以用图形化方式管理下载共享的Docker容器了, 容器安装完成可以启动、停止、重启、控制台操作,端口配置,存储位置配置等等。
49 | 左侧列表鼠标悬停出现X,点击X,关闭区块,如图:
50 | 
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/picture/Gettex.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/Gettex.png
--------------------------------------------------------------------------------
/picture/Hyper-V.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/Hyper-V.png
--------------------------------------------------------------------------------
/picture/LLVM_ERROR.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/LLVM_ERROR.png
--------------------------------------------------------------------------------
/picture/LLVM_REINSTALL.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/LLVM_REINSTALL.jpg
--------------------------------------------------------------------------------
/picture/NewChain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/NewChain.png
--------------------------------------------------------------------------------
/picture/bash_profile.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/bash_profile.jpg
--------------------------------------------------------------------------------
/picture/bios.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/bios.png
--------------------------------------------------------------------------------
/picture/boost.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/boost.png
--------------------------------------------------------------------------------
/picture/build_eos.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/build_eos.png
--------------------------------------------------------------------------------
/picture/change_image_resource.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/change_image_resource.png
--------------------------------------------------------------------------------
/picture/code_currency.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/code_currency.png
--------------------------------------------------------------------------------
/picture/code_currency2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/code_currency2.png
--------------------------------------------------------------------------------
/picture/contract_currency.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/contract_currency.png
--------------------------------------------------------------------------------
/picture/create_success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/create_success.png
--------------------------------------------------------------------------------
/picture/currency.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/currency.png
--------------------------------------------------------------------------------
/picture/currency_account.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/currency_account.png
--------------------------------------------------------------------------------
/picture/currency_account2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/currency_account2.png
--------------------------------------------------------------------------------
/picture/eos.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/eos.png
--------------------------------------------------------------------------------
/picture/first_transfer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/first_transfer.png
--------------------------------------------------------------------------------
/picture/git_tag.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/git_tag.png
--------------------------------------------------------------------------------
/picture/install_docker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/install_docker.png
--------------------------------------------------------------------------------
/picture/key.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/key.png
--------------------------------------------------------------------------------
/picture/key2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/key2.png
--------------------------------------------------------------------------------
/picture/kitematic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/kitematic.png
--------------------------------------------------------------------------------
/picture/privatekey.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/privatekey.png
--------------------------------------------------------------------------------
/picture/publickey.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/publickey.png
--------------------------------------------------------------------------------
/picture/send_success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/send_success.png
--------------------------------------------------------------------------------
/picture/sodfans.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/sodfans.png
--------------------------------------------------------------------------------
/picture/sodfans_account.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/sodfans_account.png
--------------------------------------------------------------------------------
/picture/start_docker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/start_docker.png
--------------------------------------------------------------------------------
/picture/start_nodeos.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/start_nodeos.png
--------------------------------------------------------------------------------
/picture/test_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/test_image.png
--------------------------------------------------------------------------------
/picture/wallet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/wallet.png
--------------------------------------------------------------------------------
/picture/升级成功.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterHuZQ/EOS-Development/becba8ebbf7a8e7b32eb868113dc4e8e2fd7a26d/picture/升级成功.png
--------------------------------------------------------------------------------
/升级EOS系统.md:
--------------------------------------------------------------------------------
1 | # 升级EOS系统 | 切换版本分支
2 | Go or not go , eos 就在那里,我不太关心是否主网上线,而是专注于EOS的开发, 6月9日EOS主网终于要上线了,主网上线前,EOS几天一个新版本。新版本出来BUG也一大推,所以教程之前一直用EOSdawn-v3.0版本,没有更新。现在主网要上线了,代码也稳定下来了,因此是时候写一篇教程,教大家如何将本机的EOS系统升级为最新版本EOS1.0.2
3 | ---
4 |
5 | ## 1.实用小技巧介绍-git
6 | ### 1.1 拉最新的版本到本地
7 | 通过`git pull`命令
8 | > * cd eos #进入eos的根目录
9 | > * git add .
10 | > * git commit -m "升级版本" #先commit了才能Pull
11 | > * git pull
12 |
13 | ### 1.2 查看软件版本
14 | 通过`git tag`命令,拉到最后,我们可以看到最新的版本是v1.0.2
15 | 
16 |
17 | ### 1.3 建立新的分支
18 | 输入`git checkout -b [自己起的分支名] [用 tag 查到的版本名]`
19 | 创建并切换到新的分支。
20 | 例如`git checkout -b v1.0.2 v1.0.2`
21 | 现在已经自动切换到v1.0.2分支了——也就是切换到了eosio 1.0.2 版本。
22 |
23 | ### 1.4 切换分支
24 | 之后想切换版本,先用`git branch`命令查看有哪些分支,然后`git checkout [分支名]`切换即可。注意,当没有找到你所需要的分支时,要先建立该分支
25 |
26 | ### 1.5 删除分支
27 | 有时候分支不小心建错了,用`git branch -d [分支名]`即可删除分支。
28 | 注意,当前的分支是不能删除的,如果要删除当前分支,先`git branch`切换分支再进行删除操作。
29 |
30 | ### 1.6 重新安装
31 | > * cd eos #进入eos的根目录
32 | > * ./eosio_build.sh
33 |
34 | 升级成功出现下图
35 | 
36 |
37 | 其中可能报错说boost版本不对,卸载重装即可解决问题。
38 | > * brew uninstall --force boost #卸载boost
39 | > * cd /usr/local/Cellar/boost #进入boost所在的文件夹
40 | > * sudo rm -rf * #有时候里面的东西会对重装有影响,删了最好
41 | > * brew install boost #安装最新版本
42 | > * brew link boost -force #强制链接
43 |
44 |
45 | 然后进入`eos/build`文件夹,构建可执行环境:
46 | > * cd build
47 | > * sudo make install
48 |
49 | ## 2.运行区块链
50 | ### 2.1 删除旧区块
51 | 打开以下路径文件夹,把data文件夹里面的内容删掉。
52 | > cd /Users/[你的用户名]/Library/Application Support/eosio/nodeos
53 | > rm -rf *
54 |
55 | ### 2.2 修改配置文件
56 | 返回刚才那个文件夹,进入config文件夹,打开config.ini,
57 | > cd /Users/[你的用户名]/Library/Application Support/eosio/nodeos
58 |
59 | 将其中的`plugin=eosio::account_history_api_plugin`替换为`plugin = eosio::history_api_plugin`
60 |
61 | 然后我们进入`eos/build/programs/nodeos`,输入`./nodeos`,EOSIO 1.0.2就能顺利的跑起来啦!
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/发个[大宝SOD币].md:
--------------------------------------------------------------------------------
1 | # 发个[大宝SOD币]
2 |
3 | ---
4 | ## 1.构建可执行环境
5 | >确认当前文件夹是eos后,进入build文件夹
6 | `cd build`
7 | 构建可执行环境
8 | `sudo make install`
9 |
10 |
11 | ## 2.运行区块链
12 | 通过以下两个命令,我们就能在本机上运行EOS区块链了
13 | >`cd build/programs/nodeos`
14 | `./nodeos -e -p eosio --plugin eosio::wallet_api_plugin --plugin eosio::chain_api_plugin --plugin eosio::account_history_api_plugin`
15 |
16 | 执行命令后,EOS 系统会不断打包新的区块。其中,# 号后面的数字就是区块的编号。
17 | 
18 |
19 |
20 | ## 3.钱包与账户的创建
21 | ### 3.1 创建钱包
22 | (1)进入 cleos 文件夹:
23 | >cd eos/build/programs/cleos
24 |
25 | (2)创建钱包:
26 | >./cleos wallet create
27 |
28 | 如果成功,系统会返回给你一个钱包的私钥。如图
29 | 
30 | 密码:PW5KUPRXv3FNhMTMgsZLFsDkxAAsdDfmoj2Sr1xQztfKtzd5gGKbp
31 |
32 | ### 3.2 加载 bios 合约
33 | 如果我们把 EOS 看做一个操作系统,那么 bios 合约就是让我们能进行最底层的操作的合约,其它合约的运行建立在 bios 合约的基础之上,所以我们先来加载 bios 合约。
34 |
35 | >加载 bios 合约的命令如下:
36 | `./cleos set contract eosio ../../contracts/eosio.bios -p eosio`
37 | 如图
38 | 
39 |
40 | ### 3.3 在钱包内创建账户
41 | 在 EOS 中,一个钱包可以对应多个账户。在本例中,我们创建两个账户,一个是 currency 账户,用来执行「发币合约」的账户。另一个是 sodfans 账户,用来测试转账操作的普通账户。
42 | > * 生成密钥对
43 | ./cleos create key
44 | 
45 |
46 | > * 钱包导入私钥
47 | ./cleos wallet import [ 生成的私钥 ]
48 | 例如:
49 | `./cleos wallet import 5Jb2aU4n8EGA2JBUeXM8cTXywCkBXjwqvR4Sv7rF4JAk1q53tcT`
50 | 
51 |
52 | > * 用公钥创建账户 currency 。
53 | 注意了,创建账户本来需要两个公钥:OwnerKey 与 ActiveKey 。但是在本期中从简,第一步生成的密钥对用两次。
54 | `./cleos create account eosio currency [ 生成的公钥 ] [ 生成的公钥 ]`
55 | 例如
56 | `./cleos create account eosio currency EOS5MQyfpkKEecrGGy49TDJ9qF8bBSdJ8w6FiHHUBsZ32qWZvbqtU EOS5MQyfpkKEecrGGy49TDJ9qF8bBSdJ8w6FiHHUBsZ32qWZvbqtU`
57 | 
58 |
59 | 重复以上步骤,创建账户 sodfans
60 | >./cleos create key
61 | 
62 | ./cleos wallet import [ 生成的私钥 ]
63 | 例如`./cleos wallet import 5KN58YFrx1cuJLRca9hs5nd6LxT7w2SMLnACKSLPVnRWnie2qkx`
64 | ./cleos create account eosio sodfans [ 生成的公钥 ] [ 生成的公钥 ]
65 | 例如`./cleos create account eosio sodfans EOS7ivkdhbFkPrZAZNRZW1Lz6oE39RTPRgxwA4tjL4RAdKPVmNLBk EOS7ivkdhbFkPrZAZNRZW1Lz6oE39RTPRgxwA4tjL4RAdKPVmNLBk`
66 |
67 | 检查一下两个账户是否已经存在了
68 | >./cleos get account [ 账户名 ]
69 | 
70 | 
71 |
72 | ## 4.发行[大宝SOD币]
73 | 现在有三个账户—— eosio 账户(默认)、currency 账户和 sodfans 账户。现在我们用 currency 账户加载并执行「发币合约」,发行大宝币。
74 | ### 4.1 加载合约
75 | > * 先看一下currency账户的合约情况
76 | `./cleos get code currency`
77 | 返回的结果是一串为0的hash,说明合约还未创建。
78 | 
79 |
80 | > * 加载系统自带的发币合约
81 | `./cleos set contract currency ../../contracts/currency`
82 | 
83 |
84 | > * 再次看一下currency账户的合约情况,如果发现 code hash 不是 0 了,就说明发币合约加载成功!
85 | 
86 |
87 | ### 4.2 用 currency 账户执行「发币合约」,创建大宝SOD币
88 | > * 执行下面命令:
89 | `./cleos push action currency create '{"issuer":"currency", "maximum_supply": "1000000000.0000 SOD", "can_freeze": 1, "can_recall": 1, "can_whitelist": 1}' -p currency@active`
90 | 如果返回以下结果,就说明我们创建币成功了!
91 | 
92 |
93 | ### 4.3 发送大宝SOD币给 currency 账户
94 | 虽然目前大宝币创建成功了,但还没有账户持有大宝币。所以,我们要给账户「发币」
95 | > * 执行下面命令:
96 | `./cleos push action currency issue '{"to":"currency","quantity":"1000.0000 SOD","memo":""}' --permission currency@active`
97 | 我们就给 currency 账户发了 1000 个 SOD 币
98 | 
99 |
100 | > * 验证一下,通过以下命令查看 currency 账户余额
101 | `./cleos get table currency currency accounts`
102 | 
103 | 返回的结果告诉我们,currency 的账户里的确有 1000个SOD了!
104 |
105 | ### 4.4 测试转账操作
106 | > * 通过如下命令,currency 账户会将20个SOD币转给sodfans账户:
107 | `./cleos push action currency transfer '{"from":"currency","to":"sodfans","quantity":"20.0000 SOD","memo":"my first transfer"}' --permission currency@active`
108 | 
109 |
110 | > * 查看 currency 和 sodfans 两个账户的余额
111 | `./cleos get table currency sodfans accounts`
112 | 
113 | `./cleos get table currency currency accounts`
114 | 
115 |
116 |
117 |
118 |
119 |
120 |
121 |
--------------------------------------------------------------------------------