aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/mist/assets/examples/whisper.html10
-rw-r--r--cmd/mist/assets/html/home.html75
-rw-r--r--cmd/mist/assets/html/logo.pngbin0 -> 12767 bytes
-rw-r--r--cmd/mist/assets/qml/main.qml7
-rw-r--r--cmd/mist/assets/qml/views/chain.qml2
-rw-r--r--cmd/mist/debugger.go12
-rw-r--r--cmd/utils/vm_env.go98
7 files changed, 97 insertions, 107 deletions
diff --git a/cmd/mist/assets/examples/whisper.html b/cmd/mist/assets/examples/whisper.html
index 6a7143eef..ad568f783 100644
--- a/cmd/mist/assets/examples/whisper.html
+++ b/cmd/mist/assets/examples/whisper.html
@@ -10,6 +10,7 @@
<h1>Whisper test</h1>
<button onclick="test()">Send</button>
+<button onclick="test2()">Private send</button>
<table width="100%" id="table">
<tr>
@@ -44,10 +45,19 @@
document.querySelector("#table").innerHTML += "<tr><td colspan='2'>"+JSON.stringify(message)+"</td></tr>";
});
+ var selfWatch = shh.watch({to: id, topics: ["test"]})
+ selfWatch.arrived(function(message) {
+ document.querySelector("#table").innerHTML += "<tr><td>To me</td><td>"+JSON.stringify(message)+"</td></tr>";
+ });
+
function test() {
shh.post({topics: ["test"], payload: web3.fromAscii("test it")});
count();
+ }
+ function test2() {
+ shh.post({to: id, topics: ["test"], payload: web3.fromAscii("Private")});
+ count();
}
function count() {
diff --git a/cmd/mist/assets/html/home.html b/cmd/mist/assets/html/home.html
new file mode 100644
index 000000000..7116f5dde
--- /dev/null
+++ b/cmd/mist/assets/html/home.html
@@ -0,0 +1,75 @@
+<!doctype>
+<html>
+<head>
+<title>Ethereum</title>
+<script type="text/javascript" src="../ext/bignumber.min.js"></script>
+<script type="text/javascript" src="../ext/ethereum.js/dist/ethereum.js"></script>
+<style type="text/css">
+ body {
+ font-family: Helvetica;
+ }
+ div.logo {
+ width: 192px;
+ margin: 40px auto;
+ }
+</style>
+</head>
+<body>
+ <div class="logo"><img src="logo.png"></img></div>
+ <h1>Info</h1>
+
+ <table width="100%">
+ <tr>
+ <td>Block number</td>
+ <td id="number"></td>
+ </tr>
+
+ <tr>
+ <td>Peer count</td>
+ <td id="peer_count"></td>
+ </tr>
+
+ <tr>
+ <td>Accounts</td>
+ <td id="accounts"></td>
+ </tr>
+
+ <tr>
+ <td>Gas price</td>
+ <td id="gas_price"></td>
+ </tr>
+
+ <tr>
+ <td>Mining</td>
+ <td id="mining"></td>
+ </tr>
+
+ <tr>
+ <td>Listening</td>
+ <td id="listening"></td>
+ </tr>
+
+ <tr>
+ <td>Coinbase</td>
+ <td id="coinbase"></td>
+ </tr>
+ </table>
+</body>
+
+<script type="text/javascript">
+ var web3 = require('web3');
+ var eth = web3.eth;
+
+ web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080'));
+
+ document.querySelector("#number").innerHTML = eth.number;
+ document.querySelector("#coinbase").innerHTML = eth.coinbase
+ document.querySelector("#peer_count").innerHTML = eth.peerCount;
+ document.querySelector("#accounts").innerHTML = eth.accounts;
+ document.querySelector("#gas_price").innerHTML = eth.gasPrice;
+ document.querySelector("#mining").innerHTML = eth.mining;
+ document.querySelector("#listening").innerHTML = eth.listening;
+</script>
+
+</html>
+
diff --git a/cmd/mist/assets/html/logo.png b/cmd/mist/assets/html/logo.png
new file mode 100644
index 000000000..28dc9f509
--- /dev/null
+++ b/cmd/mist/assets/html/logo.png
Binary files differ
diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml
index 439f7888c..357e40846 100644
--- a/cmd/mist/assets/qml/main.qml
+++ b/cmd/mist/assets/qml/main.qml
@@ -16,8 +16,7 @@ ApplicationWindow {
width: 1200
height: 820
- minimumHeight: 800
- minimumWidth: 600
+ minimumWidth: 300
title: "Mist"
@@ -45,7 +44,7 @@ ApplicationWindow {
mainSplit.setView(wallet.view, wallet.menuItem);
- newBrowserTab("http://etherian.io");
+ newBrowserTab(eth.assetPath("html/home.html"));
// Command setup
gui.sendCommand(0)
@@ -138,7 +137,7 @@ ApplicationWindow {
text: "New tab"
shortcut: "Ctrl+t"
onTriggered: {
- newBrowserTab("http://etherian.io");
+ newBrowserTab("about:blank");
}
}
diff --git a/cmd/mist/assets/qml/views/chain.qml b/cmd/mist/assets/qml/views/chain.qml
index 6baf757a5..4d1bc0e03 100644
--- a/cmd/mist/assets/qml/views/chain.qml
+++ b/cmd/mist/assets/qml/views/chain.qml
@@ -111,7 +111,7 @@ Rectangle {
if(initial){
blockModel.append({raw: block.raw, bloom: block.bloom, size: block.size, 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 {
- blockModel.insert(0, {bloom: block.bloom, size: block.size, 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)})
+ blockModel.insert(0, {raw: block.raw, bloom: block.bloom, size: block.size, 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)})
}
}
diff --git a/cmd/mist/debugger.go b/cmd/mist/debugger.go
index dc6a39560..c1ab2f3f1 100644
--- a/cmd/mist/debugger.go
+++ b/cmd/mist/debugger.go
@@ -29,6 +29,7 @@ import (
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/core"
+ "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/vm"
@@ -154,14 +155,17 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
block := self.lib.eth.ChainManager().CurrentBlock()
- env := utils.NewEnv(self.lib.eth.ChainManager(), statedb, block, account.Address(), value)
+ msg := types.NewTransactionMessage(nil, value, gas, gasPrice, data)
+ env := core.NewEnv(statedb, self.lib.eth.ChainManager(), msg, block)
self.Logf("callsize %d", len(script))
go func() {
+ pgas := new(big.Int).Set(gas)
ret, err := env.Call(account, contract.Address(), data, gas, gasPrice, ethutil.Big0)
- //ret, g, err := callerClosure.Call(evm, data)
- tot := new(big.Int).Mul(env.Gas, gasPrice)
- self.Logf("gas usage %v total price = %v (%v)", env.Gas, tot, ethutil.CurrencyToString(tot))
+
+ rgas := new(big.Int).Sub(pgas, gas)
+ tot := new(big.Int).Mul(rgas, gasPrice)
+ self.Logf("gas usage %v total price = %v (%v)", rgas, tot, ethutil.CurrencyToString(tot))
if err != nil {
self.Logln("exited with errors:", err)
} else {
diff --git a/cmd/utils/vm_env.go b/cmd/utils/vm_env.go
deleted file mode 100644
index 5eaf63b65..000000000
--- a/cmd/utils/vm_env.go
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- This file is part of go-ethereum
-
- go-ethereum is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- go-ethereum is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
-*/
-/**
- * @authors
- * Jeffrey Wilcke <i@jev.io>
- */
-package utils
-
-import (
- "math/big"
-
- "github.com/ethereum/go-ethereum/core"
- "github.com/ethereum/go-ethereum/core/types"
- "github.com/ethereum/go-ethereum/state"
- "github.com/ethereum/go-ethereum/vm"
-)
-
-type VMEnv struct {
- chain *core.ChainManager
- state *state.StateDB
- block *types.Block
-
- transactor []byte
- value *big.Int
-
- depth int
- Gas *big.Int
-}
-
-func NewEnv(chain *core.ChainManager, state *state.StateDB, block *types.Block, transactor []byte, value *big.Int) *VMEnv {
- return &VMEnv{
- chain: chain,
- state: state,
- block: block,
- transactor: transactor,
- value: value,
- }
-}
-
-func (self *VMEnv) Origin() []byte { return self.transactor }
-func (self *VMEnv) BlockNumber() *big.Int { return self.block.Number() }
-func (self *VMEnv) PrevHash() []byte { return self.block.ParentHash() }
-func (self *VMEnv) Coinbase() []byte { return self.block.Coinbase() }
-func (self *VMEnv) Time() int64 { return self.block.Time() }
-func (self *VMEnv) Difficulty() *big.Int { return self.block.Difficulty() }
-func (self *VMEnv) GasLimit() *big.Int { return self.block.GasLimit() }
-func (self *VMEnv) Value() *big.Int { return self.value }
-func (self *VMEnv) State() *state.StateDB { return self.state }
-func (self *VMEnv) Depth() int { return self.depth }
-func (self *VMEnv) SetDepth(i int) { self.depth = i }
-func (self *VMEnv) GetHash(n uint64) []byte {
- if block := self.chain.GetBlockByNumber(n); block != nil {
- return block.Hash()
- }
-
- return nil
-}
-func (self *VMEnv) AddLog(log state.Log) {
- self.state.AddLog(log)
-}
-func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error {
- return vm.Transfer(from, to, amount)
-}
-
-func (self *VMEnv) vm(addr, data []byte, gas, price, value *big.Int) *core.Execution {
- return core.NewExecution(self, addr, data, gas, price, value)
-}
-
-func (self *VMEnv) Call(caller vm.ContextRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error) {
- exe := self.vm(addr, data, gas, price, value)
- ret, err := exe.Call(addr, caller)
- self.Gas = exe.Gas
-
- return ret, err
-}
-func (self *VMEnv) CallCode(caller vm.ContextRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error) {
- exe := self.vm(caller.Address(), data, gas, price, value)
- return exe.Call(addr, caller)
-}
-
-func (self *VMEnv) Create(caller vm.ContextRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error, vm.ContextRef) {
- exe := self.vm(addr, data, gas, price, value)
- return exe.Create(caller)
-}