Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPC updates #263

Merged
merged 18 commits into from
Jan 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
.#*
*#
*~
.project
.settings
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
[![Bugs](https://badge.waffle.io/ethereum/go-ethereum.png?label=bug&title=Bugs)](https://waffle.io/ethereum/go-ethereum)
[![Stories in Ready](https://badge.waffle.io/ethereum/go-ethereum.png?label=ready&title=Ready)](https://waffle.io/ethereum/go-ethereum)
[![Stories in
Progress](https://badge.waffle.io/ethereum/go-ethereum.svg?label=in%20progress&title=In Progress)](http://waffle.io/ethereum/go-ethereum)
[![Stories in Progress](https://badge.waffle.io/ethereum/go-ethereum.svg?label=in%20progress&title=In Progress)](http://waffle.io/ethereum/go-ethereum)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ethereum/go-ethereum?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

Ethereum

Ethereum PoC-8
========

[![Build
Status](http://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20master%20branch)](http://build.ethdev.com:8010/builders/Linux%20Go%20master%20branch/builds/-1) master [![Build
Status](http://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20develop%20branch)](http://build.ethdev.com:8010/builders/Linux%20Go%20develop%20branch/builds/-1) develop
[![Coverage Status](https://coveralls.io/repos/ethereum/go-ethereum/badge.png?branch=tests)](https://coveralls.io/r/ethereum/go-ethereum?branch=tests) tests
* [![Build Status](http://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20master%20branch)](http://build.ethdev.com:8010/builders/Linux%20Go%20master%20branch/builds/-1) master
* [![Build Status](http://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20develop%20branch)](http://build.ethdev.com:8010/builders/Linux%20Go%20develop%20branch/builds/-1) develop
* [![Travis-ci](https://api.travis-ci.org/ethereum/go-ethereum.svg)](https://travis-ci.org/ethereum/go-ethereum) travis-ci
* [![Coverage Status](https://coveralls.io/repos/ethereum/go-ethereum/badge.png?branch=tests)](https://coveralls.io/r/ethereum/go-ethereum?branch=tests)

Ethereum Go Client © 2014 Jeffrey Wilcke.

Current state: Proof of Concept 0.8

Ethereum is currently in its testing phase.

Build
=====

To build Mist (GUI):
Mist (GUI):

`go get github.com/ethereum/go-ethereum/cmd/mist`

To build the node (CLI):
Ethereum (CLI):

`go get github.com/ethereum/go-ethereum/cmd/ethereum`

Expand All @@ -49,6 +46,8 @@ Go Ethereum comes with several binaries found in
`cat file | ethtest`.
* `evm` is a generic Ethereum Virtual Machine: `evm -code 60ff60ff -gas
10000 -price 0 -dump`. See `-h` for a detailed description.
* `rlpdump` converts a rlp stream to `interface{}`.
* `peerserver` simple P2P (noi-ethereum) peer server.

General command line options
============================
Expand Down Expand Up @@ -125,3 +124,4 @@ expect you to write tests for me so I don't have to test your code
manually. (If you want to contribute by just writing tests that's fine
too!)


4 changes: 3 additions & 1 deletion cmd/mist/assets/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ ApplicationWindow {

mainSplit.setView(wallet.view, wallet.menuItem);

newBrowserTab("http://etherian.io");
console.log(">>>>>>")
newBrowserTab("http://etherian.io");
console.log("WTF")

// Command setup
gui.sendCommand(0)
Expand Down
11 changes: 2 additions & 9 deletions cmd/mist/assets/qml/views/wallet.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ Rectangle {
function setBalance() {
//balance.text = "<b>Balance</b>: " + eth.numberToHuman(eth.balanceAt(eth.key().address))
if(menuItem)
menuItem.secondaryTitle = eth.numberToHuman(eth.balanceAt(eth.key().address))
menuItem.secondaryTitle = eth.numberToHuman("0")
//menuItem.secondaryTitle = eth.numberToHuman(eth.balanceAt(eth.key().address))
}

ListModel {
Expand Down Expand Up @@ -155,14 +156,6 @@ Rectangle {
model: ListModel {
id: txModel
Component.onCompleted: {
var me = eth.key().address;
var filterTo = ethx.watch({latest: -1, to: me});
var filterFrom = ethx.watch({latest: -1, from: me});
filterTo.changed(addTxs)
filterFrom.changed(addTxs)

addTxs(filterTo.messages())
addTxs(filterFrom.messages())
}

function addTxs(messages) {
Expand Down
4 changes: 2 additions & 2 deletions cmd/mist/ext_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type AppContainer interface {
}

type ExtApplication struct {
*xeth.JSXEth
*xeth.XEth
eth core.EthManager

events event.Subscription
Expand All @@ -61,7 +61,7 @@ type ExtApplication struct {

func NewExtApplication(container AppContainer, lib *UiLib) *ExtApplication {
return &ExtApplication{
JSXEth: xeth.NewJSXEth(lib.eth),
XEth: xeth.New(lib.eth),
eth: lib.eth,
watcherQuitChan: make(chan bool),
filters: make(map[string]*core.Filter),
Expand Down
102 changes: 42 additions & 60 deletions cmd/mist/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
"path"
"runtime"
"strconv"
"strings"
"time"

"github.com/ethereum/go-ethereum/core"
Expand Down Expand Up @@ -76,7 +75,7 @@ type Gui struct {
logLevel logger.LogLevel
open bool

xeth *xeth.JSXEth
xeth *xeth.XEth

Session string
clientIdentity *p2p.SimpleClientIdentity
Expand All @@ -94,7 +93,7 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden
panic(err)
}

xeth := xeth.NewJSXEth(ethereum)
xeth := xeth.New(ethereum)
gui := &Gui{eth: ethereum,
txDb: db,
xeth: xeth,
Expand All @@ -121,9 +120,9 @@ func (gui *Gui) Start(assetPath string) {

// Register ethereum functions
qml.RegisterTypes("Ethereum", 1, 0, []qml.TypeSpec{{
Init: func(p *xeth.JSBlock, obj qml.Object) { p.Number = 0; p.Hash = "" },
Init: func(p *xeth.Block, obj qml.Object) { p.Number = 0; p.Hash = "" },
}, {
Init: func(p *xeth.JSTransaction, obj qml.Object) { p.Value = ""; p.Hash = ""; p.Address = "" },
Init: func(p *xeth.Transaction, obj qml.Object) { p.Value = ""; p.Hash = ""; p.Address = "" },
}, {
Init: func(p *xeth.KeyVal, obj qml.Object) { p.Key = ""; p.Value = "" },
}})
Expand Down Expand Up @@ -229,41 +228,44 @@ func (gui *Gui) setInitialChain(ancientBlocks bool) {
}

func (gui *Gui) loadAddressBook() {
view := gui.getObjectByName("infoView")
nameReg := gui.xeth.World().Config().Get("NameReg")
if nameReg != nil {
it := nameReg.Trie().Iterator()
for it.Next() {
if it.Key[0] != 0 {
view.Call("addAddress", struct{ Name, Address string }{string(it.Key), ethutil.Bytes2Hex(it.Value)})
}
/*
view := gui.getObjectByName("infoView")
nameReg := gui.xeth.World().Config().Get("NameReg")
if nameReg != nil {
it := nameReg.Trie().Iterator()
for it.Next() {
if it.Key[0] != 0 {
view.Call("addAddress", struct{ Name, Address string }{string(it.Key), ethutil.Bytes2Hex(it.Value)})
}

}
}
}
*/
}

func (self *Gui) loadMergedMiningOptions() {
view := self.getObjectByName("mergedMiningModel")

mergeMining := self.xeth.World().Config().Get("MergeMining")
if mergeMining != nil {
i := 0
it := mergeMining.Trie().Iterator()
for it.Next() {
view.Call("addMergedMiningOption", struct {
Checked bool
Name, Address string
Id, ItemId int
}{false, string(it.Key), ethutil.Bytes2Hex(it.Value), 0, i})

i++
/*
view := self.getObjectByName("mergedMiningModel")

mergeMining := self.xeth.World().Config().Get("MergeMining")
if mergeMining != nil {
i := 0
it := mergeMining.Trie().Iterator()
for it.Next() {
view.Call("addMergedMiningOption", struct {
Checked bool
Name, Address string
Id, ItemId int
}{false, string(it.Key), ethutil.Bytes2Hex(it.Value), 0, i})

i++

}
}
}
*/
}

func (gui *Gui) insertTransaction(window string, tx *types.Transaction) {
nameReg := gui.xeth.World().Config().Get("NameReg")
addr := gui.address()

var inout string
Expand All @@ -274,32 +276,12 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) {
}

var (
ptx = xeth.NewJSTx(tx)
send = nameReg.Storage(tx.From())
rec = nameReg.Storage(tx.To())
s, r string
ptx = xeth.NewTx(tx)
send = ethutil.Bytes2Hex(tx.From())
rec = ethutil.Bytes2Hex(tx.To())
)

if core.MessageCreatesContract(tx) {
rec = nameReg.Storage(core.AddressFromMessage(tx))
}

if send.Len() != 0 {
s = strings.Trim(send.Str(), "\x00")
} else {
s = ethutil.Bytes2Hex(tx.From())
}
if rec.Len() != 0 {
r = strings.Trim(rec.Str(), "\x00")
} else {
if core.MessageCreatesContract(tx) {
r = ethutil.Bytes2Hex(core.AddressFromMessage(tx))
} else {
r = ethutil.Bytes2Hex(tx.To())
}
}
ptx.Sender = s
ptx.Address = r
ptx.Sender = send
ptx.Address = rec

if window == "post" {
//gui.getObjectByName("transactionView").Call("addTx", ptx, inout)
Expand All @@ -320,8 +302,8 @@ func (gui *Gui) readPreviousTransactions() {
}

func (gui *Gui) processBlock(block *types.Block, initial bool) {
name := strings.Trim(gui.xeth.World().Config().Get("NameReg").Storage(block.Coinbase()).Str(), "\x00")
b := xeth.NewJSBlock(block)
name := ethutil.Bytes2Hex(block.Coinbase())
b := xeth.NewBlock(block)
b.Name = name

gui.getObjectByName("chainView").Call("addBlock", b, initial)
Expand Down Expand Up @@ -531,9 +513,9 @@ NumGC: %d
func (gui *Gui) setPeerInfo() {
gui.win.Root().Call("setPeers", fmt.Sprintf("%d / %d", gui.eth.PeerCount(), gui.eth.MaxPeers))
gui.win.Root().Call("resetPeers")
for _, peer := range gui.xeth.Peers() {
gui.win.Root().Call("addPeer", peer)
}
//for _, peer := range gui.xeth.Peers() {
//gui.win.Root().Call("addPeer", peer)
//}
}

func (gui *Gui) privateKey() string {
Expand Down
2 changes: 1 addition & 1 deletion cmd/mist/html_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (app *HtmlApplication) Window() *qml.Window {
}

func (app *HtmlApplication) NewBlock(block *types.Block) {
b := &xeth.JSBlock{Number: int(block.NumberU64()), Hash: ethutil.Bytes2Hex(block.Hash())}
b := &xeth.Block{Number: int(block.NumberU64()), Hash: ethutil.Bytes2Hex(block.Hash())}
app.webView.Call("onNewBlockCb", b)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/mist/qml_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (app *QmlApplication) NewWatcher(quitChan chan bool) {

// Events
func (app *QmlApplication) NewBlock(block *types.Block) {
pblock := &xeth.JSBlock{Number: int(block.NumberU64()), Hash: ethutil.Bytes2Hex(block.Hash())}
pblock := &xeth.Block{Number: int(block.NumberU64()), Hash: ethutil.Bytes2Hex(block.Hash())}
app.win.Call("onNewBlockCb", pblock)
}

Expand Down
Loading