Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f702e27485 | ||
|
|
0c5a747ef1 | ||
|
|
75df148ba2 | ||
|
|
4572d4940c | ||
|
|
2b9f16802d | ||
|
|
34e2ab9f9f | ||
|
|
44296c0b33 | ||
|
|
01d9107bce | ||
|
|
ba3fabda77 | ||
|
|
edf10ef8c5 | ||
|
|
6c565eae74 |
@@ -5,7 +5,7 @@ Ethereum
|
|||||||
|
|
||||||
Ethereum Go Client © 2014 Jeffrey Wilcke.
|
Ethereum Go Client © 2014 Jeffrey Wilcke.
|
||||||
|
|
||||||
Current state: Proof of Concept 0.5.16.
|
Current state: Proof of Concept 0.5.17.
|
||||||
|
|
||||||
For the development package please see the [eth-go package](https://github.com/ethereum/eth-go).
|
For the development package please see the [eth-go package](https://github.com/ethereum/eth-go).
|
||||||
|
|
||||||
|
|||||||
@@ -420,29 +420,53 @@ ApplicationWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
y: 7
|
y: 6
|
||||||
anchors.right: peerImage.left
|
id: lastBlockLabel
|
||||||
|
objectName: "lastBlockLabel"
|
||||||
|
visible: true
|
||||||
|
text: ""
|
||||||
|
font.pixelSize: 10
|
||||||
|
anchors.right: peerGroup.left
|
||||||
anchors.rightMargin: 5
|
anchors.rightMargin: 5
|
||||||
|
}
|
||||||
|
|
||||||
|
ProgressBar {
|
||||||
|
id: syncProgressIndicator
|
||||||
|
visible: false
|
||||||
|
objectName: "syncProgressIndicator"
|
||||||
|
y: 3
|
||||||
|
width: 140
|
||||||
|
indeterminate: true
|
||||||
|
anchors.right: peerGroup.left
|
||||||
|
anchors.rightMargin: 5
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: peerGroup
|
||||||
|
y: 7
|
||||||
|
anchors.right: parent.right
|
||||||
|
MouseArea {
|
||||||
|
onDoubleClicked: peerWindow.visible = true
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
id: peerLabel
|
id: peerLabel
|
||||||
font.pixelSize: 8
|
font.pixelSize: 8
|
||||||
text: "0 / 0"
|
text: "0 / 0"
|
||||||
}
|
}
|
||||||
Image {
|
Image {
|
||||||
y: 7
|
|
||||||
id: peerImage
|
id: peerImage
|
||||||
anchors.right: parent.right
|
|
||||||
width: 10; height: 10
|
width: 10; height: 10
|
||||||
MouseArea {
|
|
||||||
onDoubleClicked: peerWindow.visible = true
|
|
||||||
anchors.fill: parent
|
|
||||||
}
|
|
||||||
source: "../network.png"
|
source: "../network.png"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Window {
|
Window {
|
||||||
id: popup
|
id: popup
|
||||||
visible: false
|
visible: false
|
||||||
|
//flags: Qt.CustomizeWindowHint | Qt.Tool | Qt.WindowCloseButtonHint
|
||||||
property var block
|
property var block
|
||||||
width: root.width
|
width: root.width
|
||||||
height: 300
|
height: 300
|
||||||
@@ -460,7 +484,7 @@ ApplicationWindow {
|
|||||||
Text { text: '<h3>Block details</h3>'; color: "#F2F2F2"}
|
Text { text: '<h3>Block details</h3>'; color: "#F2F2F2"}
|
||||||
Text { text: '<b>Block number:</b> ' + number; color: "#F2F2F2"}
|
Text { text: '<b>Block number:</b> ' + number; color: "#F2F2F2"}
|
||||||
Text { text: '<b>Hash:</b> ' + hash; color: "#F2F2F2"}
|
Text { text: '<b>Hash:</b> ' + hash; color: "#F2F2F2"}
|
||||||
Text { text: '<b>Coinbase:</b> ' + coinbase; color: "#F2F2F2"}
|
Text { text: '<b>Coinbase:</b> <' + name + '> ' + coinbase; color: "#F2F2F2"}
|
||||||
Text { text: '<b>Block found at:</b> ' + prettyTime; color: "#F2F2F2"}
|
Text { text: '<b>Block found at:</b> ' + prettyTime; color: "#F2F2F2"}
|
||||||
Text { text: '<b>Gas used:</b> ' + gasUsed + " / " + gasLimit; color: "#F2F2F2"}
|
Text { text: '<b>Gas used:</b> ' + gasUsed + " / " + gasLimit; color: "#F2F2F2"}
|
||||||
}
|
}
|
||||||
@@ -577,6 +601,7 @@ ApplicationWindow {
|
|||||||
|
|
||||||
Window {
|
Window {
|
||||||
id: addPeerWin
|
id: addPeerWin
|
||||||
|
//flags: Qt.CustomizeWindowHint | Qt.Tool | Qt.WindowCloseButtonHint
|
||||||
visible: false
|
visible: false
|
||||||
minimumWidth: 230
|
minimumWidth: 230
|
||||||
maximumWidth: 230
|
maximumWidth: 230
|
||||||
@@ -686,9 +711,9 @@ ApplicationWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(initial){
|
if(initial){
|
||||||
blockModel.append({number: block.number, gasLimit: block.gasLimit, gasUsed: block.gasUsed, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)})
|
blockModel.append({number: block.number, name: block.name, gasLimit: block.gasLimit, gasUsed: block.gasUsed, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)})
|
||||||
}else{
|
}else{
|
||||||
blockModel.insert(0, {number: block.number, gasLimit: block.gasLimit, gasUsed: block.gasUsed, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)})
|
blockModel.insert(0, {number: block.number, name: block.name, gasLimit: block.gasLimit, gasUsed: block.gasUsed, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -743,6 +768,7 @@ ApplicationWindow {
|
|||||||
// ******************************************
|
// ******************************************
|
||||||
Window {
|
Window {
|
||||||
id: peerWindow
|
id: peerWindow
|
||||||
|
//flags: Qt.CustomizeWindowHint | Qt.Tool | Qt.WindowCloseButtonHint
|
||||||
height: 200
|
height: 200
|
||||||
width: 700
|
width: 700
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ type DebuggerWindow struct {
|
|||||||
|
|
||||||
vm *ethchain.Vm
|
vm *ethchain.Vm
|
||||||
Db *Debugger
|
Db *Debugger
|
||||||
|
|
||||||
|
state *ethchain.State
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDebuggerWindow(lib *UiLib) *DebuggerWindow {
|
func NewDebuggerWindow(lib *UiLib) *DebuggerWindow {
|
||||||
@@ -53,6 +55,7 @@ func (self *DebuggerWindow) SetCode(code string) {
|
|||||||
func (self *DebuggerWindow) SetData(data string) {
|
func (self *DebuggerWindow) SetData(data string) {
|
||||||
self.win.Set("dataText", data)
|
self.win.Set("dataText", data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *DebuggerWindow) SetAsm(data []byte) {
|
func (self *DebuggerWindow) SetAsm(data []byte) {
|
||||||
self.win.Root().Call("clearAsm")
|
self.win.Root().Call("clearAsm")
|
||||||
|
|
||||||
|
|||||||
@@ -7,12 +7,14 @@ import (
|
|||||||
"github.com/ethereum/eth-go/ethchain"
|
"github.com/ethereum/eth-go/ethchain"
|
||||||
"github.com/ethereum/eth-go/ethdb"
|
"github.com/ethereum/eth-go/ethdb"
|
||||||
"github.com/ethereum/eth-go/ethlog"
|
"github.com/ethereum/eth-go/ethlog"
|
||||||
|
"github.com/ethereum/eth-go/ethminer"
|
||||||
"github.com/ethereum/eth-go/ethpub"
|
"github.com/ethereum/eth-go/ethpub"
|
||||||
"github.com/ethereum/eth-go/ethutil"
|
"github.com/ethereum/eth-go/ethutil"
|
||||||
"github.com/ethereum/eth-go/ethwire"
|
"github.com/ethereum/eth-go/ethwire"
|
||||||
"github.com/ethereum/go-ethereum/utils"
|
"github.com/ethereum/go-ethereum/utils"
|
||||||
"github.com/go-qml/qml"
|
"github.com/go-qml/qml"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@@ -40,6 +42,8 @@ type Gui struct {
|
|||||||
Session string
|
Session string
|
||||||
clientIdentity *ethwire.SimpleClientIdentity
|
clientIdentity *ethwire.SimpleClientIdentity
|
||||||
config *ethutil.ConfigManager
|
config *ethutil.ConfigManager
|
||||||
|
|
||||||
|
miner *ethminer.Miner
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create GUI, but doesn't start it
|
// Create GUI, but doesn't start it
|
||||||
@@ -124,6 +128,7 @@ func (gui *Gui) ToggleMining() {
|
|||||||
txt = "Start mining"
|
txt = "Start mining"
|
||||||
} else {
|
} else {
|
||||||
utils.StartMining(gui.eth)
|
utils.StartMining(gui.eth)
|
||||||
|
gui.miner = utils.GetMiner()
|
||||||
txt = "Stop mining"
|
txt = "Stop mining"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,7 +248,11 @@ func (gui *Gui) readPreviousTransactions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) processBlock(block *ethchain.Block, initial bool) {
|
func (gui *Gui) processBlock(block *ethchain.Block, initial bool) {
|
||||||
gui.win.Root().Call("addBlock", ethpub.NewPBlock(block), initial)
|
name := ethpub.FindNameInNameReg(gui.eth.StateManager(), block.Coinbase)
|
||||||
|
b := ethpub.NewPBlock(block)
|
||||||
|
b.Name = name
|
||||||
|
|
||||||
|
gui.win.Root().Call("addBlock", b, initial)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) setWalletValue(amount, unconfirmedFunds *big.Int) {
|
func (gui *Gui) setWalletValue(amount, unconfirmedFunds *big.Int) {
|
||||||
@@ -262,18 +271,29 @@ func (gui *Gui) setWalletValue(amount, unconfirmedFunds *big.Int) {
|
|||||||
gui.win.Root().Call("setWalletValue", str)
|
gui.win.Root().Call("setWalletValue", str)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *Gui) getObjectByName(objectName string) qml.Object {
|
||||||
|
return self.win.Root().ObjectByName(objectName)
|
||||||
|
}
|
||||||
|
|
||||||
// Simple go routine function that updates the list of peers in the GUI
|
// Simple go routine function that updates the list of peers in the GUI
|
||||||
func (gui *Gui) update() {
|
func (gui *Gui) update() {
|
||||||
reactor := gui.eth.Reactor()
|
reactor := gui.eth.Reactor()
|
||||||
|
|
||||||
blockChan := make(chan ethutil.React, 1)
|
var (
|
||||||
txChan := make(chan ethutil.React, 1)
|
blockChan = make(chan ethutil.React, 1)
|
||||||
objectChan := make(chan ethutil.React, 1)
|
txChan = make(chan ethutil.React, 1)
|
||||||
peerChan := make(chan ethutil.React, 1)
|
objectChan = make(chan ethutil.React, 1)
|
||||||
|
peerChan = make(chan ethutil.React, 1)
|
||||||
|
chainSyncChan = make(chan ethutil.React, 1)
|
||||||
|
miningChan = make(chan ethutil.React, 1)
|
||||||
|
)
|
||||||
|
|
||||||
reactor.Subscribe("newBlock", blockChan)
|
reactor.Subscribe("newBlock", blockChan)
|
||||||
reactor.Subscribe("newTx:pre", txChan)
|
reactor.Subscribe("newTx:pre", txChan)
|
||||||
reactor.Subscribe("newTx:post", txChan)
|
reactor.Subscribe("newTx:post", txChan)
|
||||||
|
reactor.Subscribe("chainSync", chainSyncChan)
|
||||||
|
reactor.Subscribe("miner:start", miningChan)
|
||||||
|
reactor.Subscribe("miner:stop", miningChan)
|
||||||
|
|
||||||
nameReg := ethpub.EthereumConfig(gui.eth.StateManager()).NameReg()
|
nameReg := ethpub.EthereumConfig(gui.eth.StateManager()).NameReg()
|
||||||
if nameReg != nil {
|
if nameReg != nil {
|
||||||
@@ -281,12 +301,16 @@ func (gui *Gui) update() {
|
|||||||
}
|
}
|
||||||
reactor.Subscribe("peerList", peerChan)
|
reactor.Subscribe("peerList", peerChan)
|
||||||
|
|
||||||
ticker := time.NewTicker(5 * time.Second)
|
peerUpdateTicker := time.NewTicker(5 * time.Second)
|
||||||
|
generalUpdateTicker := time.NewTicker(1 * time.Second)
|
||||||
|
|
||||||
state := gui.eth.StateManager().TransState()
|
state := gui.eth.StateManager().TransState()
|
||||||
|
|
||||||
unconfirmedFunds := new(big.Int)
|
unconfirmedFunds := new(big.Int)
|
||||||
gui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(state.GetAccount(gui.address()).Amount)))
|
gui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(state.GetAccount(gui.address()).Amount)))
|
||||||
|
gui.getObjectByName("syncProgressIndicator").Set("visible", !gui.eth.IsUpToDate())
|
||||||
|
|
||||||
|
lastBlockLabel := gui.getObjectByName("lastBlockLabel")
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
@@ -328,12 +352,32 @@ func (gui *Gui) update() {
|
|||||||
|
|
||||||
state.UpdateStateObject(object)
|
state.UpdateStateObject(object)
|
||||||
}
|
}
|
||||||
|
case msg := <-chainSyncChan:
|
||||||
|
sync := msg.Resource.(bool)
|
||||||
|
gui.win.Root().ObjectByName("syncProgressIndicator").Set("visible", sync)
|
||||||
|
|
||||||
case <-objectChan:
|
case <-objectChan:
|
||||||
gui.loadAddressBook()
|
gui.loadAddressBook()
|
||||||
case <-peerChan:
|
case <-peerChan:
|
||||||
gui.setPeerInfo()
|
gui.setPeerInfo()
|
||||||
case <-ticker.C:
|
case <-peerUpdateTicker.C:
|
||||||
gui.setPeerInfo()
|
gui.setPeerInfo()
|
||||||
|
case msg := <-miningChan:
|
||||||
|
if msg.Event == "miner:start" {
|
||||||
|
gui.miner = msg.Resource.(*ethminer.Miner)
|
||||||
|
} else {
|
||||||
|
gui.miner = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
case <-generalUpdateTicker.C:
|
||||||
|
statusText := "#" + gui.eth.BlockChain().CurrentBlock.Number.String()
|
||||||
|
if gui.miner != nil {
|
||||||
|
pow := gui.miner.GetPow()
|
||||||
|
if pow.GetHashrate() != 0 {
|
||||||
|
statusText = "Mining @ " + strconv.FormatInt(pow.GetHashrate(), 10) + "Khash - " + statusText
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lastBlockLabel.Set("text", statusText)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -356,7 +400,7 @@ func (gui *Gui) address() []byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) RegisterName(name string) {
|
func (gui *Gui) RegisterName(name string) {
|
||||||
name = fmt.Sprintf("\"%s\"", name)
|
name = fmt.Sprintf("\"register\"\n\"%s\"", name)
|
||||||
|
|
||||||
gui.pub.Transact(gui.privateKey(), "NameReg", "", "10000", "10000000000000", name)
|
gui.pub.Transact(gui.privateKey(), "NameReg", "", "10000", "10000000000000", name)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
ClientIdentifier = "Ethereal"
|
ClientIdentifier = "Ethereal"
|
||||||
Version = "0.5.16"
|
Version = "0.5.17"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
ClientIdentifier = "Ethereum(G)"
|
ClientIdentifier = "Ethereum(G)"
|
||||||
Version = "0.5.16"
|
Version = "0.5.17"
|
||||||
)
|
)
|
||||||
|
|
||||||
var logger = ethlog.NewLogger("CLI")
|
var logger = ethlog.NewLogger("CLI")
|
||||||
|
|||||||
16
utils/cmd.go
16
utils/cmd.go
@@ -234,7 +234,11 @@ func StartRpc(ethereum *eth.Ethereum, RpcPort int) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var miner ethminer.Miner
|
var miner *ethminer.Miner
|
||||||
|
|
||||||
|
func GetMiner() *ethminer.Miner {
|
||||||
|
return miner
|
||||||
|
}
|
||||||
|
|
||||||
func StartMining(ethereum *eth.Ethereum) bool {
|
func StartMining(ethereum *eth.Ethereum) bool {
|
||||||
if !ethereum.Mining {
|
if !ethereum.Mining {
|
||||||
@@ -243,7 +247,10 @@ func StartMining(ethereum *eth.Ethereum) bool {
|
|||||||
addr := ethereum.KeyManager().Address()
|
addr := ethereum.KeyManager().Address()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
if miner == nil {
|
||||||
miner = ethminer.NewDefaultMiner(addr, ethereum)
|
miner = ethminer.NewDefaultMiner(addr, ethereum)
|
||||||
|
}
|
||||||
|
|
||||||
// Give it some time to connect with peers
|
// Give it some time to connect with peers
|
||||||
time.Sleep(3 * time.Second)
|
time.Sleep(3 * time.Second)
|
||||||
for !ethereum.IsUpToDate() {
|
for !ethereum.IsUpToDate() {
|
||||||
@@ -251,7 +258,6 @@ func StartMining(ethereum *eth.Ethereum) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logger.Infoln("Miner started")
|
logger.Infoln("Miner started")
|
||||||
miner := ethminer.NewDefaultMiner(addr, ethereum)
|
|
||||||
miner.Start()
|
miner.Start()
|
||||||
}()
|
}()
|
||||||
RegisterInterrupt(func(os.Signal) {
|
RegisterInterrupt(func(os.Signal) {
|
||||||
@@ -263,12 +269,16 @@ func StartMining(ethereum *eth.Ethereum) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func StopMining(ethereum *eth.Ethereum) bool {
|
func StopMining(ethereum *eth.Ethereum) bool {
|
||||||
if ethereum.Mining {
|
if ethereum.Mining && miner != nil {
|
||||||
miner.Stop()
|
miner.Stop()
|
||||||
|
|
||||||
logger.Infoln("Miner stopped")
|
logger.Infoln("Miner stopped")
|
||||||
|
|
||||||
ethereum.Mining = false
|
ethereum.Mining = false
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user