mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 04:36:42 +00:00
Merge branch 'develop' into no-top-bar
This commit is contained in:
commit
e870dce1a4
48 changed files with 666 additions and 405 deletions
112
README.md
112
README.md
|
|
@ -24,7 +24,25 @@ Ethereum (CLI):
|
||||||
|
|
||||||
`go get github.com/ethereum/go-ethereum/cmd/ethereum`
|
`go get github.com/ethereum/go-ethereum/cmd/ethereum`
|
||||||
|
|
||||||
For further, detailed, build instruction please see the [Wiki](https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum(Go))
|
As of POC-8, go-ethereum uses [Godep](https://github.com/tools/godep) to manage dependencies. Assuming you have [your environment all set up](https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum(Go)), switch to the go-ethereum repository root folder, and build/install the executable you need:
|
||||||
|
|
||||||
|
Mist (GUI):
|
||||||
|
|
||||||
|
```
|
||||||
|
godep go build -v ./cmd/mist
|
||||||
|
```
|
||||||
|
|
||||||
|
Ethereum (CLI):
|
||||||
|
|
||||||
|
```
|
||||||
|
godep go build -v ./cmd/ethereum
|
||||||
|
```
|
||||||
|
|
||||||
|
Instead of `build`, you can use `install` which will also install the resulting binary.
|
||||||
|
|
||||||
|
For prerequisites and detailed build instructions please see the [Wiki](https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum(Go))
|
||||||
|
|
||||||
|
If you intend to develop on go-ethereum, check the [Developers' Guide](https://github.com/ethereum/go-ethereum/wiki/Developers'-Guide)
|
||||||
|
|
||||||
Automated (dev) builds
|
Automated (dev) builds
|
||||||
======================
|
======================
|
||||||
|
|
@ -34,97 +52,47 @@ Automated (dev) builds
|
||||||
* [Windows] Coming soon™
|
* [Windows] Coming soon™
|
||||||
* [Linux] Coming soon™
|
* [Linux] Coming soon™
|
||||||
|
|
||||||
Binaries
|
Executables
|
||||||
========
|
===========
|
||||||
|
|
||||||
Go Ethereum comes with several binaries found in
|
Go Ethereum comes with several wrappers/executables found in
|
||||||
[cmd](https://github.com/ethereum/go-ethereum/tree/master/cmd):
|
[the `cmd` directory](https://github.com/ethereum/go-ethereum/tree/develop/cmd):
|
||||||
|
|
||||||
* `mist` Official Ethereum Browser
|
* `mist` Official Ethereum Browser (ethereum GUI client)
|
||||||
* `ethereum` Ethereum CLI
|
* `ethereum` Ethereum CLI (ethereum command line interface client)
|
||||||
* `ethtest` test tool which runs with the [tests](https://github.com/ethereum/testes) suit:
|
* `bootnode` runs a bootstrap node for the Discovery Protocol
|
||||||
|
* `ethtest` test tool which runs with the [tests](https://github.com/ethereum/testes) suite:
|
||||||
`cat file | ethtest`.
|
`cat file | ethtest`.
|
||||||
* `evm` is a generic Ethereum Virtual Machine: `evm -code 60ff60ff -gas
|
* `evm` is a generic Ethereum Virtual Machine: `evm -code 60ff60ff -gas
|
||||||
10000 -price 0 -dump`. See `-h` for a detailed description.
|
10000 -price 0 -dump`. See `-h` for a detailed description.
|
||||||
* `rlpdump` converts a rlp stream to `interface{}`.
|
|
||||||
* `peerserver` simple P2P (noi-ethereum) peer server.
|
|
||||||
* `disasm` disassembles EVM code: `echo "6001" | disasm`
|
* `disasm` disassembles EVM code: `echo "6001" | disasm`
|
||||||
|
* `rlpdump` converts a rlp stream to `interface{}`.
|
||||||
|
|
||||||
General command line options
|
Command line options
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
Both `mist` and `ethereum` can be configured via command line options, environment variables and config files.
|
||||||
|
|
||||||
|
To get the options available:
|
||||||
|
|
||||||
```
|
```
|
||||||
== Shared between ethereum and Mist ==
|
ethereum -help
|
||||||
|
|
||||||
= Settings
|
|
||||||
-id Set the custom identifier of the client (shows up on other clients)
|
|
||||||
-port Port on which the server will accept incomming connections
|
|
||||||
-upnp Enable UPnP
|
|
||||||
-maxpeer Desired amount of peers
|
|
||||||
-rpc Start JSON RPC
|
|
||||||
-dir Data directory used to store configs and databases
|
|
||||||
|
|
||||||
= Utility
|
|
||||||
-h This
|
|
||||||
-import Import a private key
|
|
||||||
-genaddr Generates a new address and private key (destructive action)
|
|
||||||
-dump Dump a specific state of a block to stdout given the -number or -hash
|
|
||||||
-difftool Supress all output and prints VM output to stdout
|
|
||||||
-diff vm=only vm output, all=all output including state storage
|
|
||||||
|
|
||||||
Ethereum only
|
|
||||||
ethereum [options] [filename]
|
|
||||||
-js Start the JavaScript REPL
|
|
||||||
filename Load the given file and interpret as JavaScript
|
|
||||||
-m Start mining blocks
|
|
||||||
|
|
||||||
== Mist only ==
|
|
||||||
|
|
||||||
-asset_path absolute path to GUI assets directory
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
For further details on options, see the [wiki](https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options)
|
||||||
|
|
||||||
Contribution
|
Contribution
|
||||||
============
|
============
|
||||||
|
|
||||||
If you'd like to contribute to Ethereum please fork, fix, commit and
|
If you'd like to contribute to go-ethereum please fork, fix, commit and
|
||||||
send a pull request. Commits who do not comply with the coding standards
|
send a pull request. Commits who do not comply with the coding standards
|
||||||
are ignored (use gofmt!). If you send pull requests make absolute sure that you
|
are ignored (use gofmt!). If you send pull requests make absolute sure that you
|
||||||
commit on the `develop` branch and that you do not merge to master.
|
commit on the `develop` branch and that you do not merge to master.
|
||||||
Commits that are directly based on master are simply ignored.
|
Commits that are directly based on master are simply ignored.
|
||||||
|
|
||||||
For dependency management, we use [godep](https://github.com/tools/godep). After installing with `go get github.com/tools/godep`, run `godep restore` to ensure that changes to other repositories do not break the build. To update a dependency version (for example, to include a new upstream fix), run `go get -u <foo/bar>` then `godep update <foo/...>`. To track a new dependency, add it to the project as normal than run `godep save ./...`. Changes to the Godeps folder should be manually verified then commited.
|
For dependency management, we use [godep](https://github.com/tools/godep). After installing with `go get github.com/tools/godep`, run `godep restore` to ensure that changes to other repositories do not break the build. To update a dependency version (for example, to include a new upstream fix), run `go get -u <foo/bar>` then `godep update <foo/...>`. To track a new dependency, add it to the project as normal than run `godep save ./...`. Changes to the [Godeps folder](https://github.com/ethereum/go-ethereum/tree/develop/Godeps): should be manually verified then commited.
|
||||||
|
|
||||||
To make life easier try [git flow](http://nvie.com/posts/a-successful-git-branching-model/) it sets
|
To make life easier try [git flow](http://nvie.com/posts/a-successful-git-branching-model/) it sets this all up and streamlines your work flow.
|
||||||
this all up and streamlines your work flow.
|
|
||||||
|
|
||||||
Coding standards
|
|
||||||
================
|
|
||||||
|
|
||||||
Sources should be formatted according to the [Go Formatting
|
|
||||||
Style](http://golang.org/doc/effective_go.html#formatting).
|
|
||||||
|
|
||||||
Unless structs fields are supposed to be directly accesible, provide
|
|
||||||
Getters and hide the fields through Go's exporting facility.
|
|
||||||
|
|
||||||
When you comment put meaningful comments. Describe in detail what you
|
|
||||||
want to achieve.
|
|
||||||
|
|
||||||
*wrong*
|
|
||||||
|
|
||||||
```go
|
|
||||||
// Check if the value at x is greater than y
|
|
||||||
if x > y {
|
|
||||||
// It's greater!
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Everyone reading the source probably know what you wanted to achieve
|
|
||||||
with above code. Those are **not** meaningful comments.
|
|
||||||
|
|
||||||
While the project isn't 100% tested I want you to write tests non the
|
|
||||||
less. I haven't got time to evaluate everyone's code in detail so I
|
|
||||||
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!)
|
|
||||||
|
|
||||||
|
See [Developers' Guide](https://github.com/ethereum/go-ethereum/wiki/Developers'-Guide)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@ var (
|
||||||
StartWebSockets bool
|
StartWebSockets bool
|
||||||
RpcListenAddress string
|
RpcListenAddress string
|
||||||
RpcPort int
|
RpcPort int
|
||||||
WsPort int
|
|
||||||
OutboundPort string
|
OutboundPort string
|
||||||
ShowGenesis bool
|
ShowGenesis bool
|
||||||
AddPeer string
|
AddPeer string
|
||||||
|
|
@ -94,13 +93,11 @@ func Init() {
|
||||||
flag.IntVar(&VmType, "vm", 0, "Virtual Machine type: 0-1: standard, debug")
|
flag.IntVar(&VmType, "vm", 0, "Virtual Machine type: 0-1: standard, debug")
|
||||||
flag.StringVar(&Identifier, "id", "", "Custom client identifier")
|
flag.StringVar(&Identifier, "id", "", "Custom client identifier")
|
||||||
flag.StringVar(&KeyRing, "keyring", "", "identifier for keyring to use")
|
flag.StringVar(&KeyRing, "keyring", "", "identifier for keyring to use")
|
||||||
flag.StringVar(&KeyStore, "keystore", "db", "system to store keyrings: db|file (db)")
|
flag.StringVar(&KeyStore, "keystore", "db", "system to store keyrings: db|file")
|
||||||
|
|
||||||
flag.StringVar(&RpcListenAddress, "rpcaddr", "127.0.0.1", "address for json-rpc server to listen on")
|
flag.StringVar(&RpcListenAddress, "rpcaddr", "127.0.0.1", "address for json-rpc server to listen on")
|
||||||
flag.IntVar(&RpcPort, "rpcport", 8545, "port to start json-rpc server on")
|
flag.IntVar(&RpcPort, "rpcport", 8545, "port to start json-rpc server on")
|
||||||
flag.IntVar(&WsPort, "wsport", 40404, "port to start websocket rpc server on")
|
|
||||||
flag.BoolVar(&StartRpc, "rpc", false, "start rpc server")
|
flag.BoolVar(&StartRpc, "rpc", false, "start rpc server")
|
||||||
flag.BoolVar(&StartWebSockets, "ws", false, "start websocket server")
|
|
||||||
flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)")
|
flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)")
|
||||||
flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key")
|
flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key")
|
||||||
flag.StringVar(&SecretFile, "import", "", "imports the file given (hex or mnemonic formats)")
|
flag.StringVar(&SecretFile, "import", "", "imports the file given (hex or mnemonic formats)")
|
||||||
|
|
@ -109,8 +106,8 @@ func Init() {
|
||||||
flag.StringVar(&Datadir, "datadir", ethutil.DefaultDataDir(), "specifies the datadir to use")
|
flag.StringVar(&Datadir, "datadir", ethutil.DefaultDataDir(), "specifies the datadir to use")
|
||||||
flag.StringVar(&ConfigFile, "conf", defaultConfigFile, "config file")
|
flag.StringVar(&ConfigFile, "conf", defaultConfigFile, "config file")
|
||||||
flag.StringVar(&DebugFile, "debug", "", "debug file (no debugging if not set)")
|
flag.StringVar(&DebugFile, "debug", "", "debug file (no debugging if not set)")
|
||||||
flag.IntVar(&LogLevel, "loglevel", int(logger.InfoLevel), "loglevel: 0-5: silent,error,warn,info,debug,debug detail)")
|
flag.IntVar(&LogLevel, "loglevel", int(logger.InfoLevel), "loglevel: 0-5 (= silent,error,warn,info,debug,debug detail)")
|
||||||
flag.StringVar(&LogFormat, "logformat", "std", "logformat: std,raw)")
|
flag.StringVar(&LogFormat, "logformat", "std", "logformat: std,raw")
|
||||||
flag.BoolVar(&DiffTool, "difftool", false, "creates output for diff'ing. Sets LogLevel=0")
|
flag.BoolVar(&DiffTool, "difftool", false, "creates output for diff'ing. Sets LogLevel=0")
|
||||||
flag.StringVar(&DiffType, "diff", "all", "sets the level of diff output [vm, all]. Has no effect if difftool=false")
|
flag.StringVar(&DiffType, "diff", "all", "sets the level of diff output [vm, all]. Has no effect if difftool=false")
|
||||||
flag.BoolVar(&ShowGenesis, "genesis", false, "Dump the genesis block")
|
flag.BoolVar(&ShowGenesis, "genesis", false, "Dump the genesis block")
|
||||||
|
|
@ -120,7 +117,7 @@ func Init() {
|
||||||
flag.StringVar(&DumpHash, "hash", "", "specify arg in hex")
|
flag.StringVar(&DumpHash, "hash", "", "specify arg in hex")
|
||||||
flag.IntVar(&DumpNumber, "number", -1, "specify arg in number")
|
flag.IntVar(&DumpNumber, "number", -1, "specify arg in number")
|
||||||
|
|
||||||
flag.BoolVar(&StartMining, "mine", false, "start dagger mining")
|
flag.BoolVar(&StartMining, "mine", false, "start mining")
|
||||||
flag.BoolVar(&StartJsConsole, "js", false, "launches javascript console")
|
flag.BoolVar(&StartJsConsole, "js", false, "launches javascript console")
|
||||||
flag.BoolVar(&PrintVersion, "version", false, "prints version number")
|
flag.BoolVar(&PrintVersion, "version", false, "prints version number")
|
||||||
flag.IntVar(&MinerThreads, "minerthreads", runtime.NumCPU(), "number of miner threads")
|
flag.IntVar(&MinerThreads, "minerthreads", runtime.NumCPU(), "number of miner threads")
|
||||||
|
|
|
||||||
|
|
@ -128,10 +128,6 @@ func main() {
|
||||||
utils.StartRpc(ethereum, RpcListenAddress, RpcPort)
|
utils.StartRpc(ethereum, RpcListenAddress, RpcPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
if StartWebSockets {
|
|
||||||
utils.StartWebSockets(ethereum, WsPort)
|
|
||||||
}
|
|
||||||
|
|
||||||
utils.StartEthereum(ethereum)
|
utils.StartEthereum(ethereum)
|
||||||
|
|
||||||
fmt.Printf("Welcome to the FRONTIER\n")
|
fmt.Printf("Welcome to the FRONTIER\n")
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
// this function is included locally, but you can also include separately via a header definition
|
// this function is included locally, but you can also include separately via a header definition
|
||||||
|
|
||||||
console.log("loaded?");
|
|
||||||
|
|
||||||
document.onkeydown = function(evt) {
|
document.onkeydown = function(evt) {
|
||||||
// This functions keeps track of keyboard inputs in order to allow copy, paste and other features
|
// This functions keeps track of keyboard inputs in order to allow copy, paste and other features
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,14 @@ ApplicationWindow {
|
||||||
walletWeb.view.url = "http://ethereum-dapp-wallet.meteor.com/";
|
walletWeb.view.url = "http://ethereum-dapp-wallet.meteor.com/";
|
||||||
walletWeb.menuItem.title = "Wallet";
|
walletWeb.menuItem.title = "Wallet";
|
||||||
|
|
||||||
addPlugin("./views/miner.qml", {noAdd: true, close: false, section: "ethereum", active: false});
|
addPlugin("./views/miner.qml", {noAdd: true, close: false, section: "legacy", active: false});
|
||||||
|
addPlugin("./views/network.qml", {noAdd: true, close: false, section: "ethereum", active: false});
|
||||||
|
|
||||||
|
/* var whisperTab = addPlugin("./views/browser.qml", {noAdd: true, close: true, section: "ethereum", active: false});
|
||||||
|
whisperTab.view.url = "http://ethereum-dapp-whisper-client.meteor.com/";
|
||||||
|
whisperTab.menuItem.title = "Whisper Chat";
|
||||||
|
*/
|
||||||
|
addPlugin("./views/wallet.qml", {noAdd: true, close: false, section: "legacy"});
|
||||||
addPlugin("./views/transaction.qml", {noAdd: true, close: false, section: "legacy"});
|
addPlugin("./views/transaction.qml", {noAdd: true, close: false, section: "legacy"});
|
||||||
addPlugin("./views/whisper.qml", {noAdd: true, close: false, section: "legacy"});
|
addPlugin("./views/whisper.qml", {noAdd: true, close: false, section: "legacy"});
|
||||||
addPlugin("./views/chain.qml", {noAdd: true, close: false, section: "legacy"});
|
addPlugin("./views/chain.qml", {noAdd: true, close: false, section: "legacy"});
|
||||||
|
|
@ -646,6 +653,8 @@ ApplicationWindow {
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: secondary
|
id: secondary
|
||||||
|
//only shows secondary title if there's no badge
|
||||||
|
visible: (badgeContent == "icon" || badgeContent == "number" )? false : true
|
||||||
font.family: sourceSansPro.name
|
font.family: sourceSansPro.name
|
||||||
font.weight: Font.Light
|
font.weight: Font.Light
|
||||||
anchors {
|
anchors {
|
||||||
|
|
@ -889,17 +898,22 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
height: 55
|
height: 19
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
Text {
|
Text {
|
||||||
text: "ETHEREUM"
|
text: "ETHEREUM"
|
||||||
font.family: sourceSansPro.name
|
font.family: sourceSansPro.name
|
||||||
font.weight: Font.DemiBold
|
font.weight: Font.Regular
|
||||||
|
// anchors.top: 20
|
||||||
|
// anchors.left: 16
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left
|
leftMargin: 12
|
||||||
top: parent.verticalCenter
|
topMargin: 4
|
||||||
leftMargin: 16
|
fill: parent
|
||||||
}
|
}
|
||||||
|
// anchors.leftMargin: 16
|
||||||
|
// anchors.topMargin: 16
|
||||||
|
// anchors.verticalCenterOffset: 50
|
||||||
color: "#AAA0A0"
|
color: "#AAA0A0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -915,17 +929,16 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
height: 55
|
height: 19
|
||||||
color: "transparent"
|
color: "#00ff00"
|
||||||
|
visible: (menuApps.children.length > 0)
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: "APPS"
|
text: "APPS"
|
||||||
font.family: sourceSansPro.name
|
font.family: sourceSansPro.name
|
||||||
font.weight: Font.DemiBold
|
font.weight: Font.Regular
|
||||||
anchors {
|
anchors.fill: parent
|
||||||
left: parent.left
|
anchors.leftMargin: 16
|
||||||
top: parent.verticalCenter
|
|
||||||
leftMargin: 16
|
|
||||||
}
|
|
||||||
color: "#AAA0A0"
|
color: "#AAA0A0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -933,6 +946,8 @@ ApplicationWindow {
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: menuApps
|
id: menuApps
|
||||||
spacing: 3
|
spacing: 3
|
||||||
|
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left
|
left: parent.left
|
||||||
right: parent.right
|
right: parent.right
|
||||||
|
|
@ -942,6 +957,7 @@ ApplicationWindow {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
height: 55
|
height: 55
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
visible: true
|
||||||
Text {
|
Text {
|
||||||
text: "DEBUG"
|
text: "DEBUG"
|
||||||
font.family: sourceSansPro.name
|
font.family: sourceSansPro.name
|
||||||
|
|
@ -958,6 +974,7 @@ ApplicationWindow {
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: menuLegacy
|
id: menuLegacy
|
||||||
|
visible: true
|
||||||
spacing: 3
|
spacing: 3
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left
|
left: parent.left
|
||||||
|
|
|
||||||
|
|
@ -24,17 +24,6 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
|
||||||
objectName: "miningLabel"
|
|
||||||
visible: false
|
|
||||||
font.pixelSize: 10
|
|
||||||
anchors.right: lastBlockLabel.left
|
|
||||||
anchors.rightMargin: 5
|
|
||||||
onTextChanged: {
|
|
||||||
menuItem.secondaryTitle = text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
spacing: 10
|
spacing: 10
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,43 @@
|
||||||
|
Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.
|
||||||
|
|
||||||
|
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||||
|
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
|
||||||
|
|
||||||
|
-----------------------------------------------------------
|
||||||
|
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||||
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
PREAMBLE
|
||||||
|
The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others.
|
||||||
|
|
||||||
|
The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives.
|
||||||
|
|
||||||
|
DEFINITIONS
|
||||||
|
"Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation.
|
||||||
|
|
||||||
|
"Reserved Font Name" refers to any names specified as such after the copyright statement(s).
|
||||||
|
|
||||||
|
"Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s).
|
||||||
|
|
||||||
|
"Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment.
|
||||||
|
|
||||||
|
"Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software.
|
||||||
|
|
||||||
|
PERMISSION & CONDITIONS
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions:
|
||||||
|
|
||||||
|
1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself.
|
||||||
|
|
||||||
|
2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user.
|
||||||
|
|
||||||
|
3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users.
|
||||||
|
|
||||||
|
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission.
|
||||||
|
|
||||||
|
5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software.
|
||||||
|
|
||||||
|
TERMINATION
|
||||||
|
This license becomes null and void if any of the above conditions are not met.
|
||||||
|
|
||||||
|
DISCLAIMER
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
30
cmd/mist/assets/qml/views/network-health/index.html
Executable file
30
cmd/mist/assets/qml/views/network-health/index.html
Executable file
|
|
@ -0,0 +1,30 @@
|
||||||
|
<html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Network</title>
|
||||||
|
|
||||||
|
<!-- <base href="/"> -->
|
||||||
|
|
||||||
|
<meta name="description" content="">
|
||||||
|
<meta name="keywords" content="dapp, ethereum">
|
||||||
|
|
||||||
|
<!-- <link rel="icon" href="/favicon.ico" type="image/x-icon"> -->
|
||||||
|
<!-- <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"> -->
|
||||||
|
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||||
|
|
||||||
|
<!-- <link rel="apple-touch-icon" href="/apple-touch-icon-precomposed.png"> -->
|
||||||
|
<!-- <link rel="apple-touch-startup-image" href="/startup.png"> -->
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" type="text/css" class="__meteor-css__" href="529f30ee0ee386c5143b4ccb62073179ca8253c3.css?meteor_css_resource=true">
|
||||||
|
<body>
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript">__meteor_runtime_config__ = {"meteorRelease":"METEOR@1.0.3.1","ROOT_URL":"http://localhost:3000/","ROOT_URL_PATH_PREFIX":"","appId":"e350zy16p3kznipbx5o","autoupdateVersion":"df83a37bd2952ddbb9ba6c5f2a59e9caba02642b","autoupdateVersionRefreshable":"81118ed5fac9ef5f8d55835426179e1e058da42b","autoupdateVersionCordova":"none"};</script>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="205f39107b64acf34cb35d7edb57f47893187a12.js"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
92
cmd/mist/assets/qml/views/network-health/loading.css
Normal file
92
cmd/mist/assets/qml/views/network-health/loading.css
Normal file
|
|
@ -0,0 +1,92 @@
|
||||||
|
body {
|
||||||
|
background-color: #000;
|
||||||
|
font: 16px solid 'Helvetica Neue', sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inject-loading-container {
|
||||||
|
position: relative;
|
||||||
|
padding-top: 20%;
|
||||||
|
/*left: 50%;*/
|
||||||
|
margin: 0 auto;
|
||||||
|
/*max-width: 600px;*/
|
||||||
|
/*margin-left: -300px;*/
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
}
|
||||||
|
.inject-loading-container h1 {
|
||||||
|
text-align: center;
|
||||||
|
font-weight: 300;
|
||||||
|
font-size: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
img.loading-circle {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
|
||||||
|
animation: rotate 1s linear infinite;
|
||||||
|
-moz-animation: rotate 1s linear infinite;
|
||||||
|
-webkit-animation: rotate 1s linear infinite;
|
||||||
|
-ms-animation: rotate 1s linear infinite;
|
||||||
|
|
||||||
|
transform-origin:50% 49.5%;
|
||||||
|
-ms-transform-origin:50% 49.5%; /* IE 9 */
|
||||||
|
-moz-transform-origin:50% 49.5%; /* Chrome, Safari, Opera */
|
||||||
|
-webkit-transform-origin:50% 49.5%; /* Chrome, Safari, Opera */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Keyframes */
|
||||||
|
@-webkit-keyframes rotate {
|
||||||
|
0% {
|
||||||
|
-webkit-transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
opacity: 0.2;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
-webkit-transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@-moz-keyframes rotate {
|
||||||
|
0% {
|
||||||
|
-moz-transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
opacity: 0.2;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
-moz-transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@-o-keyframes rotate {
|
||||||
|
0% {
|
||||||
|
-o-transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
opacity: 0.2;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
-o-transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@-ms-keyframes rotate {
|
||||||
|
0% {
|
||||||
|
-ms-transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
opacity: 0.2;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
-ms-transform-origin: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes rotate {
|
||||||
|
0% {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
opacity: 0.2;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
160
cmd/mist/assets/qml/views/network.qml
Normal file
160
cmd/mist/assets/qml/views/network.qml
Normal file
|
|
@ -0,0 +1,160 @@
|
||||||
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Controls 1.0;
|
||||||
|
import QtQuick.Controls.Styles 1.0
|
||||||
|
import QtQuick.Layouts 1.0;
|
||||||
|
import QtWebEngine 1.0
|
||||||
|
import QtWebEngine.experimental 1.0
|
||||||
|
import QtQuick.Window 2.0;
|
||||||
|
import Ethereum 1.0
|
||||||
|
import Qt.WebSockets 1.0
|
||||||
|
//import "qwebchannel.js" as WebChannel
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: window
|
||||||
|
anchors.fill: parent
|
||||||
|
color: "#00000000"
|
||||||
|
|
||||||
|
property var title: "Network"
|
||||||
|
property var iconSource: "../mining-icon.png"
|
||||||
|
property var menuItem
|
||||||
|
property var hideUrl: true
|
||||||
|
|
||||||
|
property alias url: webview.url
|
||||||
|
property alias windowTitle: webview.title
|
||||||
|
property alias webView: webview
|
||||||
|
|
||||||
|
property var cleanPath: false
|
||||||
|
property var open: function(url) {
|
||||||
|
if(!window.cleanPath) {
|
||||||
|
var uri = url;
|
||||||
|
if(!/.*\:\/\/.*/.test(uri)) {
|
||||||
|
uri = "http://" + uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
var reg = /(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.eth)(.*)/
|
||||||
|
|
||||||
|
if(reg.test(uri)) {
|
||||||
|
uri.replace(reg, function(match, pre, domain, path) {
|
||||||
|
uri = pre;
|
||||||
|
|
||||||
|
var lookup = eth.lookupDomain(domain.substring(0, domain.length - 4));
|
||||||
|
var ip = [];
|
||||||
|
for(var i = 0, l = lookup.length; i < l; i++) {
|
||||||
|
ip.push(lookup.charCodeAt(i))
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ip.length != 0) {
|
||||||
|
uri += lookup;
|
||||||
|
} else {
|
||||||
|
uri += domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
uri += path;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
window.cleanPath = true;
|
||||||
|
|
||||||
|
webview.url = uri;
|
||||||
|
|
||||||
|
//uriNav.text = uri.text.replace(/(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.\w{2,3})(.*)/, "$1$2<span style='color:#CCC'>$3</span>");
|
||||||
|
uriNav.text = uri;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Prevent inf loop.
|
||||||
|
window.cleanPath = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
objectName: "miningLabel"
|
||||||
|
visible: false
|
||||||
|
font.pixelSize: 10
|
||||||
|
anchors.right: lastBlockLabel.left
|
||||||
|
anchors.rightMargin: 5
|
||||||
|
onTextChanged: {
|
||||||
|
menuItem.secondaryTitle = eth.miner().mining()? eth.miner().hashRate() + " Khash" : ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
objectName: "root"
|
||||||
|
id: root
|
||||||
|
anchors.fill: parent
|
||||||
|
state: "inspectorShown"
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
interval: 1000; running: true; repeat: true
|
||||||
|
onTriggered: {
|
||||||
|
webview.runJavaScript("Miner.mining", function(miningSliderValue) {
|
||||||
|
|
||||||
|
// Check if it's mining and set it accordingly
|
||||||
|
if (miningSliderValue > 0 && !eth.miner().mining()) {
|
||||||
|
// If the
|
||||||
|
eth.setGasPrice("10000000000000");
|
||||||
|
eth.miner().start();
|
||||||
|
} else if (miningSliderValue == 0 && eth.miner().mining()) {
|
||||||
|
eth.miner().stop();
|
||||||
|
} else if (eth.miner().mining()) {
|
||||||
|
|
||||||
|
webview.runJavaScript('var miningData = MiningData.findOne(); MiningData.update(miningData._id, {$inc: {totalTimeSpent: 1}}); Miner.hashrate = ' + eth.miner().hashRate() );
|
||||||
|
|
||||||
|
//var miningData = MiningData.findOne(); MiningData.update(miningData._id, {$inc: {totalTimeSpent: 1}});
|
||||||
|
|
||||||
|
} else if (miningSliderValue == "undefined") {
|
||||||
|
|
||||||
|
webview.runJavaScript('Miner.mining = 0' );
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WebEngineView {
|
||||||
|
objectName: "webView"
|
||||||
|
id: webview
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
url: "network-health/index.html"
|
||||||
|
//url: "http://localhost:3000/"
|
||||||
|
|
||||||
|
experimental.settings.javascriptCanAccessClipboard: true
|
||||||
|
|
||||||
|
|
||||||
|
onJavaScriptConsoleMessage: {
|
||||||
|
console.log(sourceID + ":" + lineNumber + ":" + JSON.stringify(message));
|
||||||
|
}
|
||||||
|
|
||||||
|
onLoadingChanged: {
|
||||||
|
if (loadRequest.status == WebEngineView.LoadSucceededStatus) {
|
||||||
|
webview.runJavaScript(eth.readFile("mist.js"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WebEngineView {
|
||||||
|
id: inspector
|
||||||
|
visible: false
|
||||||
|
z:10
|
||||||
|
anchors {
|
||||||
|
left: root.left
|
||||||
|
right: root.right
|
||||||
|
top: root.top
|
||||||
|
bottom: root.bottom
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
name: "inspectorShown"
|
||||||
|
PropertyChanges {
|
||||||
|
target: inspector
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -24,7 +24,6 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/core"
|
"github.com/ethereum/go-ethereum/core"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/event"
|
"github.com/ethereum/go-ethereum/event"
|
||||||
"github.com/ethereum/go-ethereum/ui/qt"
|
|
||||||
"github.com/ethereum/go-ethereum/xeth"
|
"github.com/ethereum/go-ethereum/xeth"
|
||||||
"github.com/obscuren/qml"
|
"github.com/obscuren/qml"
|
||||||
)
|
)
|
||||||
|
|
@ -116,7 +115,3 @@ func (app *ExtApplication) mainLoop() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *ExtApplication) Watch(filterOptions map[string]interface{}, identifier string) {
|
|
||||||
self.filters[identifier] = qt.NewFilterFromMap(filterOptions, self.eth)
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -41,10 +41,8 @@ var (
|
||||||
KeyRing string
|
KeyRing string
|
||||||
KeyStore string
|
KeyStore string
|
||||||
StartRpc bool
|
StartRpc bool
|
||||||
StartWebSockets bool
|
|
||||||
RpcListenAddress string
|
RpcListenAddress string
|
||||||
RpcPort int
|
RpcPort int
|
||||||
WsPort int
|
|
||||||
OutboundPort string
|
OutboundPort string
|
||||||
ShowGenesis bool
|
ShowGenesis bool
|
||||||
AddPeer string
|
AddPeer string
|
||||||
|
|
@ -79,12 +77,10 @@ func Init() {
|
||||||
flag.IntVar(&VmType, "vm", 0, "Virtual Machine type: 0-1: standard, debug")
|
flag.IntVar(&VmType, "vm", 0, "Virtual Machine type: 0-1: standard, debug")
|
||||||
flag.StringVar(&Identifier, "id", "", "Custom client identifier")
|
flag.StringVar(&Identifier, "id", "", "Custom client identifier")
|
||||||
flag.StringVar(&KeyRing, "keyring", "", "identifier for keyring to use")
|
flag.StringVar(&KeyRing, "keyring", "", "identifier for keyring to use")
|
||||||
flag.StringVar(&KeyStore, "keystore", "db", "system to store keyrings: db|file (db)")
|
flag.StringVar(&KeyStore, "keystore", "db", "system to store keyrings: db|file")
|
||||||
flag.StringVar(&RpcListenAddress, "rpcaddr", "127.0.0.1", "address for json-rpc server to listen on")
|
flag.StringVar(&RpcListenAddress, "rpcaddr", "127.0.0.1", "address for json-rpc server to listen on")
|
||||||
flag.IntVar(&RpcPort, "rpcport", 8545, "port to start json-rpc server on")
|
flag.IntVar(&RpcPort, "rpcport", 8545, "port to start json-rpc server on")
|
||||||
flag.IntVar(&WsPort, "wsport", 40404, "port to start websocket rpc server on")
|
|
||||||
flag.BoolVar(&StartRpc, "rpc", true, "start rpc server")
|
flag.BoolVar(&StartRpc, "rpc", true, "start rpc server")
|
||||||
flag.BoolVar(&StartWebSockets, "ws", false, "start websocket server")
|
|
||||||
flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)")
|
flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)")
|
||||||
flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key")
|
flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key")
|
||||||
flag.StringVar(&SecretFile, "import", "", "imports the file given (hex or mnemonic formats)")
|
flag.StringVar(&SecretFile, "import", "", "imports the file given (hex or mnemonic formats)")
|
||||||
|
|
@ -93,7 +89,7 @@ func Init() {
|
||||||
flag.StringVar(&Datadir, "datadir", ethutil.DefaultDataDir(), "specifies the datadir to use")
|
flag.StringVar(&Datadir, "datadir", ethutil.DefaultDataDir(), "specifies the datadir to use")
|
||||||
flag.StringVar(&ConfigFile, "conf", defaultConfigFile, "config file")
|
flag.StringVar(&ConfigFile, "conf", defaultConfigFile, "config file")
|
||||||
flag.StringVar(&DebugFile, "debug", "", "debug file (no debugging if not set)")
|
flag.StringVar(&DebugFile, "debug", "", "debug file (no debugging if not set)")
|
||||||
flag.IntVar(&LogLevel, "loglevel", int(logger.InfoLevel), "loglevel: 0-5: silent,error,warn,info,debug,debug detail)")
|
flag.IntVar(&LogLevel, "loglevel", int(logger.InfoLevel), "loglevel: 0-5 (= silent,error,warn,info,debug,debug detail)")
|
||||||
|
|
||||||
flag.StringVar(&AssetPath, "asset_path", ethutil.DefaultAssetPath(), "absolute path to GUI assets directory")
|
flag.StringVar(&AssetPath, "asset_path", ethutil.DefaultAssetPath(), "absolute path to GUI assets directory")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ import (
|
||||||
"path"
|
"path"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/core"
|
"github.com/ethereum/go-ethereum/core"
|
||||||
|
|
@ -388,7 +387,7 @@ func (gui *Gui) update() {
|
||||||
statsUpdateTicker := time.NewTicker(5 * time.Second)
|
statsUpdateTicker := time.NewTicker(5 * time.Second)
|
||||||
|
|
||||||
lastBlockLabel := gui.getObjectByName("lastBlockLabel")
|
lastBlockLabel := gui.getObjectByName("lastBlockLabel")
|
||||||
miningLabel := gui.getObjectByName("miningLabel")
|
//miningLabel := gui.getObjectByName("miningLabel")
|
||||||
|
|
||||||
events := gui.eth.EventMux().Subscribe(
|
events := gui.eth.EventMux().Subscribe(
|
||||||
core.ChainEvent{},
|
core.ChainEvent{},
|
||||||
|
|
@ -419,8 +418,7 @@ func (gui *Gui) update() {
|
||||||
case <-generalUpdateTicker.C:
|
case <-generalUpdateTicker.C:
|
||||||
statusText := "#" + gui.eth.ChainManager().CurrentBlock().Number().String()
|
statusText := "#" + gui.eth.ChainManager().CurrentBlock().Number().String()
|
||||||
lastBlockLabel.Set("text", statusText)
|
lastBlockLabel.Set("text", statusText)
|
||||||
miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.Miner().HashRate(), 10)+"/Khash")
|
//miningLabel.Set("text", strconv.FormatInt(gui.uiLib.Miner().HashRate(), 10))
|
||||||
|
|
||||||
case <-statsUpdateTicker.C:
|
case <-statsUpdateTicker.C:
|
||||||
gui.setStatsPane()
|
gui.setStatsPane()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,10 +76,6 @@ func run() error {
|
||||||
utils.StartRpc(ethereum, RpcListenAddress, RpcPort)
|
utils.StartRpc(ethereum, RpcListenAddress, RpcPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
if StartWebSockets {
|
|
||||||
utils.StartWebSockets(ethereum, WsPort)
|
|
||||||
}
|
|
||||||
|
|
||||||
gui := NewWindow(ethereum, config, KeyRing, LogLevel)
|
gui := NewWindow(ethereum, config, KeyRing, LogLevel)
|
||||||
|
|
||||||
utils.RegisterInterrupt(func(os.Signal) {
|
utils.RegisterInterrupt(func(os.Signal) {
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/miner"
|
"github.com/ethereum/go-ethereum/miner"
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
rpchttp "github.com/ethereum/go-ethereum/rpc/http"
|
rpchttp "github.com/ethereum/go-ethereum/rpc/http"
|
||||||
rpcws "github.com/ethereum/go-ethereum/rpc/ws"
|
|
||||||
"github.com/ethereum/go-ethereum/state"
|
"github.com/ethereum/go-ethereum/state"
|
||||||
"github.com/ethereum/go-ethereum/xeth"
|
"github.com/ethereum/go-ethereum/xeth"
|
||||||
)
|
)
|
||||||
|
|
@ -170,18 +169,6 @@ func StartRpc(ethereum *eth.Ethereum, RpcListenAddress string, RpcPort int) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func StartWebSockets(eth *eth.Ethereum, wsPort int) {
|
|
||||||
clilogger.Infoln("Starting WebSockets")
|
|
||||||
|
|
||||||
var err error
|
|
||||||
eth.WsServer, err = rpcws.NewWebSocketServer(xeth.New(eth), wsPort)
|
|
||||||
if err != nil {
|
|
||||||
clilogger.Errorf("Could not start RPC interface (port %v): %v", wsPort, err)
|
|
||||||
} else {
|
|
||||||
go eth.WsServer.Start()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var gminer *miner.Miner
|
var gminer *miner.Miner
|
||||||
|
|
||||||
func GetMiner() *miner.Miner {
|
func GetMiner() *miner.Miner {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/ethdb"
|
"github.com/ethereum/go-ethereum/ethdb"
|
||||||
"github.com/ethereum/go-ethereum/ethutil"
|
"github.com/ethereum/go-ethereum/ethutil"
|
||||||
"github.com/ethereum/go-ethereum/event"
|
"github.com/ethereum/go-ethereum/event"
|
||||||
ethlogger "github.com/ethereum/go-ethereum/logger"
|
"github.com/ethereum/go-ethereum/logger"
|
||||||
"github.com/ethereum/go-ethereum/miner"
|
"github.com/ethereum/go-ethereum/miner"
|
||||||
"github.com/ethereum/go-ethereum/p2p"
|
"github.com/ethereum/go-ethereum/p2p"
|
||||||
"github.com/ethereum/go-ethereum/p2p/discover"
|
"github.com/ethereum/go-ethereum/p2p/discover"
|
||||||
|
|
@ -23,8 +23,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
logger = ethlogger.NewLogger("SERV")
|
ethlogger = logger.NewLogger("SERV")
|
||||||
jsonlogger = ethlogger.NewJsonLogger()
|
jsonlogger = logger.NewJsonLogger()
|
||||||
|
|
||||||
defaultBootNodes = []*discover.Node{
|
defaultBootNodes = []*discover.Node{
|
||||||
// ETH/DEV cmd/bootnode
|
// ETH/DEV cmd/bootnode
|
||||||
|
|
@ -74,7 +74,7 @@ func (cfg *Config) parseBootNodes() []*discover.Node {
|
||||||
}
|
}
|
||||||
n, err := discover.ParseNode(url)
|
n, err := discover.ParseNode(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorf("Bootstrap URL %s: %v\n", url, err)
|
ethlogger.Errorf("Bootstrap URL %s: %v\n", url, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ns = append(ns, n)
|
ns = append(ns, n)
|
||||||
|
|
@ -98,7 +98,7 @@ func (cfg *Config) nodeKey() (*ecdsa.PrivateKey, error) {
|
||||||
return nil, fmt.Errorf("could not generate server key: %v", err)
|
return nil, fmt.Errorf("could not generate server key: %v", err)
|
||||||
}
|
}
|
||||||
if err := ioutil.WriteFile(keyfile, crypto.FromECDSA(key), 0600); err != nil {
|
if err := ioutil.WriteFile(keyfile, crypto.FromECDSA(key), 0600); err != nil {
|
||||||
logger.Errorln("could not persist nodekey: ", err)
|
ethlogger.Errorln("could not persist nodekey: ", err)
|
||||||
}
|
}
|
||||||
return key, nil
|
return key, nil
|
||||||
}
|
}
|
||||||
|
|
@ -127,17 +127,16 @@ type Ethereum struct {
|
||||||
miner *miner.Miner
|
miner *miner.Miner
|
||||||
|
|
||||||
RpcServer rpc.RpcServer
|
RpcServer rpc.RpcServer
|
||||||
WsServer rpc.RpcServer
|
|
||||||
keyManager *crypto.KeyManager
|
keyManager *crypto.KeyManager
|
||||||
|
|
||||||
logger ethlogger.LogSystem
|
logger logger.LogSystem
|
||||||
|
|
||||||
Mining bool
|
Mining bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(config *Config) (*Ethereum, error) {
|
func New(config *Config) (*Ethereum, error) {
|
||||||
// Boostrap database
|
// Boostrap database
|
||||||
logger := ethlogger.New(config.DataDir, config.LogFile, config.LogLevel, config.LogFormat)
|
ethlogger := logger.New(config.DataDir, config.LogFile, config.LogLevel, config.LogFormat)
|
||||||
db, err := ethdb.NewLDBDatabase("blockchain")
|
db, err := ethdb.NewLDBDatabase("blockchain")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
@ -147,7 +146,7 @@ func New(config *Config) (*Ethereum, error) {
|
||||||
d, _ := db.Get([]byte("ProtocolVersion"))
|
d, _ := db.Get([]byte("ProtocolVersion"))
|
||||||
protov := ethutil.NewValue(d).Uint()
|
protov := ethutil.NewValue(d).Uint()
|
||||||
if protov != ProtocolVersion && protov != 0 {
|
if protov != ProtocolVersion && protov != 0 {
|
||||||
path := path.Join(config.DataDir, "database")
|
path := path.Join(config.DataDir, "blockchain")
|
||||||
return nil, fmt.Errorf("Database version mismatch. Protocol(%d / %d). `rm -rf %s`", protov, ProtocolVersion, path)
|
return nil, fmt.Errorf("Database version mismatch. Protocol(%d / %d). `rm -rf %s`", protov, ProtocolVersion, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -174,7 +173,7 @@ func New(config *Config) (*Ethereum, error) {
|
||||||
keyManager: keyManager,
|
keyManager: keyManager,
|
||||||
blacklist: p2p.NewBlacklist(),
|
blacklist: p2p.NewBlacklist(),
|
||||||
eventMux: &event.TypeMux{},
|
eventMux: &event.TypeMux{},
|
||||||
logger: logger,
|
logger: ethlogger,
|
||||||
}
|
}
|
||||||
|
|
||||||
eth.chainManager = core.NewChainManager(db, eth.EventMux())
|
eth.chainManager = core.NewChainManager(db, eth.EventMux())
|
||||||
|
|
@ -216,7 +215,7 @@ func New(config *Config) (*Ethereum, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Ethereum) KeyManager() *crypto.KeyManager { return s.keyManager }
|
func (s *Ethereum) KeyManager() *crypto.KeyManager { return s.keyManager }
|
||||||
func (s *Ethereum) Logger() ethlogger.LogSystem { return s.logger }
|
func (s *Ethereum) Logger() logger.LogSystem { return s.logger }
|
||||||
func (s *Ethereum) Name() string { return s.net.Name }
|
func (s *Ethereum) Name() string { return s.net.Name }
|
||||||
func (s *Ethereum) ChainManager() *core.ChainManager { return s.chainManager }
|
func (s *Ethereum) ChainManager() *core.ChainManager { return s.chainManager }
|
||||||
func (s *Ethereum) BlockProcessor() *core.BlockProcessor { return s.blockProcessor }
|
func (s *Ethereum) BlockProcessor() *core.BlockProcessor { return s.blockProcessor }
|
||||||
|
|
@ -234,7 +233,7 @@ func (s *Ethereum) Coinbase() []byte { return nil } // TODO
|
||||||
|
|
||||||
// Start the ethereum
|
// Start the ethereum
|
||||||
func (s *Ethereum) Start() error {
|
func (s *Ethereum) Start() error {
|
||||||
jsonlogger.LogJson(ðlogger.LogStarting{
|
jsonlogger.LogJson(&logger.LogStarting{
|
||||||
ClientString: s.net.Name,
|
ClientString: s.net.Name,
|
||||||
ProtocolVersion: ProtocolVersion,
|
ProtocolVersion: ProtocolVersion,
|
||||||
})
|
})
|
||||||
|
|
@ -260,7 +259,7 @@ func (s *Ethereum) Start() error {
|
||||||
s.blockSub = s.eventMux.Subscribe(core.NewMinedBlockEvent{})
|
s.blockSub = s.eventMux.Subscribe(core.NewMinedBlockEvent{})
|
||||||
go s.blockBroadcastLoop()
|
go s.blockBroadcastLoop()
|
||||||
|
|
||||||
logger.Infoln("Server started")
|
ethlogger.Infoln("Server started")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -285,9 +284,7 @@ func (s *Ethereum) Stop() {
|
||||||
if s.RpcServer != nil {
|
if s.RpcServer != nil {
|
||||||
s.RpcServer.Stop()
|
s.RpcServer.Stop()
|
||||||
}
|
}
|
||||||
if s.WsServer != nil {
|
|
||||||
s.WsServer.Stop()
|
|
||||||
}
|
|
||||||
s.txPool.Stop()
|
s.txPool.Stop()
|
||||||
s.eventMux.Stop()
|
s.eventMux.Stop()
|
||||||
s.blockPool.Stop()
|
s.blockPool.Stop()
|
||||||
|
|
@ -295,7 +292,7 @@ func (s *Ethereum) Stop() {
|
||||||
s.whisper.Stop()
|
s.whisper.Stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Infoln("Server stopped")
|
ethlogger.Infoln("Server stopped")
|
||||||
close(s.shutdownChan)
|
close(s.shutdownChan)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,11 @@ import (
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/ethutil"
|
"github.com/ethereum/go-ethereum/ethutil"
|
||||||
ethlogger "github.com/ethereum/go-ethereum/logger"
|
"github.com/ethereum/go-ethereum/logger"
|
||||||
"github.com/ethereum/go-ethereum/pow"
|
"github.com/ethereum/go-ethereum/pow"
|
||||||
)
|
)
|
||||||
|
|
||||||
var poolLogger = ethlogger.NewLogger("Blockpool")
|
var poolLogger = logger.NewLogger("Blockpool")
|
||||||
|
|
||||||
const (
|
const (
|
||||||
blockHashesBatchSize = 256
|
blockHashesBatchSize = 256
|
||||||
|
|
|
||||||
|
|
@ -12,19 +12,19 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/ethutil"
|
"github.com/ethereum/go-ethereum/ethutil"
|
||||||
ethlogger "github.com/ethereum/go-ethereum/logger"
|
"github.com/ethereum/go-ethereum/logger"
|
||||||
"github.com/ethereum/go-ethereum/pow"
|
"github.com/ethereum/go-ethereum/pow"
|
||||||
)
|
)
|
||||||
|
|
||||||
const waitTimeout = 60 // seconds
|
const waitTimeout = 60 // seconds
|
||||||
|
|
||||||
var logsys = ethlogger.NewStdLogSystem(os.Stdout, log.LstdFlags, ethlogger.LogLevel(ethlogger.DebugDetailLevel))
|
var logsys = logger.NewStdLogSystem(os.Stdout, log.LstdFlags, logger.LogLevel(logger.DebugDetailLevel))
|
||||||
|
|
||||||
var ini = false
|
var ini = false
|
||||||
|
|
||||||
func logInit() {
|
func logInit() {
|
||||||
if !ini {
|
if !ini {
|
||||||
ethlogger.AddLogSystem(logsys)
|
logger.AddLogSystem(logsys)
|
||||||
ini = true
|
ini = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import (
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/ethutil"
|
"github.com/ethereum/go-ethereum/ethutil"
|
||||||
|
"github.com/ethereum/go-ethereum/logger"
|
||||||
"github.com/ethereum/go-ethereum/p2p"
|
"github.com/ethereum/go-ethereum/p2p"
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
)
|
)
|
||||||
|
|
@ -137,6 +138,12 @@ func (self *ethProtocol) handle() error {
|
||||||
if err := msg.Decode(&txs); err != nil {
|
if err := msg.Decode(&txs); err != nil {
|
||||||
return self.protoError(ErrDecode, "msg %v: %v", msg, err)
|
return self.protoError(ErrDecode, "msg %v: %v", msg, err)
|
||||||
}
|
}
|
||||||
|
for _, tx := range txs {
|
||||||
|
jsonlogger.LogJson(&logger.EthTxReceived{
|
||||||
|
TxHash: ethutil.Bytes2Hex(tx.Hash()),
|
||||||
|
RemoteId: self.peer.ID().String(),
|
||||||
|
})
|
||||||
|
}
|
||||||
self.txPool.AddTransactions(txs)
|
self.txPool.AddTransactions(txs)
|
||||||
|
|
||||||
case GetBlockHashesMsg:
|
case GetBlockHashesMsg:
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,12 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/ethutil"
|
"github.com/ethereum/go-ethereum/ethutil"
|
||||||
ethlogger "github.com/ethereum/go-ethereum/logger"
|
"github.com/ethereum/go-ethereum/logger"
|
||||||
"github.com/ethereum/go-ethereum/p2p"
|
"github.com/ethereum/go-ethereum/p2p"
|
||||||
"github.com/ethereum/go-ethereum/p2p/discover"
|
"github.com/ethereum/go-ethereum/p2p/discover"
|
||||||
)
|
)
|
||||||
|
|
||||||
var sys = ethlogger.NewStdLogSystem(os.Stdout, log.LstdFlags, ethlogger.LogLevel(ethlogger.DebugDetailLevel))
|
var sys = logger.NewStdLogSystem(os.Stdout, log.LstdFlags, logger.LogLevel(logger.DebugDetailLevel))
|
||||||
|
|
||||||
type testMsgReadWriter struct {
|
type testMsgReadWriter struct {
|
||||||
in chan p2p.Msg
|
in chan p2p.Msg
|
||||||
|
|
|
||||||
53
install.sh
53
install.sh
|
|
@ -1,53 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
if [ "$1" == "" ]; then
|
|
||||||
echo "Usage $0 executable branch"
|
|
||||||
echo "executable ethereum | mist"
|
|
||||||
echo "branch develop | master"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
exe=$1
|
|
||||||
path=$exe
|
|
||||||
branch=$2
|
|
||||||
|
|
||||||
if [ "$branch" == "develop" ]; then
|
|
||||||
path="cmd/$exe"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Test if go is installed
|
|
||||||
command -v go >/dev/null 2>&1 || { echo >&2 "Unable to find 'go'. This script requires go."; exit 1; }
|
|
||||||
|
|
||||||
# Test if $GOPATH is set
|
|
||||||
if [ "$GOPATH" == "" ]; then
|
|
||||||
echo "\$GOPATH not set"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "changing branch to $branch"
|
|
||||||
cd $GOPATH/src/github.com/ethereum/go-ethereum
|
|
||||||
git checkout $branch
|
|
||||||
|
|
||||||
# installing package dependencies doesn't work for develop
|
|
||||||
# branch as go get always pulls from master head
|
|
||||||
# so build will continue to fail, but this installs locally
|
|
||||||
# for people who git clone since go install will manage deps
|
|
||||||
|
|
||||||
#echo "go get -u -d github.com/ethereum/go-ethereum/$path"
|
|
||||||
#go get -v -u -d github.com/ethereum/go-ethereum/$path
|
|
||||||
#if [ $? != 0 ]; then
|
|
||||||
# echo "go get failed"
|
|
||||||
# exit
|
|
||||||
#fi
|
|
||||||
|
|
||||||
cd $GOPATH/src/github.com/ethereum/go-ethereum/$path
|
|
||||||
|
|
||||||
if [ "$exe" == "mist" ]; then
|
|
||||||
echo "Building Mist GUI. Assuming Qt is installed. If this step"
|
|
||||||
echo "fails; please refer to: https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum(Go)"
|
|
||||||
else
|
|
||||||
echo "Building ethereum CLI."
|
|
||||||
fi
|
|
||||||
|
|
||||||
go install
|
|
||||||
echo "done. Please run $exe :-)"
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package logger
|
package logger
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"math/big"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -54,7 +55,7 @@ func (l *P2PDisconnected) EventName() string {
|
||||||
|
|
||||||
type EthMinerNewBlock struct {
|
type EthMinerNewBlock struct {
|
||||||
BlockHash string `json:"block_hash"`
|
BlockHash string `json:"block_hash"`
|
||||||
BlockNumber int `json:"block_number"`
|
BlockNumber *big.Int `json:"block_number"`
|
||||||
ChainHeadHash string `json:"chain_head_hash"`
|
ChainHeadHash string `json:"chain_head_hash"`
|
||||||
BlockPrevHash string `json:"block_prev_hash"`
|
BlockPrevHash string `json:"block_prev_hash"`
|
||||||
LogEvent
|
LogEvent
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,14 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/ethutil"
|
"github.com/ethereum/go-ethereum/ethutil"
|
||||||
"github.com/ethereum/go-ethereum/event"
|
"github.com/ethereum/go-ethereum/event"
|
||||||
|
"github.com/ethereum/go-ethereum/logger"
|
||||||
"github.com/ethereum/go-ethereum/pow"
|
"github.com/ethereum/go-ethereum/pow"
|
||||||
"github.com/ethereum/go-ethereum/state"
|
"github.com/ethereum/go-ethereum/state"
|
||||||
"gopkg.in/fatih/set.v0"
|
"gopkg.in/fatih/set.v0"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var jsonlogger = logger.NewJsonLogger()
|
||||||
|
|
||||||
type environment struct {
|
type environment struct {
|
||||||
totalUsedGas *big.Int
|
totalUsedGas *big.Int
|
||||||
state *state.StateDB
|
state *state.StateDB
|
||||||
|
|
@ -146,7 +149,12 @@ func (self *worker) wait() {
|
||||||
block := self.current.block
|
block := self.current.block
|
||||||
if block.Number().Uint64() == work.Number && block.Nonce() == nil {
|
if block.Number().Uint64() == work.Number && block.Nonce() == nil {
|
||||||
self.current.block.Header().Nonce = work.Nonce
|
self.current.block.Header().Nonce = work.Nonce
|
||||||
|
jsonlogger.LogJson(&logger.EthMinerNewBlock{
|
||||||
|
BlockHash: ethutil.Bytes2Hex(block.Hash()),
|
||||||
|
BlockNumber: block.Number(),
|
||||||
|
ChainHeadHash: ethutil.Bytes2Hex(block.ParentHeaderHash),
|
||||||
|
BlockPrevHash: ethutil.Bytes2Hex(block.ParentHeaderHash),
|
||||||
|
})
|
||||||
if err := self.chain.InsertChain(types.Blocks{self.current.block}); err == nil {
|
if err := self.chain.InsertChain(types.Blocks{self.current.block}); err == nil {
|
||||||
self.mux.Post(core.NewMinedBlockEvent{self.current.block})
|
self.mux.Post(core.NewMinedBlockEvent{self.current.block})
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
121
rpc/ws/server.go
121
rpc/ws/server.go
|
|
@ -1,121 +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/>.
|
|
||||||
*/
|
|
||||||
package rpcws
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"net"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/logger"
|
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
|
||||||
"github.com/ethereum/go-ethereum/xeth"
|
|
||||||
"golang.org/x/net/websocket"
|
|
||||||
)
|
|
||||||
|
|
||||||
var wslogger = logger.NewLogger("RPC-WS")
|
|
||||||
var JSON rpc.JsonWrapper
|
|
||||||
|
|
||||||
type WebSocketServer struct {
|
|
||||||
pipe *xeth.XEth
|
|
||||||
port int
|
|
||||||
doneCh chan bool
|
|
||||||
listener net.Listener
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewWebSocketServer(pipe *xeth.XEth, port int) (*WebSocketServer, error) {
|
|
||||||
sport := fmt.Sprintf(":%d", port)
|
|
||||||
l, err := net.Listen("tcp", sport)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &WebSocketServer{
|
|
||||||
pipe,
|
|
||||||
port,
|
|
||||||
make(chan bool),
|
|
||||||
l,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (self *WebSocketServer) handlerLoop() {
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case <-self.doneCh:
|
|
||||||
wslogger.Infoln("Shutdown RPC-WS server")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (self *WebSocketServer) Stop() {
|
|
||||||
close(self.doneCh)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (self *WebSocketServer) Start() {
|
|
||||||
wslogger.Infof("Starting RPC-WS server on port %d", self.port)
|
|
||||||
go self.handlerLoop()
|
|
||||||
|
|
||||||
api := rpc.NewEthereumApi(self.pipe)
|
|
||||||
h := self.apiHandler(api)
|
|
||||||
http.Handle("/ws", h)
|
|
||||||
|
|
||||||
err := http.Serve(self.listener, nil)
|
|
||||||
if err != nil {
|
|
||||||
wslogger.Errorln("Error on RPC-WS interface:", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *WebSocketServer) apiHandler(api *rpc.EthereumApi) http.Handler {
|
|
||||||
fn := func(w http.ResponseWriter, req *http.Request) {
|
|
||||||
h := sockHandler(api)
|
|
||||||
s := websocket.Server{Handler: h}
|
|
||||||
s.ServeHTTP(w, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
return http.HandlerFunc(fn)
|
|
||||||
}
|
|
||||||
|
|
||||||
func sockHandler(api *rpc.EthereumApi) websocket.Handler {
|
|
||||||
var jsonrpcver string = "2.0"
|
|
||||||
fn := func(conn *websocket.Conn) {
|
|
||||||
for {
|
|
||||||
wslogger.Debugln("Handling connection")
|
|
||||||
var reqParsed rpc.RpcRequest
|
|
||||||
|
|
||||||
// reqParsed, reqerr := JSON.ParseRequestBody(conn.Request())
|
|
||||||
if err := websocket.JSON.Receive(conn, &reqParsed); err != nil {
|
|
||||||
jsonerr := &rpc.RpcErrorObject{-32700, "Error: Could not parse request"}
|
|
||||||
JSON.Send(conn, &rpc.RpcErrorResponse{JsonRpc: jsonrpcver, ID: nil, Error: jsonerr})
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
var response interface{}
|
|
||||||
reserr := api.GetRequestReply(&reqParsed, &response)
|
|
||||||
if reserr != nil {
|
|
||||||
wslogger.Warnln(reserr)
|
|
||||||
jsonerr := &rpc.RpcErrorObject{-32603, reserr.Error()}
|
|
||||||
JSON.Send(conn, &rpc.RpcErrorResponse{JsonRpc: jsonrpcver, ID: reqParsed.ID, Error: jsonerr})
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
wslogger.Debugf("Generated response: %T %s", response, response)
|
|
||||||
JSON.Send(conn, &rpc.RpcSuccessResponse{JsonRpc: jsonrpcver, ID: reqParsed.ID, Result: response})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return websocket.Handler(fn)
|
|
||||||
}
|
|
||||||
|
|
@ -79,10 +79,6 @@ func RunVmTest(p string, t *testing.T) {
|
||||||
helper.CreateFileTests(t, p, &tests)
|
helper.CreateFileTests(t, p, &tests)
|
||||||
|
|
||||||
for name, test := range tests {
|
for name, test := range tests {
|
||||||
helper.Logger.SetLogLevel(4)
|
|
||||||
if name != "TransactionNonceCheck2" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
db, _ := ethdb.NewMemDatabase()
|
db, _ := ethdb.NewMemDatabase()
|
||||||
statedb := state.New(nil, db)
|
statedb := state.New(nil, db)
|
||||||
for addr, account := range test.Pre {
|
for addr, account := range test.Pre {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package trie
|
package trie
|
||||||
|
|
||||||
import "bytes"
|
import (
|
||||||
|
"bytes"
|
||||||
|
)
|
||||||
|
|
||||||
type Iterator struct {
|
type Iterator struct {
|
||||||
trie *Trie
|
trie *Trie
|
||||||
|
|
@ -10,22 +12,28 @@ type Iterator struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewIterator(trie *Trie) *Iterator {
|
func NewIterator(trie *Trie) *Iterator {
|
||||||
return &Iterator{trie: trie, Key: make([]byte, 32)}
|
return &Iterator{trie: trie, Key: nil}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Iterator) Next() bool {
|
func (self *Iterator) Next() bool {
|
||||||
self.trie.mu.Lock()
|
self.trie.mu.Lock()
|
||||||
defer self.trie.mu.Unlock()
|
defer self.trie.mu.Unlock()
|
||||||
|
|
||||||
|
isIterStart := false
|
||||||
|
if self.Key == nil {
|
||||||
|
isIterStart = true
|
||||||
|
self.Key = make([]byte, 32)
|
||||||
|
}
|
||||||
|
|
||||||
key := RemTerm(CompactHexDecode(string(self.Key)))
|
key := RemTerm(CompactHexDecode(string(self.Key)))
|
||||||
k := self.next(self.trie.root, key)
|
k := self.next(self.trie.root, key, isIterStart)
|
||||||
|
|
||||||
self.Key = []byte(DecodeCompact(k))
|
self.Key = []byte(DecodeCompact(k))
|
||||||
|
|
||||||
return len(k) > 0
|
return len(k) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Iterator) next(node Node, key []byte) []byte {
|
func (self *Iterator) next(node Node, key []byte, isIterStart bool) []byte {
|
||||||
if node == nil {
|
if node == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -33,7 +41,7 @@ func (self *Iterator) next(node Node, key []byte) []byte {
|
||||||
switch node := node.(type) {
|
switch node := node.(type) {
|
||||||
case *FullNode:
|
case *FullNode:
|
||||||
if len(key) > 0 {
|
if len(key) > 0 {
|
||||||
k := self.next(node.branch(key[0]), key[1:])
|
k := self.next(node.branch(key[0]), key[1:], isIterStart)
|
||||||
if k != nil {
|
if k != nil {
|
||||||
return append([]byte{key[0]}, k...)
|
return append([]byte{key[0]}, k...)
|
||||||
}
|
}
|
||||||
|
|
@ -54,7 +62,13 @@ func (self *Iterator) next(node Node, key []byte) []byte {
|
||||||
case *ShortNode:
|
case *ShortNode:
|
||||||
k := RemTerm(node.Key())
|
k := RemTerm(node.Key())
|
||||||
if vnode, ok := node.Value().(*ValueNode); ok {
|
if vnode, ok := node.Value().(*ValueNode); ok {
|
||||||
if bytes.Compare([]byte(k), key) > 0 {
|
switch bytes.Compare([]byte(k), key) {
|
||||||
|
case 0:
|
||||||
|
if isIterStart {
|
||||||
|
self.Value = vnode.Val()
|
||||||
|
return k
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
self.Value = vnode.Val()
|
self.Value = vnode.Val()
|
||||||
return k
|
return k
|
||||||
}
|
}
|
||||||
|
|
@ -64,7 +78,7 @@ func (self *Iterator) next(node Node, key []byte) []byte {
|
||||||
var ret []byte
|
var ret []byte
|
||||||
skey := key[len(k):]
|
skey := key[len(k):]
|
||||||
if BeginsWith(key, k) {
|
if BeginsWith(key, k) {
|
||||||
ret = self.next(cnode, skey)
|
ret = self.next(cnode, skey, isIterStart)
|
||||||
} else if bytes.Compare(k, key[:len(k)]) > 0 {
|
} else if bytes.Compare(k, key[:len(k)]) > 0 {
|
||||||
return self.key(node)
|
return self.key(node)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -267,14 +267,13 @@ func TestLargeData(t *testing.T) {
|
||||||
trie := NewEmpty()
|
trie := NewEmpty()
|
||||||
vals := make(map[string]*kv)
|
vals := make(map[string]*kv)
|
||||||
|
|
||||||
for i := byte(1); i < 255; i++ {
|
for i := byte(0); i < 255; i++ {
|
||||||
value := &kv{ethutil.LeftPadBytes([]byte{i}, 32), []byte{i}, false}
|
value := &kv{ethutil.LeftPadBytes([]byte{i}, 32), []byte{i}, false}
|
||||||
value2 := &kv{ethutil.LeftPadBytes([]byte{10, i}, 32), []byte{i}, false}
|
value2 := &kv{ethutil.LeftPadBytes([]byte{10, i}, 32), []byte{i}, false}
|
||||||
trie.Update(value.k, value.v)
|
trie.Update(value.k, value.v)
|
||||||
trie.Update(value2.k, value2.v)
|
trie.Update(value2.k, value2.v)
|
||||||
vals[string(value.k)] = value
|
vals[string(value.k)] = value
|
||||||
vals[string(value2.k)] = value2
|
vals[string(value2.k)] = value2
|
||||||
fmt.Println(value, "\n", value2)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
it := trie.Iterator()
|
it := trie.Iterator()
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1 @@
|
||||||
package qt
|
package qt
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/ethereum/go-ethereum/core"
|
|
||||||
"github.com/ethereum/go-ethereum/ui"
|
|
||||||
"github.com/obscuren/qml"
|
|
||||||
)
|
|
||||||
|
|
||||||
func NewFilterFromMap(object map[string]interface{}, eth core.Backend) *core.Filter {
|
|
||||||
filter := ui.NewFilterFromMap(object, eth)
|
|
||||||
|
|
||||||
if object["topics"] != nil {
|
|
||||||
filter.SetTopics(makeTopics(object["topics"]))
|
|
||||||
}
|
|
||||||
|
|
||||||
return filter
|
|
||||||
}
|
|
||||||
|
|
||||||
func makeTopics(v interface{}) (d [][]byte) {
|
|
||||||
if qList, ok := v.(*qml.List); ok {
|
|
||||||
var s []string
|
|
||||||
qList.Convert(&s)
|
|
||||||
|
|
||||||
d = ui.MakeTopics(s)
|
|
||||||
} else if str, ok := v.(string); ok {
|
|
||||||
d = ui.MakeTopics(str)
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
|
||||||
23
vm/vm_jit.go
23
vm/vm_jit.go
|
|
@ -50,6 +50,7 @@ type RuntimeData struct {
|
||||||
timestamp int64
|
timestamp int64
|
||||||
code *byte
|
code *byte
|
||||||
codeSize uint64
|
codeSize uint64
|
||||||
|
codeHash i256
|
||||||
}
|
}
|
||||||
|
|
||||||
func hash2llvm(h []byte) i256 {
|
func hash2llvm(h []byte) i256 {
|
||||||
|
|
@ -180,6 +181,7 @@ func (self *JitVm) Run(me, caller ContextRef, code []byte, value, gas, price *bi
|
||||||
self.data.timestamp = self.env.Time()
|
self.data.timestamp = self.env.Time()
|
||||||
self.data.code = getDataPtr(code)
|
self.data.code = getDataPtr(code)
|
||||||
self.data.codeSize = uint64(len(code))
|
self.data.codeSize = uint64(len(code))
|
||||||
|
self.data.codeHash = hash2llvm(crypto.Sha3(code)) // TODO: Get already computed hash?
|
||||||
|
|
||||||
jit := C.evmjit_create()
|
jit := C.evmjit_create()
|
||||||
retCode := C.evmjit_run(jit, unsafe.Pointer(&self.data), unsafe.Pointer(self))
|
retCode := C.evmjit_run(jit, unsafe.Pointer(&self.data), unsafe.Pointer(self))
|
||||||
|
|
@ -197,12 +199,12 @@ func (self *JitVm) Run(me, caller ContextRef, code []byte, value, gas, price *bi
|
||||||
receiverAddr := llvm2hashRef(bswap(&self.data.address))
|
receiverAddr := llvm2hashRef(bswap(&self.data.address))
|
||||||
receiver := state.GetOrNewStateObject(receiverAddr)
|
receiver := state.GetOrNewStateObject(receiverAddr)
|
||||||
balance := state.GetBalance(me.Address())
|
balance := state.GetBalance(me.Address())
|
||||||
receiver.AddAmount(balance)
|
receiver.AddBalance(balance)
|
||||||
state.Delete(me.Address())
|
state.Delete(me.Address())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
C.evmjit_destroy(jit);
|
C.evmjit_destroy(jit)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -278,7 +280,7 @@ func env_blockhash(_vm unsafe.Pointer, _number unsafe.Pointer, _result unsafe.Po
|
||||||
}
|
}
|
||||||
|
|
||||||
//export env_call
|
//export env_call
|
||||||
func env_call(_vm unsafe.Pointer, _gas unsafe.Pointer, _receiveAddr unsafe.Pointer, _value unsafe.Pointer, inDataPtr unsafe.Pointer, inDataLen uint64, outDataPtr *byte, outDataLen uint64, _codeAddr unsafe.Pointer) bool {
|
func env_call(_vm unsafe.Pointer, _gas *int64, _receiveAddr unsafe.Pointer, _value unsafe.Pointer, inDataPtr unsafe.Pointer, inDataLen uint64, outDataPtr *byte, outDataLen uint64, _codeAddr unsafe.Pointer) bool {
|
||||||
vm := (*JitVm)(_vm)
|
vm := (*JitVm)(_vm)
|
||||||
|
|
||||||
//fmt.Printf("env_call (depth %d)\n", vm.Env().Depth())
|
//fmt.Printf("env_call (depth %d)\n", vm.Env().Depth())
|
||||||
|
|
@ -297,8 +299,7 @@ func env_call(_vm unsafe.Pointer, _gas unsafe.Pointer, _receiveAddr unsafe.Point
|
||||||
inData := C.GoBytes(inDataPtr, C.int(inDataLen))
|
inData := C.GoBytes(inDataPtr, C.int(inDataLen))
|
||||||
outData := llvm2bytesRef(outDataPtr, outDataLen)
|
outData := llvm2bytesRef(outDataPtr, outDataLen)
|
||||||
codeAddr := llvm2hash((*i256)(_codeAddr))
|
codeAddr := llvm2hash((*i256)(_codeAddr))
|
||||||
llvmGas := (*i256)(_gas)
|
gas := big.NewInt(*_gas)
|
||||||
gas := llvm2big(llvmGas)
|
|
||||||
var out []byte
|
var out []byte
|
||||||
var err error
|
var err error
|
||||||
if bytes.Equal(codeAddr, receiveAddr) {
|
if bytes.Equal(codeAddr, receiveAddr) {
|
||||||
|
|
@ -306,7 +307,7 @@ func env_call(_vm unsafe.Pointer, _gas unsafe.Pointer, _receiveAddr unsafe.Point
|
||||||
} else {
|
} else {
|
||||||
out, err = vm.env.CallCode(vm.me, codeAddr, inData, gas, vm.price, value)
|
out, err = vm.env.CallCode(vm.me, codeAddr, inData, gas, vm.price, value)
|
||||||
}
|
}
|
||||||
*llvmGas = big2llvm(gas)
|
*_gas = gas.Int64()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
copy(outData, out)
|
copy(outData, out)
|
||||||
return true
|
return true
|
||||||
|
|
@ -317,7 +318,7 @@ func env_call(_vm unsafe.Pointer, _gas unsafe.Pointer, _receiveAddr unsafe.Point
|
||||||
}
|
}
|
||||||
|
|
||||||
//export env_create
|
//export env_create
|
||||||
func env_create(_vm unsafe.Pointer, _gas unsafe.Pointer, _value unsafe.Pointer, initDataPtr unsafe.Pointer, initDataLen uint64, _result unsafe.Pointer) {
|
func env_create(_vm unsafe.Pointer, _gas *int64, _value unsafe.Pointer, initDataPtr unsafe.Pointer, initDataLen uint64, _result unsafe.Pointer) {
|
||||||
vm := (*JitVm)(_vm)
|
vm := (*JitVm)(_vm)
|
||||||
|
|
||||||
value := llvm2big((*i256)(_value))
|
value := llvm2big((*i256)(_value))
|
||||||
|
|
@ -325,9 +326,7 @@ func env_create(_vm unsafe.Pointer, _gas unsafe.Pointer, _value unsafe.Pointer,
|
||||||
result := (*i256)(_result)
|
result := (*i256)(_result)
|
||||||
*result = i256{}
|
*result = i256{}
|
||||||
|
|
||||||
llvmGas := (*i256)(_gas)
|
gas := big.NewInt(*_gas)
|
||||||
gas := llvm2big(llvmGas)
|
|
||||||
|
|
||||||
ret, suberr, ref := vm.env.Create(vm.me, nil, initData, gas, vm.price, value)
|
ret, suberr, ref := vm.env.Create(vm.me, nil, initData, gas, vm.price, value)
|
||||||
if suberr == nil {
|
if suberr == nil {
|
||||||
dataGas := big.NewInt(int64(len(ret))) // TODO: Nto the best design. env.Create can do it, it has the reference to gas counter
|
dataGas := big.NewInt(int64(len(ret))) // TODO: Nto the best design. env.Create can do it, it has the reference to gas counter
|
||||||
|
|
@ -335,7 +334,7 @@ func env_create(_vm unsafe.Pointer, _gas unsafe.Pointer, _value unsafe.Pointer,
|
||||||
gas.Sub(gas, dataGas)
|
gas.Sub(gas, dataGas)
|
||||||
*result = hash2llvm(ref.Address())
|
*result = hash2llvm(ref.Address())
|
||||||
}
|
}
|
||||||
*llvmGas = big2llvm(gas)
|
*_gas = gas.Int64()
|
||||||
}
|
}
|
||||||
|
|
||||||
//export env_log
|
//export env_log
|
||||||
|
|
@ -358,7 +357,7 @@ func env_log(_vm unsafe.Pointer, dataPtr unsafe.Pointer, dataLen uint64, _topic1
|
||||||
topics = append(topics, llvm2hash((*i256)(_topic4)))
|
topics = append(topics, llvm2hash((*i256)(_topic4)))
|
||||||
}
|
}
|
||||||
|
|
||||||
vm.Env().AddLog(state.NewLog(vm.me.Address(), topics, data))
|
vm.Env().AddLog(state.NewLog(vm.me.Address(), topics, data, vm.env.BlockNumber().Uint64()))
|
||||||
}
|
}
|
||||||
|
|
||||||
//export env_extcode
|
//export env_extcode
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue