urhatudou 发表于 2012-6-12 06:34:59

区块链2.0以太坊钱包编译详解+连接私有链+修改

版权声明:本文为博主尹成联系QQ77025077,微信18510341407原创文章,欢迎转载侵权不究。        https://blog.csdn.net/yincheng01/article/details/80152698
安装mist钱包:

方式1:

https://github.com/ethereum/mist



下载对应平台的mist文件即可:



方式2:源码安装

使用源码安装就需要下载必备的组件:

Dependencies

Torun mist in development you need:

Node.js v7.x (use the prefered installation method for your OS)
Meteor javascript app framework
Yarn package manager
Electron v1.7.11 cross platform desktop app framework
Gulp build and automation system
Installthe latter ones via:

curlhttps://install.meteor.com/ | sh

curl -o- -Lhttps://yarnpkg.com/install.sh | bash

yarn global addelectron@1.8.4

yarn global add gulp

上面的方法很显然都是需要翻墙的



安装完成后,下载mist源码:

git clonehttps://github.com/ethereum/mist.git

cd mist

git checkout -b v0.9.2

yarn



执行yarn的时候会遇到三个错误,错误一:

Excluding itfrom installation.
Linking dependencies...
warning " > gulp-babel@7.0.1" has unmet peer dependency"babel-core@6 || 7 || ^7.0.0-alpha || ^7.0.0-beta || ^7.0.0-rc".
warning " > gulp-spawn-mocha@3.3.1" has unmet peer dependency"istanbul@^0.4.3".
Building fresh packages...
⠂ sha3
⠂ secp256k1
⠂ keccak
⠂ electron
error /home/tsinghua-yincheng/mist/node_modules/sha3: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /home/tsinghua-yincheng/mist/node_modules/sha3
Output:
module.js:549
throw err;
^

Error: Cannotfind module '/home/tsinghua-yincheng/.nvm/versions/node/v8.11.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Function.Module.runMain (module.js:693:10)



这是由于找不到文件lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js'

通过查看文件发现node-gyp 模块在

node_modules/npm/node_modules/lifecircle/node_modules文件中,所以执行了拷贝操作:

sudo cp -rf node-gyp/ ./../../



错误二:

提示默认的权限不够,但是yarn前面又不能加上sudo,解决的办法是首先使用

sudosu

提升权限

错误三:

必须使用代理翻墙。



如果想在未来更新mist:

cd mist

git pull

yarn



启动 Mist,连接到 Geth

  新开一个窗口,用以下命令运行 Mist 的后台程序:



cd interface

meteor--no-release-check



第一次运行会慢一些,会启动proxy、MongoDB等程序,同时下载一些依赖组件

开启私有链

首先需要开启私有链,关于搭建私有链:



新建一个文件:





cd进入:

geth --networkid 123 --dev--datadir data3 --rpc --rpcaddr 192.168.1.6 --rpcport 8989 --port 3000



这时项目下出现了data1。

我们启用以太坊私有链以后,在 private 目录上会创建私有链的一些数据,里面有一个 geth.ipc 文件。

新开一个窗口,在mist目录下运行以下命令,用 Mist 连接我们用 Geth 启动的私有链:注意替换为自己的路径

yarn dev:electron --rpc/Users/桌面/private/data/geth.ipc

如果在另一台机器是使用RPC方式运行,也可以使用下面的方法连接到 Geth:

yarn dev:electron --rpchttp://localhost:8545



              运行完以后,会打开一个比较像App的网页,如下图:





新建一个账户,选择我们创建的账户:





合约代码:



部署:





部署后在geth控制台执行挖矿:

miner.start();

miner.stop();

合约确认:





通过创世区块的方式创建

新建一个文件genesis.json,



输入创世区块信息:



{
"config": {
"chainId": 15,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"difficulty": "4",
"gasLimit": "2100000",
"alloc": {
"7df9a875a174b3bc565e6424a0050ebc1b2d1d82":{
"balance": "300000"
},
"f41c74c9ae680c1aa78f42e5647a62f353b7bdde":{
"balance": "400000"
}
}
}



初始化:

geth init genesis.json--datadir data6



这是目录下产生了data6文件夹:



打开终端:

geth --networkid 123 --datadir data6 console

查询:

eth.getBalance("7df9a875a174b3bc565e6424a0050ebc1b2d1d82")



设置挖矿账户:

miner.setEtherbase("7df9a875a174b3bc565e6424a0050ebc1b2d1d82")



开始挖矿:

miner.start()



在原来的窗口中运行以下命令,用 Mist 连接我们用 Geth 启动的私有链:注意替换为自己的路径

yarn dev:electron --rpc/Users/桌面/private/data/geth.ipc

如果在另一台机器是使用RPC方式运行,也可以使用下面的方法连接到 Geth:

yarn dev:electron --rpchttp://localhost:8545

网址:http://www.qukuailianxueyuan.io/

http://sns.d1v1.com/data/attachment/forum/201811/19/021949pp04ek5vitm4j5iq.jpg




欲领取造币技术与全套虚拟机资料
---------------------
作者:尹成
来源:CSDN
原文:https://blog.csdn.net/itcastcpp/article/details/80152698
版权声明:本文为博主原创文章,转载请附上博文链接!








贵港,广安,南通,宜宾,济宁,柳州,海拉尔,郑州哪里卖春藥,哪里卖催情藥,听话藥我靠```那哥们女太有才了,太牛b了,笑死不偿命```,不平不可```

笑了便赶紧顶一下吧````http://ctc.qzs.qq.com/qzone/em/e3.gif
                                                                                       
                                                                              
                                                                              http://b.qzone.qq.com/ac/b.gif
页: [1]
查看完整版本: 区块链2.0以太坊钱包编译详解+连接私有链+修改