搭建windows下私有网络的以太坊钱包环境,发布智能合约以及挖矿

1.安装 geth 客户端、下载Ethereum Wallet

    geth下载网址链接:https://ethfans.org/wikis/Ethereum-Geth-Mirror

    Ethereum Wallet下载链接:https://github.com/ethereum/mist/releases/

2.创建创世区块:genesis.json

{
  "nonce": "0x0000000000000042",
  "difficulty": "0x40000",
  "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "coinbase": "0x0000000000000000000000000000000000000000",
  "timestamp": "0x00",
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
  "gasLimit": "0xffffffff",
  "alloc": {
    "3282791d6fd713f1e94f4bfd565eaa78b3a0599d": {
      "balance": "1337000000000000000000"
    },
    "17961d633bcf20a7b029a7d94b7df4da2ec5427f": {
      "balance": "229427000000000000000"
    }
  },
  "config": {
        "chainId": 15,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    }
}

3.在安装好的 geth 目录下初始化创世区块

geth -datadir "%cd%\chain" init genesis.json

4.打开 geth 控制台 

geth -datadir "%cd%\chain" console

5.创建新用户,并随后输入密码

personal.newAccount('this is password')

6.退出控制台

exit

7.启动私有链节点,ip更换为自己电脑ip地址

geth -targetgaslimit 4294967295 -rpc -rpcaddr "ip" -rpcport "8101" -port "30301" -rpcapi "eth,web3,personal" -networkid 2018 -identity 2018 -nodiscover -maxpeers 5 -datadir "%cd%\chain" -unlock 0 -rpccorsdomain "*" -mine console

8.启动 Ethereum Wallet.exe 钱包

注意:每次执行交易之前要开启挖矿:miner.start(10)    【10代表开启线程个数】 关闭挖矿:miner.stop()    


你可能感兴趣的:(智能合约,智能合约,区块链,以太坊,Ethereum)