咸鱼

咸鱼是以盐腌渍后,晒干的鱼

0%

5.1、基于Ganache-Cli用Remix发布Token(代币)

本文启动 ganache-cli

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
$ ganache-cli
Ganache CLI v6.1.0 (ganache-core: 2.1.0)

Available Accounts
==================
(0) 0xef1e0310ecf99c3808940d351b8a4bd7566d0a71
(1) 0xa91b4c17ff43421754a8b721a8e55ac2881d946b
(2) 0x0a6d612ce9d06ee9bced7395f29b0167e059207e
(3) 0xd64f06e3a98a41bea2a6fa290e742083206ee061
(4) 0xd315be81ca72314a2434df898fe962e6b53db337
(5) 0xd4b54a13c047214bfae17ee2e25bbe4891edf582
(6) 0x630b76b384c423c231bbc3384b1333369296eff9
(7) 0x5f10c0cc0a914d9e5711a4ae022c27f4be7013d4
(8) 0xd7c06d6f55c44125a11d7d203bb24c86f786b37d
(9) 0x2fc8126d7ea755089dc7337fe956f2f0369a205b

Private Keys
==================
(0) 82d925b9235dcf17d2e7cb0907084bf44fa9ce7ab31a9d2375b5db75e2da0509
(1) 3f02535f00fa0ab48c306e561491cb4e10c684cea0297ec23aa4e87322108723
(2) a0c830651cac356ce0a1a1d471ae0a77d2f0cfbb869dbd2d7650d4827becf879
(3) 60a0a77161316406a5c03453d9e85427357f4046939bd4f884561cc806a4dccf
(4) 7914c24a44119f21071b2a7da59a4b07a8c665475b995e0491bf62e7b1cc0403
(5) bc512c5af4b68021be1ea084e93acf87fd3c1dea4a3ad1eec60cc0ba408f5ac0
(6) 2f1831f2ab30d0b091a4dced5dcac68c79fad0352727a5ab4edd694c3a9d4bd7
(7) 963d08d6060e01eb9223e742f12955daf00f5cc54220001ce75353a50a017968
(8) e3d724fa1a859afda107e9be2e3b0d5703705436bae1057280b8363bc6929fd8
(9) 6a661a59913f97e6fbd9cc4d56e8fc4d6c098d7be14254d788a5917cfe498bfd

HD Wallet
==================
Mnemonic: penalty until vessel limit motor waste rule ability soft moral stem harsh
Base HD Path: m/44'/60'/0'/0/{account_index}

Listening on localhost:8545

编译合约

打开remix,一样编译三个sol代码文件(参考上文)。

部署合约

Environment 选择 JavaScript VM 代表所有资料都是存在本地。它会提供 5 个虚拟账户每个有 100 ETH,随便选择一个账户accout[0]部署合约,一个账户accout[1]作为收账。

账号地址

1
2
3
0xca35b7d915458ef540ade6068dfe2f44e8fa733c

0x14723a09acff6d2a60dcdf7aa4aff308fddc160c

部署参数

1
"10000000000000000000000","GGCoin",18,"GG"

部署示例

部署合约GG.png

部署成功,自动显示我们的合约

部署合约GG成功界面.png

同时在log上点开扩展可以看到显示的debug信息

部署合约log.png

转账

accout[0] -> accout[1] 转10个GG币

1
"0x14723a09acff6d2a60dcdf7aa4aff308fddc160c","10000000000000000000"

GG转账.png

log信息

GG转账log.png

查询accout[1]余额:10个GG币
GG查询余额.png

已上文章都是通过 Remix 在线部署合约的,接下来就要通过Truffle框架来实现了。