aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/ethereum
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/ethereum')
-rw-r--r--cmd/ethereum/flags.go77
-rw-r--r--cmd/ethereum/main.go41
-rw-r--r--cmd/ethereum/repl/repl.go1
3 files changed, 67 insertions, 52 deletions
diff --git a/cmd/ethereum/flags.go b/cmd/ethereum/flags.go
index fd8aee90b..46a63d849 100644
--- a/cmd/ethereum/flags.go
+++ b/cmd/ethereum/flags.go
@@ -27,6 +27,7 @@ import (
"log"
"os"
"path"
+ "runtime"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
@@ -36,39 +37,41 @@ import (
)
var (
- Identifier string
- KeyRing string
- DiffTool bool
- DiffType string
- KeyStore string
- StartRpc bool
- StartWebSockets bool
- RpcPort int
- OutboundPort string
- ShowGenesis bool
- AddPeer string
- MaxPeer int
- GenAddr bool
- BootNodes string
- NodeKey *ecdsa.PrivateKey
- NAT nat.Interface
- SecretFile string
- ExportDir string
- NonInteractive bool
- Datadir string
- LogFile string
- ConfigFile string
- DebugFile string
- LogLevel int
- LogFormat string
- Dump bool
- DumpHash string
- DumpNumber int
- VmType int
- ImportChain string
- SHH bool
- Dial bool
- PrintVersion bool
+ Identifier string
+ KeyRing string
+ DiffTool bool
+ DiffType string
+ KeyStore string
+ StartRpc bool
+ StartWebSockets bool
+ RpcListenAddress string
+ RpcPort int
+ OutboundPort string
+ ShowGenesis bool
+ AddPeer string
+ MaxPeer int
+ GenAddr bool
+ BootNodes string
+ NodeKey *ecdsa.PrivateKey
+ NAT nat.Interface
+ SecretFile string
+ ExportDir string
+ NonInteractive bool
+ Datadir string
+ LogFile string
+ ConfigFile string
+ DebugFile string
+ LogLevel int
+ LogFormat string
+ Dump bool
+ DumpHash string
+ DumpNumber int
+ VmType int
+ ImportChain string
+ SHH bool
+ Dial bool
+ PrintVersion bool
+ MinerThreads int
)
// flags specific to cli client
@@ -92,6 +95,7 @@ func Init() {
flag.StringVar(&KeyRing, "keyring", "", "identifier for keyring to use")
flag.StringVar(&KeyStore, "keystore", "db", "system to store keyrings: db|file (db)")
+ flag.StringVar(&RpcListenAddress, "rpcaddr", "127.0.0.1", "address for json-rpc server to listen on")
flag.IntVar(&RpcPort, "rpcport", 8545, "port to start json-rpc server on")
flag.BoolVar(&StartRpc, "rpc", false, "start rpc server")
flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)")
@@ -116,6 +120,7 @@ func Init() {
flag.BoolVar(&StartMining, "mine", false, "start dagger mining")
flag.BoolVar(&StartJsConsole, "js", false, "launches javascript console")
flag.BoolVar(&PrintVersion, "version", false, "prints version number")
+ flag.IntVar(&MinerThreads, "minerthreads", runtime.NumCPU(), "number of miner threads")
// Network stuff
var (
@@ -132,6 +137,12 @@ func Init() {
flag.Parse()
+ // When the javascript console is started log to a file instead
+ // of stdout
+ if StartJsConsole {
+ LogFile = path.Join(Datadir, "ethereum.log")
+ }
+
var err error
if NAT, err = nat.Parse(*natstr); err != nil {
log.Fatalf("-nat: %v", err)
diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go
index 63585b0f5..ff306b10f 100644
--- a/cmd/ethereum/main.go
+++ b/cmd/ethereum/main.go
@@ -62,20 +62,21 @@ func main() {
utils.InitConfig(VmType, ConfigFile, Datadir, "ETH")
ethereum, err := eth.New(&eth.Config{
- Name: p2p.MakeName(ClientIdentifier, Version),
- KeyStore: KeyStore,
- DataDir: Datadir,
- LogFile: LogFile,
- LogLevel: LogLevel,
- LogFormat: LogFormat,
- MaxPeers: MaxPeer,
- Port: OutboundPort,
- NAT: NAT,
- KeyRing: KeyRing,
- Shh: true,
- Dial: Dial,
- BootNodes: BootNodes,
- NodeKey: NodeKey,
+ Name: p2p.MakeName(ClientIdentifier, Version),
+ KeyStore: KeyStore,
+ DataDir: Datadir,
+ LogFile: LogFile,
+ LogLevel: LogLevel,
+ LogFormat: LogFormat,
+ MaxPeers: MaxPeer,
+ Port: OutboundPort,
+ NAT: NAT,
+ KeyRing: KeyRing,
+ Shh: true,
+ Dial: Dial,
+ BootNodes: BootNodes,
+ NodeKey: NodeKey,
+ MinerThreads: MinerThreads,
})
if err != nil {
@@ -113,10 +114,6 @@ func main() {
return
}
- if StartMining {
- utils.StartMining(ethereum)
- }
-
if len(ImportChain) > 0 {
start := time.Now()
err := utils.ImportChain(ethereum, ImportChain)
@@ -128,11 +125,17 @@ func main() {
}
if StartRpc {
- utils.StartRpc(ethereum, RpcPort)
+ utils.StartRpc(ethereum, RpcListenAddress, RpcPort)
}
utils.StartEthereum(ethereum)
+ fmt.Printf("Welcome to the FRONTIER\n")
+
+ if StartMining {
+ ethereum.Miner().Start()
+ }
+
if StartJsConsole {
InitJsConsole(ethereum)
} else if len(InputFile) > 0 {
diff --git a/cmd/ethereum/repl/repl.go b/cmd/ethereum/repl/repl.go
index 4a7880ff4..11b812617 100644
--- a/cmd/ethereum/repl/repl.go
+++ b/cmd/ethereum/repl/repl.go
@@ -60,6 +60,7 @@ func (self *JSRepl) Start() {
if !self.running {
self.running = true
repllogger.Infoln("init JS Console")
+
reader := bufio.NewReader(self.history)
for {
line, err := reader.ReadString('\n')