|
|
@ -42,7 +42,7 @@ ADD genesis.json /genesis.json |
|
|
|
RUN \
|
|
|
|
RUN \
|
|
|
|
echo 'geth --cache 512 init /genesis.json' > geth.sh && \{{if .Unlock}} |
|
|
|
echo 'geth --cache 512 init /genesis.json' > geth.sh && \{{if .Unlock}} |
|
|
|
echo 'mkdir -p /root/.ethereum/keystore/ && cp /signer.json /root/.ethereum/keystore/' >> geth.sh && \{{end}} |
|
|
|
echo 'mkdir -p /root/.ethereum/keystore/ && cp /signer.json /root/.ethereum/keystore/' >> geth.sh && \{{end}} |
|
|
|
echo $'exec geth --networkid {{.NetworkID}} --cache 512 --port {{.Port}} --maxpeers {{.Peers}} {{.LightFlag}} --ethstats \'{{.Ethstats}}\' {{if .Bootnodes}}--bootnodes {{.Bootnodes}}{{end}} {{if .Etherbase}}--miner.etherbase {{.Etherbase}} --mine --miner.threads 1{{end}} {{if .Unlock}}--unlock 0 --password /signer.pass --mine{{end}} --miner.gastarget {{.GasTarget}} --miner.gasprice {{.GasPrice}}' >> geth.sh |
|
|
|
echo $'exec geth --networkid {{.NetworkID}} --cache 512 --port {{.Port}} --maxpeers {{.Peers}} {{.LightFlag}} --ethstats \'{{.Ethstats}}\' {{if .Bootnodes}}--bootnodes {{.Bootnodes}}{{end}} {{if .Etherbase}}--miner.etherbase {{.Etherbase}} --mine --miner.threads 1{{end}} {{if .Unlock}}--unlock 0 --password /signer.pass --mine{{end}} --miner.gastarget {{.GasTarget}} --miner.gaslimit {{.GasLimit}} --miner.gasprice {{.GasPrice}}' >> geth.sh |
|
|
|
|
|
|
|
|
|
|
|
ENTRYPOINT ["/bin/sh", "geth.sh"] |
|
|
|
ENTRYPOINT ["/bin/sh", "geth.sh"] |
|
|
|
` |
|
|
|
` |
|
|
@ -68,6 +68,7 @@ services: |
|
|
|
- STATS_NAME={{.Ethstats}} |
|
|
|
- STATS_NAME={{.Ethstats}} |
|
|
|
- MINER_NAME={{.Etherbase}} |
|
|
|
- MINER_NAME={{.Etherbase}} |
|
|
|
- GAS_TARGET={{.GasTarget}} |
|
|
|
- GAS_TARGET={{.GasTarget}} |
|
|
|
|
|
|
|
- GAS_LIMIT={{.GasLimit}} |
|
|
|
- GAS_PRICE={{.GasPrice}} |
|
|
|
- GAS_PRICE={{.GasPrice}} |
|
|
|
logging: |
|
|
|
logging: |
|
|
|
driver: "json-file" |
|
|
|
driver: "json-file" |
|
|
@ -104,6 +105,7 @@ func deployNode(client *sshClient, network string, bootnodes []string, config *n |
|
|
|
"Ethstats": config.ethstats, |
|
|
|
"Ethstats": config.ethstats, |
|
|
|
"Etherbase": config.etherbase, |
|
|
|
"Etherbase": config.etherbase, |
|
|
|
"GasTarget": uint64(1000000 * config.gasTarget), |
|
|
|
"GasTarget": uint64(1000000 * config.gasTarget), |
|
|
|
|
|
|
|
"GasLimit": uint64(1000000 * config.gasLimit), |
|
|
|
"GasPrice": uint64(1000000000 * config.gasPrice), |
|
|
|
"GasPrice": uint64(1000000000 * config.gasPrice), |
|
|
|
"Unlock": config.keyJSON != "", |
|
|
|
"Unlock": config.keyJSON != "", |
|
|
|
}) |
|
|
|
}) |
|
|
@ -122,6 +124,7 @@ func deployNode(client *sshClient, network string, bootnodes []string, config *n |
|
|
|
"Ethstats": config.ethstats[:strings.Index(config.ethstats, ":")], |
|
|
|
"Ethstats": config.ethstats[:strings.Index(config.ethstats, ":")], |
|
|
|
"Etherbase": config.etherbase, |
|
|
|
"Etherbase": config.etherbase, |
|
|
|
"GasTarget": config.gasTarget, |
|
|
|
"GasTarget": config.gasTarget, |
|
|
|
|
|
|
|
"GasLimit": config.gasLimit, |
|
|
|
"GasPrice": config.gasPrice, |
|
|
|
"GasPrice": config.gasPrice, |
|
|
|
}) |
|
|
|
}) |
|
|
|
files[filepath.Join(workdir, "docker-compose.yaml")] = composefile.Bytes() |
|
|
|
files[filepath.Join(workdir, "docker-compose.yaml")] = composefile.Bytes() |
|
|
@ -160,6 +163,7 @@ type nodeInfos struct { |
|
|
|
keyJSON string |
|
|
|
keyJSON string |
|
|
|
keyPass string |
|
|
|
keyPass string |
|
|
|
gasTarget float64 |
|
|
|
gasTarget float64 |
|
|
|
|
|
|
|
gasLimit float64 |
|
|
|
gasPrice float64 |
|
|
|
gasPrice float64 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -175,8 +179,9 @@ func (info *nodeInfos) Report() map[string]string { |
|
|
|
} |
|
|
|
} |
|
|
|
if info.gasTarget > 0 { |
|
|
|
if info.gasTarget > 0 { |
|
|
|
// Miner or signer node
|
|
|
|
// Miner or signer node
|
|
|
|
report["Gas limit (baseline target)"] = fmt.Sprintf("%0.3f MGas", info.gasTarget) |
|
|
|
|
|
|
|
report["Gas price (minimum accepted)"] = fmt.Sprintf("%0.3f GWei", info.gasPrice) |
|
|
|
report["Gas price (minimum accepted)"] = fmt.Sprintf("%0.3f GWei", info.gasPrice) |
|
|
|
|
|
|
|
report["Gas floor (baseline target)"] = fmt.Sprintf("%0.3f MGas", info.gasTarget) |
|
|
|
|
|
|
|
report["Gas ceil (target maximum)"] = fmt.Sprintf("%0.3f MGas", info.gasLimit) |
|
|
|
|
|
|
|
|
|
|
|
if info.etherbase != "" { |
|
|
|
if info.etherbase != "" { |
|
|
|
// Ethash proof-of-work miner
|
|
|
|
// Ethash proof-of-work miner
|
|
|
@ -217,6 +222,7 @@ func checkNode(client *sshClient, network string, boot bool) (*nodeInfos, error) |
|
|
|
totalPeers, _ := strconv.Atoi(infos.envvars["TOTAL_PEERS"]) |
|
|
|
totalPeers, _ := strconv.Atoi(infos.envvars["TOTAL_PEERS"]) |
|
|
|
lightPeers, _ := strconv.Atoi(infos.envvars["LIGHT_PEERS"]) |
|
|
|
lightPeers, _ := strconv.Atoi(infos.envvars["LIGHT_PEERS"]) |
|
|
|
gasTarget, _ := strconv.ParseFloat(infos.envvars["GAS_TARGET"], 64) |
|
|
|
gasTarget, _ := strconv.ParseFloat(infos.envvars["GAS_TARGET"], 64) |
|
|
|
|
|
|
|
gasLimit, _ := strconv.ParseFloat(infos.envvars["GAS_LIMIT"], 64) |
|
|
|
gasPrice, _ := strconv.ParseFloat(infos.envvars["GAS_PRICE"], 64) |
|
|
|
gasPrice, _ := strconv.ParseFloat(infos.envvars["GAS_PRICE"], 64) |
|
|
|
|
|
|
|
|
|
|
|
// Container available, retrieve its node ID and its genesis json
|
|
|
|
// Container available, retrieve its node ID and its genesis json
|
|
|
@ -256,6 +262,7 @@ func checkNode(client *sshClient, network string, boot bool) (*nodeInfos, error) |
|
|
|
keyJSON: keyJSON, |
|
|
|
keyJSON: keyJSON, |
|
|
|
keyPass: keyPass, |
|
|
|
keyPass: keyPass, |
|
|
|
gasTarget: gasTarget, |
|
|
|
gasTarget: gasTarget, |
|
|
|
|
|
|
|
gasLimit: gasLimit, |
|
|
|
gasPrice: gasPrice, |
|
|
|
gasPrice: gasPrice, |
|
|
|
} |
|
|
|
} |
|
|
|
stats.enode = fmt.Sprintf("enode://%s@%s:%d", id, client.address, stats.port) |
|
|
|
stats.enode = fmt.Sprintf("enode://%s@%s:%d", id, client.address, stats.port) |
|
|
|