https://zhuanlan.zhihu.com/p/197700303
miner.stop()
miner.start(3)
personal.newAccount("admin")
personal.unlockAccount(eth.accounts[1], "admin")
eth.accounts
eth.coinbase
miner.setEtherbase(eth.accounts[x])
admin.nodeInfo.enode
admin.peers
web3.net.peerCount
eth.getBalance(eth.accounts[1])
eth.getBalance(eth.coinbase)
admin.addPeer("")
puppeth
eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[1],
value: web3.toWei(100)})
clique.propose("0x2fb0c213e9f76835fd64d7da0f03b141734988bd",true)
clique.propose("0xed88640cd57335eb97f59e62b9a5b6a1bca4ade1",true)
clique.propose("0x37ddb53c0c271afa872d460f6ca0f8c2256e89a8",true)
- 创建账户
在三个节点下分别创建一个账户:
geth --datadir node1 account new geth --datadir node2 account new geth --datadir node3 account new
- 创建创世块 ```csharp root@eth01:/home# puppeth +-----------------------------------------------------------+ | Welcome to puppeth, your Ethereum private network manager | | | | This tool lets you create a new Ethereum network down to | | the genesis block, bootnodes, miners and ethstats servers | | without the hassle that it would normally entail. | | | | Puppeth uses SSH to dial in to remote servers, and builds | | its network components out of Docker containers using the | | docker-compose toolset. | +-----------------------------------------------------------+
Please specify a network name to administer (no spaces, please) > deling Sweet, you can set this via --network=deling next time!
INFO [12-29|14:23:03] Administering Ethereum network name=deling WARN [12-29|14:23:03] No previous configurations found path=/root/.puppeth/deling
What would you like to do? (default = stats) 1. Show network stats 2. Configure new genesis 3. Track new remote server 4. Deploy network components > 2
Which consensus engine to use? (default = clique) 1. Ethash - proof-of-work 2. Clique - proof-of-authority > 2
How many seconds should blocks take? (default = 15) >
Which accounts are allowed to seal? (mandatory at least one) > 0x06de0c4d8c40fb1cbb86e0b00401d395828ae4f1 > 0xf55b442c40632602ce5b8270102294c57f2b2531 > 0x761bbd27d783894696b0aaae9b4616dbebb6ed3f > 0x0afe6957dd356288a52c7539d28df964d0de5197 > 0xa17492dcdb51c90c75334cdf0e47be93d82a0ee9 > 0x
Which accounts should be pre-funded? (advisable at least one) > 0x06de0c4d8c40fb1cbb86e0b00401d395828ae4f1 > 0xf55b442c40632602ce5b8270102294c57f2b2531 > 0x761bbd27d783894696b0aaae9b4616dbebb6ed3f > 0x0afe6957dd356288a52c7539d28df964d0de5197 > 0xa17492dcdb51c90c75334cdf0e47be93d82a0ee9 > 0x
Specify your chain/network ID if you want an explicit one (default = random) > 2010
Anything fun to embed into the genesis block? (max 32 bytes) >
What would you like to do? (default = stats) 1. Show network stats 2. Manage existing genesis 3. Track new remote server 4. Deploy network components > 2
- Modify existing fork rules
- Export genesis configuration > 2
Which file to save the genesis into? (default = deling.json) > INFO [12-29|14:27:12] Exported existing genesis block
What would you like to do? (default = stats) 1. Show network stats 2. Manage existing genesis 3. Track new remote server 4. Deploy network components > ^C root@eth01:/home# ls deling.json gobase node pi src
2. 节点初始化
```ruby
root@eth01:/home# geth --datadir node init deling.json
INFO [12-29|14:30:52] Allocated cache and file handles database=/home/node/geth/chaindata cache=16 handles=16
INFO [12-29|14:30:52] Writing custom genesis block
INFO [12-29|14:30:52] Successfully wrote genesis state database=chaindata hash=230c1a…f59c8a
INFO [12-29|14:30:52] Allocated cache and file handles database=/home/node/geth/lightchaindata cache=16 handles=16
INFO [12-29|14:30:52] Writing custom genesis block
INFO [12-29|14:30:52] Successfully wrote genesis state database=lightchaindata hash=230c1a…f59c8a
配置文件
[Eth] NetworkId = 2022 [Node] DataDir = "./node2" HTTPPort = 8546 InsecureUnlockAllowed = true [Eth.Miner] Etherbase = "0xf35d474c56a7b1d89fdb1c4566d006ef8459daa3" GasFloor = 0 GasCeil = 8000000 GasPrice = 1000000000 Recommit = 3000000000 Noverify = false [Node.P2P] MaxPeers = 3 NoDiscovery = true StaticNodes = [ "enode://12292e4678ec3795864b32915d496ff6cc0d7ec1dccb7e17ea269d08f407648b229c4f79e7e76f65afe4350d17214bf3924c65edaee2540c1ed7c813f741e35f@127.0.0.1:30300?discport=0", ] ListenAddr = ":30301"
BootstrapNodes
引导节点:StaticNodes
静态节点:加入后会连接该节点TrustedNodes
信任节点: 引导节点和静态节点是寻找对等点的并行方法。根据您的用例,您可以仅使用引导节点、仅使用静态节点或同时使用两者。 关于节点的更多内容可以参考理入节点控制台
geth attach http://127.0.0.1:8545 geth attach node1/geth.ipc
创建账户
geth --datadir node1 account new
- FAQ
- signed recently, must wait for others >