|
|
@ -121,8 +121,13 @@ void help() |
|
|
|
<< "Usage eth [OPTIONS]" << endl |
|
|
|
<< "Options:" << endl << endl |
|
|
|
<< "Client mode (default):" << endl |
|
|
|
<< " --olympic Use the Olympic (0.9) protocol." << endl |
|
|
|
<< " --frontier Use the Frontier (1.0) protocol." << endl |
|
|
|
<< " --private <name> Use a private chain." << endl |
|
|
|
<< " -o,--mode <full/peer> Start a full node or a peer node (default: full)." << endl |
|
|
|
#if ETH_JSCONSOLE || !ETH_TRUE |
|
|
|
<< " -i,--interactive Enter interactive mode (default: non-interactive)." << endl |
|
|
|
#endif |
|
|
|
#if ETH_JSONRPC || !ETH_TRUE |
|
|
|
<< " -j,--json-rpc Enable JSON-RPC server (default: off)." << endl |
|
|
|
<< " --json-rpc-port <n> Specify JSON-RPC server port (implies '-j', default: " << SensibleHttpPort << ")." << endl |
|
|
@ -139,7 +144,6 @@ void help() |
|
|
|
<< " --master <password> Give the master password for the key store." << endl |
|
|
|
<< " --password <password> Give a password for a private key." << endl |
|
|
|
<< " --sentinel <server> Set the sentinel for reporting bad blocks or chain issues." << endl |
|
|
|
<< " --prime <n> Specify n as the 6 digit prime number to start Frontier." << endl |
|
|
|
<< endl |
|
|
|
<< "Client transacting:" << endl |
|
|
|
/*<< " -B,--block-fees <n> Set the block fee profit in the reference unit e.g. ¢ (default: 15)." << endl
|
|
|
@ -168,10 +172,10 @@ void help() |
|
|
|
<< " --listen <port> Listen on the given port for incoming connections (default: 30303)." << endl |
|
|
|
<< " -r,--remote <host>(:<port>) Connect to remote host (default: none)." << endl |
|
|
|
<< " --port <port> Connect to remote port (default: 30303)." << endl |
|
|
|
<< " --network-id <n> Only connect to other hosts with this network id (default:0)." << endl |
|
|
|
<< " --network-id <n> Only connect to other hosts with this network id." << endl |
|
|
|
<< " --upnp <on/off> Use UPnP for NAT (default: on)." << endl |
|
|
|
<< " --no-discovery Disable Node discovery. (experimental)" << endl |
|
|
|
<< " --pin Only connect to required (trusted) peers. (experimental)" << endl |
|
|
|
<< " --no-discovery Disable Node discovery." << endl |
|
|
|
<< " --pin Only connect to required (trusted) peers." << endl |
|
|
|
// << " --require-peers <peers.json> List of required (trusted) peers. (experimental)" << endl
|
|
|
|
<< endl; |
|
|
|
MinerCLI::streamHelp(cout); |
|
|
@ -196,9 +200,6 @@ void help() |
|
|
|
<< " -v,--verbosity <0 - 9> Set the log verbosity from 0 to 9 (default: 8)." << endl |
|
|
|
<< " -V,--version Show the version and exit." << endl |
|
|
|
<< " -h,--help Show this help message and exit." << endl |
|
|
|
#if ETH_JSCONSOLE || !ETH_TRUE |
|
|
|
<< " --console Use interactive javascript console" << endl |
|
|
|
#endif |
|
|
|
; |
|
|
|
exit(0); |
|
|
|
} |
|
|
@ -1068,8 +1069,8 @@ int main(int argc, char** argv) |
|
|
|
/// Operating mode.
|
|
|
|
OperationMode mode = OperationMode::Node; |
|
|
|
string dbPath; |
|
|
|
unsigned prime = 0; |
|
|
|
bool yesIReallyKnowWhatImDoing = false; |
|
|
|
// unsigned prime = 0;
|
|
|
|
// bool yesIReallyKnowWhatImDoing = false;
|
|
|
|
|
|
|
|
/// File name for import/export.
|
|
|
|
string filename; |
|
|
@ -1083,10 +1084,14 @@ int main(int argc, char** argv) |
|
|
|
/// General params for Node operation
|
|
|
|
NodeMode nodeMode = NodeMode::Full; |
|
|
|
bool interactive = false; |
|
|
|
#if ETH_JSONRPC |
|
|
|
#if ETH_JSONRPC || !ETH_TRUE |
|
|
|
int jsonrpc = -1; |
|
|
|
#endif |
|
|
|
string jsonAdmin; |
|
|
|
string genesisJSON; |
|
|
|
dev::eth::Network releaseNetwork = c_network; |
|
|
|
string privateChain; |
|
|
|
|
|
|
|
bool upnp = true; |
|
|
|
WithExisting withExisting = WithExisting::Trust; |
|
|
|
string sentinel; |
|
|
@ -1148,10 +1153,6 @@ int main(int argc, char** argv) |
|
|
|
beneficiary = config[1].toHash<Address>(); |
|
|
|
} |
|
|
|
|
|
|
|
// do this here so that --genesis-json can actually override it.
|
|
|
|
if (!contents(getDataDir() + "/genesis.json").empty()) |
|
|
|
CanonBlockChain<Ethash>::setGenesis(contentsString(getDataDir() + "/genesis.json")); |
|
|
|
|
|
|
|
MinerCLI m(MinerCLI::OperationMode::None); |
|
|
|
|
|
|
|
for (int i = 1; i < argc; ++i) |
|
|
@ -1196,7 +1197,7 @@ int main(int argc, char** argv) |
|
|
|
mode = OperationMode::Export; |
|
|
|
filename = argv[++i]; |
|
|
|
} |
|
|
|
else if (arg == "--prime" && i + 1 < argc) |
|
|
|
/* else if (arg == "--prime" && i + 1 < argc)
|
|
|
|
try |
|
|
|
{ |
|
|
|
prime = stoi(argv[++i]); |
|
|
@ -1208,7 +1209,7 @@ int main(int argc, char** argv) |
|
|
|
} |
|
|
|
else if (arg == "--yes-i-really-know-what-im-doing") |
|
|
|
yesIReallyKnowWhatImDoing = true; |
|
|
|
else if (arg == "--sentinel" && i + 1 < argc) |
|
|
|
*/ else if (arg == "--sentinel" && i + 1 < argc) |
|
|
|
sentinel = argv[++i]; |
|
|
|
else if (arg == "--mine-on-wrong-chain") |
|
|
|
mineOnWrongChain = true; |
|
|
@ -1257,6 +1258,15 @@ int main(int argc, char** argv) |
|
|
|
cerr << "Bad " << arg << " option: " << argv[i] << endl; |
|
|
|
return -1; |
|
|
|
} |
|
|
|
else if (arg == "--private" && i + 1 < argc) |
|
|
|
try { |
|
|
|
privateChain = argv[++i]; |
|
|
|
} |
|
|
|
catch (...) |
|
|
|
{ |
|
|
|
cerr << "Bad " << arg << " option: " << argv[i] << endl; |
|
|
|
return -1; |
|
|
|
} |
|
|
|
else if (arg == "-K" || arg == "--kill-blockchain" || arg == "--kill") |
|
|
|
withExisting = WithExisting::Kill; |
|
|
|
else if (arg == "-R" || arg == "--rebuild") |
|
|
@ -1314,7 +1324,7 @@ int main(int argc, char** argv) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
CanonBlockChain<Ethash>::setGenesis(contentsString(argv[++i])); |
|
|
|
genesisJSON = contentsString(argv[++i]); |
|
|
|
} |
|
|
|
catch (...) |
|
|
|
{ |
|
|
@ -1322,6 +1332,10 @@ int main(int argc, char** argv) |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (arg == "--frontier") |
|
|
|
releaseNetwork = eth::Network::Frontier; |
|
|
|
else if (arg == "--olympic") |
|
|
|
releaseNetwork = eth::Network::Olympic; |
|
|
|
/* else if ((arg == "-B" || arg == "--block-fees") && i + 1 < argc)
|
|
|
|
{ |
|
|
|
try |
|
|
@ -1416,9 +1430,9 @@ int main(int argc, char** argv) |
|
|
|
pinning = true; |
|
|
|
else if (arg == "-f" || arg == "--force-mining") |
|
|
|
forceMining = true; |
|
|
|
else if (arg == "-i" || arg == "--interactive") |
|
|
|
else if (arg == "--old-interactive") |
|
|
|
interactive = true; |
|
|
|
#if ETH_JSONRPC |
|
|
|
#if ETH_JSONRPC || !ETH_TRUE |
|
|
|
else if ((arg == "-j" || arg == "--json-rpc")) |
|
|
|
jsonrpc = jsonrpc == -1 ? SensibleHttpPort : jsonrpc; |
|
|
|
else if (arg == "--json-rpc-port" && i + 1 < argc) |
|
|
@ -1426,8 +1440,8 @@ int main(int argc, char** argv) |
|
|
|
else if (arg == "--json-admin" && i + 1 < argc) |
|
|
|
jsonAdmin = argv[++i]; |
|
|
|
#endif |
|
|
|
#if ETH_JSCONSOLE |
|
|
|
else if (arg == "--console") |
|
|
|
#if ETH_JSCONSOLE || !ETH_TRUE |
|
|
|
else if (arg == "-i" || arg == "--interactive" || arg == "--console") |
|
|
|
useConsole = true; |
|
|
|
#endif |
|
|
|
else if ((arg == "-v" || arg == "--verbosity") && i + 1 < argc) |
|
|
@ -1475,6 +1489,13 @@ int main(int argc, char** argv) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Set up all the chain config stuff.
|
|
|
|
resetNetwork(releaseNetwork); |
|
|
|
if (!privateChain.empty()) |
|
|
|
CanonBlockChain<Ethash>::forceGenesisExtraData(sha3(privateChain).asBytes()); |
|
|
|
if (!genesisJSON.empty()) |
|
|
|
CanonBlockChain<Ethash>::setGenesis(genesisJSON); |
|
|
|
|
|
|
|
if (g_logVerbosity > 0) |
|
|
|
{ |
|
|
|
cout << EthGrayBold "(++)Ethereum" EthReset << endl; |
|
|
@ -1533,8 +1554,9 @@ int main(int argc, char** argv) |
|
|
|
|
|
|
|
StructuredLogger::get().initialize(structuredLogging, structuredLoggingFormat, structuredLoggingURL); |
|
|
|
auto netPrefs = publicIP.empty() ? NetworkPreferences(listenIP ,listenPort, upnp) : NetworkPreferences(publicIP, listenIP ,listenPort, upnp); |
|
|
|
netPrefs.discovery = !disableDiscovery; |
|
|
|
netPrefs.pin = pinning; |
|
|
|
netPrefs.discovery = privateChain.empty() && !disableDiscovery; |
|
|
|
netPrefs.pin = pinning || !privateChain.empty(); |
|
|
|
|
|
|
|
auto nodesState = contents((dbPath.size() ? dbPath : getDataDir()) + "/network.rlp"); |
|
|
|
dev::WebThreeDirect web3( |
|
|
|
WebThreeDirect::composeClientVersion("++eth", clientName), |
|
|
@ -1636,7 +1658,7 @@ int main(int argc, char** argv) |
|
|
|
cout << imported << " imported in " << e << " seconds at " << (round(imported * 10 / e) / 10) << " blocks/s (#" << web3.ethereum()->number() << ")" << endl; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
/*
|
|
|
|
if (c_network == eth::Network::Frontier && !yesIReallyKnowWhatImDoing) |
|
|
|
{ |
|
|
|
auto pd = contents(getDataDir() + "primes"); |
|
|
@ -1656,7 +1678,7 @@ int main(int argc, char** argv) |
|
|
|
primes.insert(prime); |
|
|
|
writeFile(getDataDir() + "primes", rlp(primes)); |
|
|
|
} |
|
|
|
|
|
|
|
*/ |
|
|
|
if (keyManager.exists()) |
|
|
|
{ |
|
|
|
if (masterPassword.empty() || !keyManager.load(masterPassword)) |
|
|
|