咸鱼

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

0%

5.0、搭建Ganache测试私链环境

Ropsten Test Net 一样,现在我们在私有链发布一个Token,私有链前面使用了Geth来实现,本文通过 ganache来作为本地测试私有链。
ganache 是一个基于内存的以太坊链,用于本地测试,安装简单,不用去连接测试网络,省去同步以太坊区块的麻烦。

最关键是为后面的truffle框架做铺垫。

安装运行

  1. ganache 是GUI程序。(需要nodejs环境)

    下载地址 https://github.com/trufflesuite/ganache/releases

    支持Linux、Mac和Windows ,本文直接安装Windows的,启动就可以,运行后默认创建10个账号,每个账号里有100ETH的余额。

    ganache.png

    默认是127.0.0.1,只有本地能访问,修改为WLAN局域网内可以访问。

    ganache_conf.png

  2. ganache-cli 是字符终端程序(需要nodejs环境)

    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
    36
    $ npm install -g ganache-cli
    $ 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