@@ -40,7 +40,7 @@ ADD genesis.json /genesis.json
4040RUN \
4141 echo '/geth init /genesis.json' > geth.sh && \{{if .Unlock}}
4242 echo 'mkdir -p /root/.ethereum/keystore/ && cp /signer.json /root/.ethereum/keystore/' >> geth.sh && \{{end}}
43- echo $'/geth --networkid {{.NetworkID}} --cache 512 --port {{.Port}} --maxpeers {{.Peers}} {{.LightFlag}} --ethstats \'{{.Ethstats}}\' {{if .BootV4}}--bootnodesv4 {{.BootV4}}{{end}} {{if .BootV5}}--bootnodesv5 {{.BootV5}}{{end}} {{if .Etherbase}}--etherbase {{.Etherbase}} --mine{{end}}{{if .Unlock}}--unlock 0 --password /signer.pass --mine{{end}} --targetgaslimit {{.GasTarget}} --gasprice {{.GasPrice}}' >> geth.sh
43+ echo $'/geth --networkid {{.NetworkID}} --cache 512 --port {{.Port}} --maxpeers {{.Peers}} {{.LightFlag}} --ethstats \'{{.Ethstats}}\' {{if .BootV4}}--bootnodesv4 {{.BootV4}}{{end}} {{if .BootV5}}--bootnodesv5 {{.BootV5}}{{end}} {{if .Etherbase}}--etherbase {{.Etherbase}} --mine{{end}}{{if .Unlock}}--unlock 0 --password /signer.pass --mine{{end}} --targetgaslimit {{.GasTarget}} --gasprice {{.GasPrice}} {{if .NodeKey}}--nodekeyhex {{.NodeKey}} {{.NodeKey}}{{end}} ' >> geth.sh
4444
4545ENTRYPOINT ["/bin/sh", "geth.sh"]
4646`
@@ -67,7 +67,8 @@ services:
6767 - STATS_NAME={{.Ethstats}}
6868 - MINER_NAME={{.Etherbase}}
6969 - GAS_TARGET={{.GasTarget}}
70- - GAS_PRICE={{.GasPrice}}
70+ - GAS_PRICE={{.GasPrice}}{{if .NodeKey}}
71+ - NODE_KEY={{.NodeKey}}{{end}}
7172 logging:
7273 driver: "json-file"
7374 options:
@@ -107,6 +108,7 @@ func deployNode(client *sshClient, network string, bootv4, bootv5 []string, conf
107108 "GasTarget" : uint64 (1000000 * config .gasTarget ),
108109 "GasPrice" : uint64 (1000000000 * config .gasPrice ),
109110 "Unlock" : config .keyJSON != "" ,
111+ "NodeKey" : config .nodeKey ,
110112 })
111113 files [filepath .Join (workdir , "Dockerfile" )] = dockerfile .Bytes ()
112114
@@ -124,6 +126,7 @@ func deployNode(client *sshClient, network string, bootv4, bootv5 []string, conf
124126 "Etherbase" : config .etherbase ,
125127 "GasTarget" : config .gasTarget ,
126128 "GasPrice" : config .gasPrice ,
129+ "NodeKey" : config .nodeKey ,
127130 })
128131 files [filepath .Join (workdir , "docker-compose.yaml" )] = composefile .Bytes ()
129132
@@ -162,6 +165,7 @@ type nodeInfos struct {
162165 keyPass string
163166 gasTarget float64
164167 gasPrice float64
168+ nodeKey string
165169}
166170
167171// String implements the stringer interface.
@@ -194,6 +198,7 @@ func checkNode(client *sshClient, network string, boot bool) (*nodeInfos, error)
194198 lightPeers , _ := strconv .Atoi (infos .envvars ["LIGHT_PEERS" ])
195199 gasTarget , _ := strconv .ParseFloat (infos .envvars ["GAS_TARGET" ], 64 )
196200 gasPrice , _ := strconv .ParseFloat (infos .envvars ["GAS_PRICE" ], 64 )
201+ nodeKey := infos .envvars ["NODE_KEY" ]
197202
198203 // Container available, retrieve its node ID and its genesis json
199204 var out []byte
@@ -233,6 +238,7 @@ func checkNode(client *sshClient, network string, boot bool) (*nodeInfos, error)
233238 keyPass : keyPass ,
234239 gasTarget : gasTarget ,
235240 gasPrice : gasPrice ,
241+ nodeKey : nodeKey ,
236242 }
237243 stats .enodeFull = fmt .Sprintf ("enode://%s@%s:%d" , id , client .address , stats .portFull )
238244 if stats .portLight != 0 {
0 commit comments