From 5d15563ea768e03a6aef28e0b7cff4fa871cca08 Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 12 May 2014 12:22:16 +0200 Subject: PreProcess => PreParse --- ethereum/dev_console.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ethereum') diff --git a/ethereum/dev_console.go b/ethereum/dev_console.go index d2be43205..9bdd58942 100644 --- a/ethereum/dev_console.go +++ b/ethereum/dev_console.go @@ -191,7 +191,7 @@ func (i *Console) ParseInput(input string) bool { case "contract": fmt.Println("Contract editor (Ctrl-D = done)") - mainInput, initInput := mutan.PreProcess(i.Editor()) + mainInput, initInput := mutan.PreParse(i.Editor()) mainScript, err := utils.Compile(mainInput) if err != nil { fmt.Println(err) -- cgit v1.2.3 From cf7ab072644c9427501f9a29d7ad5c5492edf062 Mon Sep 17 00:00:00 2001 From: Maran Date: Mon, 12 May 2014 13:41:52 +0200 Subject: Disable seed by default Seed host seems down, only causes timeouts, not helpful --- ethereum/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ethereum') diff --git a/ethereum/config.go b/ethereum/config.go index 234e79f12..db1391881 100644 --- a/ethereum/config.go +++ b/ethereum/config.go @@ -28,7 +28,7 @@ func Init() { flag.BoolVar(&StartRpc, "r", false, "start rpc server") flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)") flag.BoolVar(&UseUPnP, "upnp", false, "enable UPnP support") - flag.BoolVar(&UseSeed, "seed", true, "seed peers") + flag.BoolVar(&UseSeed, "seed", false, "seed peers") flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key") flag.BoolVar(&ExportKey, "export", false, "export private key") flag.StringVar(&OutboundPort, "p", "30303", "listening port") -- cgit v1.2.3 From a5963d1377ab1a4a82d5b2881e820121ac3da564 Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 13 May 2014 11:34:47 +0200 Subject: Enable seed again --- ethereum/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ethereum') diff --git a/ethereum/config.go b/ethereum/config.go index db1391881..234e79f12 100644 --- a/ethereum/config.go +++ b/ethereum/config.go @@ -28,7 +28,7 @@ func Init() { flag.BoolVar(&StartRpc, "r", false, "start rpc server") flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)") flag.BoolVar(&UseUPnP, "upnp", false, "enable UPnP support") - flag.BoolVar(&UseSeed, "seed", false, "seed peers") + flag.BoolVar(&UseSeed, "seed", true, "seed peers") flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key") flag.BoolVar(&ExportKey, "export", false, "export private key") flag.StringVar(&OutboundPort, "p", "30303", "listening port") -- cgit v1.2.3 From b9876df5dc719f583172017cc71af146c6f732a9 Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 13 May 2014 11:48:52 +0200 Subject: Added support to NewJsonRpc to return an error as well as an interface --- ethereum/ethereum.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ethereum') diff --git a/ethereum/ethereum.go b/ethereum/ethereum.go index 2f05bf2a1..8ef061be0 100644 --- a/ethereum/ethereum.go +++ b/ethereum/ethereum.go @@ -133,8 +133,12 @@ func main() { go console.Start() } if StartRpc { - ethereum.RpcServer = ethrpc.NewJsonRpcServer(ethpub.NewPEthereum(ethereum.StateManager(), ethereum.BlockChain(), ethereum.TxPool())) - go ethereum.RpcServer.Start() + ethereum.RpcServer, err = ethrpc.NewJsonRpcServer(ethpub.NewPEthereum(ethereum.StateManager(), ethereum.BlockChain(), ethereum.TxPool())) + if err != nil { + logger.Infoln("Could not start RPC interface:", err) + } else { + go ethereum.RpcServer.Start() + } } RegisterInterrupts(ethereum) -- cgit v1.2.3 From 9a03df7bd831f1b66bc02510a4abed878f4ffa17 Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 13 May 2014 12:00:48 +0200 Subject: Implemented a flag for a different RPC port; --rpcport --- ethereum/config.go | 2 ++ ethereum/ethereum.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'ethereum') diff --git a/ethereum/config.go b/ethereum/config.go index 234e79f12..7ca1a9801 100644 --- a/ethereum/config.go +++ b/ethereum/config.go @@ -7,6 +7,7 @@ import ( var StartConsole bool var StartMining bool var StartRpc bool +var RpcPort int var UseUPnP bool var OutboundPort string var ShowGenesis bool @@ -26,6 +27,7 @@ func Init() { flag.BoolVar(&ShowGenesis, "g", false, "prints genesis header and exits") //flag.BoolVar(&UseGui, "gui", true, "use the gui") flag.BoolVar(&StartRpc, "r", false, "start rpc server") + flag.IntVar(&RpcPort, "rpcport", 8080, "port to start json-rpc server on") flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)") flag.BoolVar(&UseUPnP, "upnp", false, "enable UPnP support") flag.BoolVar(&UseSeed, "seed", true, "seed peers") diff --git a/ethereum/ethereum.go b/ethereum/ethereum.go index 8ef061be0..d49b5dc8a 100644 --- a/ethereum/ethereum.go +++ b/ethereum/ethereum.go @@ -133,7 +133,7 @@ func main() { go console.Start() } if StartRpc { - ethereum.RpcServer, err = ethrpc.NewJsonRpcServer(ethpub.NewPEthereum(ethereum.StateManager(), ethereum.BlockChain(), ethereum.TxPool())) + ethereum.RpcServer, err = ethrpc.NewJsonRpcServer(ethpub.NewPEthereum(ethereum.StateManager(), ethereum.BlockChain(), ethereum.TxPool()), RpcPort) if err != nil { logger.Infoln("Could not start RPC interface:", err) } else { -- cgit v1.2.3 From 32c6126593100d37c38e423ec62c56938e5f9155 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 13 May 2014 12:45:47 +0200 Subject: Fix --- ethereum/ethereum.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ethereum') diff --git a/ethereum/ethereum.go b/ethereum/ethereum.go index 8ef061be0..b60eb4181 100644 --- a/ethereum/ethereum.go +++ b/ethereum/ethereum.go @@ -133,7 +133,7 @@ func main() { go console.Start() } if StartRpc { - ethereum.RpcServer, err = ethrpc.NewJsonRpcServer(ethpub.NewPEthereum(ethereum.StateManager(), ethereum.BlockChain(), ethereum.TxPool())) + ethereum.RpcServer, err = ethrpc.NewJsonRpcServer(ethpub.NewPEthereum(ethereum)) if err != nil { logger.Infoln("Could not start RPC interface:", err) } else { -- cgit v1.2.3 From 20ea78945e751a1ad11e2b2fc7c4224f4c46e108 Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 13 May 2014 14:43:08 +0200 Subject: Implemented new JS/EthPub methods - getTxCountAt - getPeerCount - getIsMining - getIsListening - getCoinbase --- ethereum/ethereum.go | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) (limited to 'ethereum') diff --git a/ethereum/ethereum.go b/ethereum/ethereum.go index 5b578deba..8b22533d9 100644 --- a/ethereum/ethereum.go +++ b/ethereum/ethereum.go @@ -122,28 +122,8 @@ func main() { // Set the max peers ethereum.MaxPeers = MaxPeer - if StartConsole { - err := os.Mkdir(ethutil.Config.ExecPath, os.ModePerm) - // Error is OK if the error is ErrExist - if err != nil && !os.IsExist(err) { - log.Panic("Unable to create EXECPATH:", err) - } - - console := NewConsole(ethereum) - go console.Start() - } - if StartRpc { - ethereum.RpcServer, err = ethrpc.NewJsonRpcServer(ethpub.NewPEthereum(ethereum), RpcPort) - if err != nil { - logger.Infoln("Could not start RPC interface:", err) - } else { - go ethereum.RpcServer.Start() - } - } - - RegisterInterrupts(ethereum) - - ethereum.Start(UseSeed) + // Set Mining status + ethereum.Mining = StartMining if StartMining { logger.Infoln("Miner started") @@ -168,6 +148,29 @@ func main() { } + if StartConsole { + err := os.Mkdir(ethutil.Config.ExecPath, os.ModePerm) + // Error is OK if the error is ErrExist + if err != nil && !os.IsExist(err) { + log.Panic("Unable to create EXECPATH:", err) + } + + console := NewConsole(ethereum) + go console.Start() + } + if StartRpc { + ethereum.RpcServer, err = ethrpc.NewJsonRpcServer(ethpub.NewPEthereum(ethereum), RpcPort) + if err != nil { + logger.Infoln("Could not start RPC interface:", err) + } else { + go ethereum.RpcServer.Start() + } + } + + RegisterInterrupts(ethereum) + + ethereum.Start(UseSeed) + // Wait for shutdown ethereum.WaitForShutdown() } -- cgit v1.2.3 From 54eff2d778ef6e8a84d336d4fb14a5a35728340c Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 13 May 2014 14:48:45 +0200 Subject: Change coinbase to be the address not public key --- ethereum/ethereum.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ethereum') diff --git a/ethereum/ethereum.go b/ethereum/ethereum.go index 8b22533d9..babebbb48 100644 --- a/ethereum/ethereum.go +++ b/ethereum/ethereum.go @@ -1,6 +1,7 @@ package main import ( + "encoding/hex" "fmt" "github.com/ethereum/eth-go" "github.com/ethereum/eth-go/ethchain" @@ -139,7 +140,9 @@ func main() { keyRing := ethutil.NewValueFromBytes(data) addr := keyRing.Get(1).Bytes() - miner := ethminer.NewDefaultMiner(addr, ethereum) + pair, _ := ethchain.NewKeyPairFromSec(ethutil.FromHex(hex.EncodeToString(addr))) + + miner := ethminer.NewDefaultMiner(pair.Address(), ethereum) miner.Start() }() -- cgit v1.2.3