From 0bccf1c3cd9576724cbd387922997ebd6bbcf898 Mon Sep 17 00:00:00 2001 From: Maran Date: Wed, 21 May 2014 11:45:19 +0200 Subject: [PATCH 01/53] Wait with mining until up to date --- utils/cmd.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/utils/cmd.go b/utils/cmd.go index f163575da7..28597194ff 100644 --- a/utils/cmd.go +++ b/utils/cmd.go @@ -34,11 +34,10 @@ func DoMining(ethereum *eth.Ethereum) { // Give it some time to connect with peers time.Sleep(3 * time.Second) - /* - for ethereum.IsUpToDate() == false { - time.Sleep(5 * time.Second) - } - */ + for ethereum.IsUpToDate() == false { + time.Sleep(5 * time.Second) + } + ethutil.Config.Log.Infoln("Miner started") miner := ethminer.NewDefaultMiner(addr, ethereum) From 6b115659ca3f5879f27c45723ef567b67133bc93 Mon Sep 17 00:00:00 2001 From: Maran Date: Thu, 22 May 2014 10:27:21 +0200 Subject: [PATCH 02/53] Hide inspector by default --- ethereal/assets/qml/webapp.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethereal/assets/qml/webapp.qml b/ethereal/assets/qml/webapp.qml index f00b045997..d3cffeecab 100644 --- a/ethereal/assets/qml/webapp.qml +++ b/ethereal/assets/qml/webapp.qml @@ -188,7 +188,7 @@ ApplicationWindow { WebView { id: inspector - visible:true + visible: false url: webview.experimental.remoteInspectorUrl anchors { left: root.left From b42c70be9c669ba372ed99d820a5a9e807191619 Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 26 May 2014 00:10:38 +0200 Subject: [PATCH 03/53] Recv send for txs --- ethereal/assets/qml/wallet.qml | 9 ++++----- ethereal/ui/gui.go | 16 +++++++++++----- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 51f064adf1..f23f182f3c 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -85,7 +85,6 @@ ApplicationWindow { //color: "#D9DDE7" color: "#252525" - ColumnLayout { y: 50 anchors.left: parent.left @@ -155,6 +154,7 @@ ApplicationWindow { TableView { id: txTableView anchors.fill: parent + TableViewColumn{ role: "inout" ; title: "" ; width: 40 } TableViewColumn{ role: "value" ; title: "Value" ; width: 100 } TableViewColumn{ role: "address" ; title: "Address" ; width: 430 } TableViewColumn{ role: "contract" ; title: "Contract" ; width: 100 } @@ -404,7 +404,7 @@ ApplicationWindow { anchors.left: aboutIcon.right anchors.leftMargin: 10 font.pointSize: 12 - text: "

Ethereal


Development

Jeffrey Wilcke
Maran Hidskes

Binary Distribution

Jarrad Hope
" + text: "

Ethereal


Development

Jeffrey Wilcke
Maran Hidskes
" } } @@ -429,7 +429,6 @@ ApplicationWindow { } } SplitView { - anchors.fill: parent property var asmModel: ListModel { id: asmModel @@ -524,14 +523,14 @@ ApplicationWindow { walletValueLabel.text = value } - function addTx(tx) { + function addTx(tx, inout) { var isContract if (tx.contract == true){ isContract = "Yes" }else{ isContract = "No" } - txModel.insert(0, {hash: tx.hash, address: tx.address, value: tx.value, contract: isContract}) + txModel.insert(0, {inout: inout, hash: tx.hash, address: tx.address, value: tx.value, contract: isContract}) } function addBlock(block) { diff --git a/ethereal/ui/gui.go b/ethereal/ui/gui.go index 022f192bf7..a8bfb2b581 100644 --- a/ethereal/ui/gui.go +++ b/ethereal/ui/gui.go @@ -151,7 +151,15 @@ func (gui *Gui) readPreviousTransactions() { for it.Next() { tx := ethchain.NewTransactionFromBytes(it.Value()) - gui.win.Root().Call("addTx", ethpub.NewPTx(tx)) + var inout string + if bytes.Compare(tx.Sender(), gui.addr) == 0 { + inout = "send" + } else { + inout = "recv" + } + + gui.win.Root().Call("addTx", ethpub.NewPTx(tx), inout) + } it.Release() } @@ -207,12 +215,12 @@ func (gui *Gui) update() { object := state.GetAccount(gui.addr) if bytes.Compare(tx.Sender(), gui.addr) == 0 { - gui.win.Root().Call("addTx", ethpub.NewPTx(tx)) + gui.win.Root().Call("addTx", ethpub.NewPTx(tx), "send") gui.txDb.Put(tx.Hash(), tx.RlpEncode()) unconfirmedFunds.Sub(unconfirmedFunds, tx.Value) } else if bytes.Compare(tx.Recipient, gui.addr) == 0 { - gui.win.Root().Call("addTx", ethpub.NewPTx(tx)) + gui.win.Root().Call("addTx", ethpub.NewPTx(tx), "recv") gui.txDb.Put(tx.Hash(), tx.RlpEncode()) unconfirmedFunds.Add(unconfirmedFunds, tx.Value) @@ -261,7 +269,5 @@ func (gui *Gui) Transact(recipient, value, gas, gasPrice, data string) (*ethpub. func (gui *Gui) Create(recipient, value, gas, gasPrice, data string) (*ethpub.PReceipt, error) { keyPair := ethutil.GetKeyRing().Get(0) - //mainInput, initInput := mutan.PreParse(data) - return gui.pub.Create(ethutil.Hex(keyPair.PrivateKey), value, gas, gasPrice, data) } From 818bc84591c490b29cb28ee1e4895c8f303a0af1 Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 26 May 2014 00:39:05 +0200 Subject: [PATCH 04/53] Bump --- README.md | 2 +- ethereal/ui/gui.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e5818ffcab..6c19be9aa1 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Ethereum Ethereum Go Client © 2014 Jeffrey Wilcke. -Current state: Proof of Concept 5.0 RC8. +Current state: Proof of Concept 5.0 RC9. For the development package please see the [eth-go package](https://github.com/ethereum/eth-go). diff --git a/ethereal/ui/gui.go b/ethereal/ui/gui.go index a8bfb2b581..8d6796ddbb 100644 --- a/ethereal/ui/gui.go +++ b/ethereal/ui/gui.go @@ -54,7 +54,7 @@ func New(ethereum *eth.Ethereum) *Gui { } func (gui *Gui) Start(assetPath string) { - const version = "0.5.0 RC8" + const version = "0.5.0 RC9" defer gui.txDb.Close() From 5fc6ee6a4acd1db22a38abb4cff5e5196bf1538e Mon Sep 17 00:00:00 2001 From: Maran Date: Mon, 26 May 2014 17:07:20 +0200 Subject: [PATCH 05/53] Implemented simple block/tx explorer --- ethereal/assets/qml/wallet.qml | 139 ++++++++++++++++++++++++++++++--- ethereal/ui/gui.go | 20 +++-- 2 files changed, 139 insertions(+), 20 deletions(-) diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 7a6750f63b..8903fb14f4 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -65,6 +65,7 @@ ApplicationWindow { } function setView(view) { + console.log("Setting view") networkView.visible = false historyView.visible = false newTxView.visible = false @@ -203,16 +204,14 @@ ApplicationWindow { anchors.bottom: logView.top TableViewColumn{ role: "number" ; title: "#" ; width: 100 } TableViewColumn{ role: "hash" ; title: "Hash" ; width: 560 } + TableViewColumn{ role: "txAmount" ; title: "Tx amount" ; width: 100 } model: blockModel - /* - onDoubleClicked: { - popup.visible = true - popup.block = eth.getBlock(blockModel.get(row).hash) - popup.hashLabel.text = popup.block.hash - } - */ + onDoubleClicked: { + popup.visible = true + popup.setDetails(blockModel.get(row)) + } } property var logModel: ListModel { @@ -340,10 +339,107 @@ ApplicationWindow { id: popup visible: false property var block - Label { - id: hashLabel - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter + width: 800 + height: 230 + x: root.x + y: root.y + root.height + Component{ + id: blockDetailsDelegate + Rectangle { + color: "#252525" + width: popup.width + height: 200 + Column { + anchors.leftMargin: 10 + anchors.topMargin: 5 + anchors.top: parent.top + anchors.left: parent.left + Text { text: '

Block details

'; color: "#F2F2F2"} + Text { text: 'Block number: ' + number; color: "#F2F2F2"} + Text { text: 'Hash: ' + hash; color: "#F2F2F2"} + Text { text: 'Block found at: ' + prettyTime; color: "#F2F2F2"} + } + } + } + ListView { + model: singleBlock + delegate: blockDetailsDelegate + anchors.top: parent.top + height: 70 + anchors.leftMargin: 20 + id: listViewThing + Layout.maximumHeight: 40 + } + TableView { + id: txView + anchors.top: listViewThing.bottom + anchors.topMargin: 50 + width: parent.width + + TableViewColumn{width: 90; role: "value" ; title: "Value" } + TableViewColumn{width: 200; role: "hash" ; title: "Hash" } + TableViewColumn{width: 200; role: "sender" ; title: "Sender" } + TableViewColumn{width: 200;role: "address" ; title: "Receiver" } + TableViewColumn{width: 60; role: "gas" ; title: "Gas" } + TableViewColumn{width: 60; role: "gasPrice" ; title: "Gas Price" } + TableViewColumn{width: 60; role: "isContract" ; title: "Contract" } + + model: transactionModel + onClicked: { + var tx = transactionModel.get(row) + if(tx.data) { + popup.showContractData(tx.data) + }else{ + popup.height = 230 + } + } + } + function showContractData(data) { + contractData.text = data + popup.height = 400 + } + Rectangle { + width: popup.width + height: 200 + anchors.left: listViewThing.left + anchors.top: txView.bottom + Label { + text: "

Contract data

" + anchors.top: parent.top + anchors.left: parent.left + id: contractLabel + anchors.leftMargin: 10 + } + TextArea { + id: contractData + text: "Contract" + anchors.top: contractLabel.bottom + anchors.left: parent.left + wrapMode: Text.Wrap + width: parent.width - 30 + height: 80 + anchors.leftMargin: 10 + } + } + property var transactionModel: ListModel { + id: transactionModel + } + property var singleBlock: ListModel { + id: singleBlock + } + function setDetails(block){ + singleBlock.set(0,block) + popup.height = 230 + transactionModel.clear() + if(block.txs != undefined){ + for(var i = 0; i < block.txs.count; ++i) { + transactionModel.insert(0, block.txs.get(i)) + } + if(block.txs.get(0).data){ + popup.showContractData(block.txs.get(0).data) + } + } + txView.forceActiveFocus() } } @@ -474,7 +570,7 @@ ApplicationWindow { } height: parent.height/2 width: parent.width - TableViewColumn{ role: "value" ; title: "Stack" ; width: parent.width } + TableViewColumn{ role: "value" ; title: "Stack"} model: stackModel } } @@ -535,7 +631,12 @@ ApplicationWindow { } function addBlock(block) { - blockModel.insert(0, {number: block.number, hash: block.hash}) + var objtt = JSON.parse(block.transactions); + var amount = 0 + if(objtt != null){ + amount = objtt.length + } + blockModel.insert(0, {number: block.number, hash: block.hash, txs: objtt, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) } function addLog(str) { @@ -547,4 +648,16 @@ ApplicationWindow { function setPeers(text) { peerLabel.text = text } + function convertToPretty(unixTs){ + var a = new Date(unixTs*1000); + var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; + var year = a.getFullYear(); + var month = months[a.getMonth()]; + var date = a.getDate(); + var hour = a.getHours(); + var min = a.getMinutes(); + var sec = a.getSeconds(); + var time = date+' '+month+' '+year+' '+hour+':'+min+':'+sec ; + return time; + } } diff --git a/ethereal/ui/gui.go b/ethereal/ui/gui.go index 8d6796ddbb..794786d97a 100644 --- a/ethereal/ui/gui.go +++ b/ethereal/ui/gui.go @@ -136,14 +136,20 @@ func (gui *Gui) createWindow(comp qml.Object) *qml.Window { return gui.win } - -func (gui *Gui) setInitialBlockChain() { - // Load previous 10 blocks - chain := gui.eth.BlockChain().GetChain(gui.eth.BlockChain().CurrentBlock.Hash(), 10) - for _, block := range chain { - gui.processBlock(block) +func (gui *Gui) recursiveAdd(sBlk []byte) { + blk := gui.eth.BlockChain().GetBlock(sBlk) + if blk != nil { + //ethutil.Config.Log.Infoln("Adding block", blk) + gui.processBlock(blk) + gui.recursiveAdd(blk.PrevHash) + return + } else { + //ethutil.Config.Log.Debugln("At Genesis, added all blocks to GUI") } - + return +} +func (gui *Gui) setInitialBlockChain() { + gui.recursiveAdd(gui.eth.BlockChain().LastBlockHash) } func (gui *Gui) readPreviousTransactions() { From f7eb4e587f83e4472e3d214076ba0c28102daefd Mon Sep 17 00:00:00 2001 From: Maran Date: Mon, 26 May 2014 17:18:34 +0200 Subject: [PATCH 06/53] Remove extra log statement --- ethereal/assets/qml/wallet.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 8903fb14f4..81ad7ef240 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -65,7 +65,6 @@ ApplicationWindow { } function setView(view) { - console.log("Setting view") networkView.visible = false historyView.visible = false newTxView.visible = false From d694e00a3340a36c39872950bb7a2404e9686c18 Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 26 May 2014 21:11:38 +0200 Subject: [PATCH 07/53] Fixed debugger --- ethereal/assets/qml/wallet.qml | 75 +++++++++++++--------- ethereal/assets/samplecoin/samplecoin.html | 2 +- ethereal/ui/gui.go | 2 +- ethereal/ui/ui_lib.go | 32 +++++---- 4 files changed, 64 insertions(+), 47 deletions(-) diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index f23f182f3c..f42cf3b1bc 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -409,7 +409,7 @@ ApplicationWindow { } - Window { + ApplicationWindow { id: debugWindow visible: false title: "Debugger" @@ -447,36 +447,49 @@ ApplicationWindow { orientation: Qt.Vertical anchors.fill: parent - TableView { - property var memModel: ListModel { - id: memModel - } - height: parent.height/2 - width: parent.width - TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50} - TableViewColumn{ role: "value" ; title: "Memory" ; width: 750} - model: memModel - } - - SplitView { - orientation: Qt.Horizontal - TableView { - property var debuggerLog: ListModel { - id: debuggerLog - } - TableViewColumn{ role: "value"; title: "Debug messages" } - model: debuggerLog - } - TableView { - property var stackModel: ListModel { - id: stackModel - } - height: parent.height/2 - width: parent.width - TableViewColumn{ role: "value" ; title: "Stack" ; width: parent.width } - model: stackModel - } - } + TableView { + property var memModel: ListModel { + id: memModel + } + height: parent.height/2 + width: parent.width + TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50} + TableViewColumn{ role: "value" ; title: "Memory" ; width: 750} + model: memModel + } + + SplitView { + orientation: Qt.Horizontal + TableView { + property var debuggerLog: ListModel { + id: debuggerLog + } + TableViewColumn{ role: "value"; title: "Debug messages" } + model: debuggerLog + } + TableView { + property var stackModel: ListModel { + id: stackModel + } + height: parent.height/2 + width: parent.width + TableViewColumn{ role: "value" ; title: "Stack" ; width: parent.width } + model: stackModel + } + } + } + } + } + statusBar: StatusBar { + RowLayout { + anchors.fill: parent + Button { + property var enabled: true + id: debugNextButton + onClicked: { + ui.next() + } + text: "Next" } } } diff --git a/ethereal/assets/samplecoin/samplecoin.html b/ethereal/assets/samplecoin/samplecoin.html index 3892141cd6..e780aefb43 100644 --- a/ethereal/assets/samplecoin/samplecoin.html +++ b/ethereal/assets/samplecoin/samplecoin.html @@ -9,7 +9,7 @@