区块链学堂(15):Mist

回顾一下之前用Geth搭建的私有网络

创建链条的geth命令

geth --datadir "./" init genesis.json
geth --datadir "./" --nodiscover console 2>>geth.log

在命令行模式下, 新建账号,并且启动挖矿

> personal.newAccount("123")
"0x48ad44beba68a981e103d28b2bd5777ef21ba0e3"
> miner.start()
true
>

如果链条已经被关闭的话,或者启动不了,或者挖矿无法产生比特币的话,可以重置以太坊私链。

重置以太坊私有链的方法
  • 1.删除根目录下的隐藏文件夹.ethash, 在mac系统中该文件夹在 ~/
  • 2.删除以太坊私有链所在文件夹下的geth/keystore两个文件夹 
私有链正常工作的日志如下图所示:

打开私有链所在文件夹,注意应该有一个文件,叫geth.ipc, 记录下文件夹地址

Mist 工具

Mist github地址:https://github.com/ethereum/mist

The Mist browser is the tool of choice to browse and use Ðapps.

Mist 是以太坊官方提供的浏览器,通过Mist我们可以很方便的连接上我们的私有网络,从而更好的开发、调试、测试我们的智能合约。

Step 1 安装依赖项

安装步骤,请参见github地址:https://github.com/ethereum/mist

$ curl https://install.meteor.com/ | sh
$ npm install -g [email protected]
$ npm install -g gulp

Step 2 安装Mist本体

$ git clone https://github.com/ethereum/mist.git
$ cd mist
$ git submodule update --init
$ yarn

Step 3 运行Mist/interface 也就是mist的后台程序

$ cd mist/interface && meteor --no-release-check

这个阶段费时可能稍长,会启动mongodb, proxy等。完成后的控制台截图如下:

Step 4 新开一个窗口,用geth.ipc启动Mist

新开一个窗口,回到mist文件夹下面,输入下方的命令

electron . --rpc /Users/linchen/steveproject2/tmpPrivate/geth.ipc

注意这里的地址/Users/linchen/steveproject2/tmpPrivate/geth.ipc 就是前面我们新建的以太坊私有连下的geth.ipc文件。

启动后的Mist界面如下

下一章中我们会继续详细介绍Mist

猜你喜欢

转载自blog.csdn.net/lala_wang/article/details/79752099
今日推荐