ETH创建一个私链测试节点

/ ETH区块链 / 0 条评论 / 1390浏览

创建一个地址

geth --datadir "D:\geth" account new

初始化创世区块 genesis.json

{
"config": {
        "chainId": 1,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    },
  "alloc"      : {
    "f985f8578206c6d317785cf131682259bf84588f": {"balance": "100000001"}
    },
  "coinbase"   : "0x0000000000000000000000000000000000000000",
  "difficulty" : "0x20000",
  "extraData"  : "",
  "gasLimit"   : "0x4c4b40",
  "nonce"      : "0x0001000000000042",
  "mixhash"    : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp"  : "0x00"
}
geth --datadir "D:/geth" init "./genesis.json"

启动节点1

geth --datadir "D:/geth" --rpcaddr localhost --rpcport 8545 --port 30303 --rpc --rpccorsdomain "*" --networkid 10 --rpcapi "admin,debug,eth,ethash,miner,net,personal,rpc,txpool,web3"

启动节点2

geth --datadir "D:/geth2" --rpcaddr localhost --rpcport 8546 --port 30304 --rpc --rpccorsdomain "*" --networkid 10 --ipcdisable --bootnodes "enode://369741a7c241af081c4f68d9d0b061fab703b13066a741e142b15119c047d2535752a15098f6c5ebc21e63205ea368c434f953d216472f10566e3d351f2bddc7@127.0.0.1:30303"

进入控制台

geth attach //./pipe/geth.ipc

命令

miner.start(1)
miner.stop()

https://metamask.io/

https://remix.ethereum.org