aboutsummaryrefslogtreecommitdiffstats
path: root/ethereum/main.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-06-27 01:53:03 +0800
committerobscuren <geffobscura@gmail.com>2014-06-27 01:53:03 +0800
commitfd89df4d386f75f103808c2766c3a837e07ab651 (patch)
tree7b69cfda3c5dbc8431657ec34629c56bcdec0d8f /ethereum/main.go
parentb57ee874852cc49210c68dce14eb45db448d9ae7 (diff)
parent91bdf9e8012cb396f5fa08765190d76e758fb6a0 (diff)
downloaddexon-fd89df4d386f75f103808c2766c3a837e07ab651.tar
dexon-fd89df4d386f75f103808c2766c3a837e07ab651.tar.gz
dexon-fd89df4d386f75f103808c2766c3a837e07ab651.tar.bz2
dexon-fd89df4d386f75f103808c2766c3a837e07ab651.tar.lz
dexon-fd89df4d386f75f103808c2766c3a837e07ab651.tar.xz
dexon-fd89df4d386f75f103808c2766c3a837e07ab651.tar.zst
dexon-fd89df4d386f75f103808c2766c3a837e07ab651.zip
Merge branch 'develop' into release/0.5.15
Diffstat (limited to 'ethereum/main.go')
-rw-r--r--ethereum/main.go53
1 files changed, 53 insertions, 0 deletions
diff --git a/ethereum/main.go b/ethereum/main.go
new file mode 100644
index 000000000..6b1995eec
--- /dev/null
+++ b/ethereum/main.go
@@ -0,0 +1,53 @@
+package main
+
+import (
+ "github.com/ethereum/eth-go/ethlog"
+ "github.com/ethereum/go-ethereum/utils"
+ "runtime"
+)
+
+var logger = ethlog.NewLogger("CLI")
+
+func main() {
+ runtime.GOMAXPROCS(runtime.NumCPU())
+
+ utils.HandleInterrupt()
+
+ // precedence: code-internal flag default < config file < environment variables < command line
+ Init() // parsing command line
+ utils.InitConfig(ConfigFile, Datadir, Identifier, "ETH")
+
+ utils.InitDataDir(Datadir)
+
+ utils.InitLogging(Datadir, LogFile, LogLevel, DebugFile)
+
+ ethereum := utils.NewEthereum(UseUPnP, OutboundPort, MaxPeer)
+
+ // create, import, export keys
+ utils.KeyTasks(GenAddr, ImportKey, ExportKey, NonInteractive)
+
+ if ShowGenesis {
+ utils.ShowGenesis(ethereum)
+ }
+
+ if StartMining {
+ utils.StartMining(ethereum)
+ }
+
+ // better reworked as cases
+ if StartJsConsole {
+ InitJsConsole(ethereum)
+ } else if len(InputFile) > 0 {
+ ExecJsFile(ethereum, InputFile)
+ }
+
+ if StartRpc {
+ utils.StartRpc(ethereum, RpcPort)
+ }
+
+ utils.StartEthereum(ethereum, UseSeed)
+
+ // this blocks the thread
+ ethereum.WaitForShutdown()
+ ethlog.Flush()
+}