Hi Guest

More contents, please log on!

Bitmere.com 区块链技术 Content

Windows下搭建一条以太坊私有链

楠木2017
61 0 0
  安装

  安装以太坊钱包和Geth

  准备创世块文件

  如下:
 
  1.  { "config": { "chainId": 15, "homesteadBlock": 0, "eip155Block": 0, "eip158Block": 0 }, "coinbase" : "0x0000000000000000000000000000000000000000", "difficulty" : "0x40000", "extraData" : "", "gasLimit" : "0xffffffff", "nonce" : "0x0000000000000042", "mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "timestamp" : "0x00", "alloc": { } }
Copy the Code


  保存为piccgenesis.json

  启动

  命令行输入

  1. geth --datadir "d:\ly\qkl\testnetwork" init d:\ly\qkl\piccgenesis.json
Copy the Code



其中datadir指定一个位置用于存放运行的数据, init后边填写配置文件的路径。 如果成功的话会输出Successfully wrote genesis state字样

  启动网络

  1.   geth --identity “lingyun_eth_dev” --rpc --rpccorsdomain “*” --datadir “d:\ly\qkl\testnetwork” --port “30303” --rpcapi “db,eth,net,web3” --networkid 95518 console
Copy the Code

  当看到Listening on [::]:30303和Welcome to the Geth JavaScript console!的提示,说明已经启动成功

  使用节点创建账号

  启动节点成功后,会进入Geth的命令行模式,输入如下命令 personal.newAccount() 系统会提示你输入账号密码,并确认,最后会显示一个新生成的账号。

  启动Windows下私有链图形节点

  首先按上面的步骤启动Geth并创建了账号,然后解压缩Ethereum-Wallet,运行Ethereum-Wallet.exe,即启动成功,如果区块链正常的话,会在右上角显示“PRIVATE-NET”,点击“LAUNCH APPLICATION”进入图形界面即可。

  挖矿获取一些以太坊

  账号创建后,还没有以太坊,需要在私有链上挖矿,切换到Geth界面,输入 miner.start(1)

  创建新Token

  有了ETH接下来就可以新建智能合约了,也就是自己的代币Token。
BitMere.com is Information release platform,just provides information storage space services.
The opinions expressed are solely those of the author,Does not constitute advice, please treat with caution.
You have to log in before you can reply Login | 立即注册

Points Rules

Write the first review

楠木2017 小学生
  • Follow

    0

  • Following

    0

  • Articles

    9

币圈江左盟
Promoted