以太坊网络node
以太坊网络类型git
以太坊查看网络状态github
net.listening true
net.peerCount 4
admin.peers
admin.nodeInfo
以太坊加快下载速度web
参数说明:数据库
这个参数会加快同步的速度,而且显著的下降同步的数据的大小。json
调节内存缓存(单位是M),默认是16M,能够根据本身计算机的状况,适当调大这个值,如256, 512, 1024 (1GB), 或 2048 (2GB)api
开启JIT VM.缓存
geth --testnet --fast --cache=1024 --jitvm console
以太坊静态节点网络
<datadir>/static-nodes.json
["enode://f4642fa65af50cfdea8fa7414a5def7bb7991478b768e296f5e4a54e8b995de102e0ceae2e826f293c481b5325f89be6d207b003382e18a8ecba66fbaf6416c0@33.4.2.1:30303", "enode://pubkey@ip:port" ]
>admin.addPeer("enode://f4642fa65af50cfdea8fa7414a5def7bb7991478b768e296f5e4a54e8b995de102e0ceae2e826f293c481b5325f89be6d207b003382e18a8ecba66fbaf6416c0@33.4.2.1:30303")
以太坊构建本地私有网络cors
CustomGenesis.json :
{ "nonce": "0x0000000000000042", "timestamp": "0x0", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "extraData": "0x0", "gasLimit": "0x8000000", "difficulty": "0x400", "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", "coinbase": "0x3333333333333333333333333333333333333333", "alloc": { } }
私有链中会使用到的命令行参数
运行geth 依照上面所述,配置好命令行,运行:
Windows:
geth --identity "MyNodeName" --rpc --rpcport "8086" --rpccorsdomain "*" --datadir "C:\chains\TestChain1" --port "30303" --nodiscover --rpcapi "db,eth,net,web3" --networkid 1006 init /path/to/CustomGenesis.json
注意:在运行以上命令前,必须在datadir参数指定的目录中先建立一个chaindata目录
运行geth 依照上面所述,配置好命令行,初始化创世区块,运行:
Windows:
geth --identity "MyNodeName" --rpc --rpcport "8086" --rpccorsdomain "*" --datadir "C:\chains\TestChain1" --port "30303" --nodiscover --rpcapi "db,eth,net,web3" --networkid 1006 init /path/to/CustomGenesis.json
注意:在运行以上命令前,必须在datadir参数指定的目录中先建立一个chaindata目录
每次,当你想要使用你自定义的私有链时,你都须要先使用geth来运行以上的命令来启动它。
geth --identity "MyNodeName" --rpc --rpcport "8080" --rpccorsdomain "*" --datadir "C:\chains\TestChain1" --port "30303" --nodiscover --rpcapi "db,eth,net,web3" --networkid 1006 console