Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
20ea7894
Commit
20ea7894
authored
May 13, 2014
by
Maran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented new JS/EthPub methods
- getTxCountAt - getPeerCount - getIsMining - getIsListening - getCoinbase
parent
dd60382f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
22 deletions
+66
-22
ethereum.js
ethereal/assets/ext/ethereum.js
+17
-0
webapp.qml
ethereal/assets/qml/webapp.qml
+24
-0
ethereum.go
ethereum/ethereum.go
+25
-22
No files found.
ethereal/assets/ext/ethereum.js
View file @
20ea7894
...
@@ -36,6 +36,21 @@ window.eth = {
...
@@ -36,6 +36,21 @@ window.eth = {
postData
({
call
:
"getKey"
},
cb
);
postData
({
call
:
"getKey"
},
cb
);
},
},
getTxCountAt
:
function
(
address
,
cb
)
{
postData
({
call
:
"getTxCountAt"
,
args
:
[
address
]},
cb
);
},
getIsMining
:
function
(
cb
){
postData
({
call
:
"getIsMining"
},
cb
)
},
getIsListening
:
function
(
cb
){
postData
({
call
:
"getIsListening"
},
cb
)
},
getCoinBase
:
function
(
cb
){
postData
({
call
:
"getCoinBase"
},
cb
);
},
getPeerCount
:
function
(
cb
){
postData
({
call
:
"getPeerCount"
},
cb
);
},
getBalanceAt
:
function
(
address
,
cb
)
{
getBalanceAt
:
function
(
address
,
cb
)
{
postData
({
call
:
"getBalance"
,
args
:
[
address
]},
cb
);
postData
({
call
:
"getBalance"
,
args
:
[
address
]},
cb
);
},
},
...
@@ -115,6 +130,8 @@ window.eth = {
...
@@ -115,6 +130,8 @@ window.eth = {
}
}
}
}
},
},
}
}
window
.
eth
.
_callbacks
=
{}
window
.
eth
.
_callbacks
=
{}
window
.
eth
.
_onCallbacks
=
{}
window
.
eth
.
_onCallbacks
=
{}
...
...
ethereal/assets/qml/webapp.qml
View file @
20ea7894
...
@@ -47,13 +47,37 @@ ApplicationWindow {
...
@@ -47,13 +47,37 @@ ApplicationWindow {
try
{
try
{
switch
(
data
.
call
)
{
switch
(
data
.
call
)
{
case
"getCoinBase"
:
postData
(
data
.
_seed
,
eth
.
getCoinBase
())
break
case
"getIsListening"
:
postData
(
data
.
_seed
,
eth
.
getIsListening
())
break
case
"getIsMining"
:
postData
(
data
.
_seed
,
eth
.
getIsMining
())
break
case
"getPeerCount"
:
postData
(
data
.
_seed
,
eth
.
getPeerCount
())
break
case
"getTxCountAt"
:
require
(
1
)
postData
(
data
.
_seed
,
eth
.
getTxCountAt
(
data
.
args
[
0
]))
break
case
"getBlockByNumber"
:
case
"getBlockByNumber"
:
var
block
=
eth
.
getBlock
(
"b9b56cf6f907fbee21db0cd7cbc0e6fea2fe29503a3943e275c5e467d649cb06"
)
var
block
=
eth
.
getBlock
(
"b9b56cf6f907fbee21db0cd7cbc0e6fea2fe29503a3943e275c5e467d649cb06"
)
postData
(
data
.
_seed
,
block
)
postData
(
data
.
_seed
,
block
)
break
break
case
"getBlockByHash"
:
case
"getBlockByHash"
:
var
block
=
eth
.
getBlock
(
"b9b56cf6f907fbee21db0cd7cbc0e6fea2fe29503a3943e275c5e467d649cb06"
)
var
block
=
eth
.
getBlock
(
"b9b56cf6f907fbee21db0cd7cbc0e6fea2fe29503a3943e275c5e467d649cb06"
)
postData
(
data
.
_seed
,
block
)
postData
(
data
.
_seed
,
block
)
break
break
case
"transact"
:
case
"transact"
:
require
(
5
)
require
(
5
)
...
...
ethereum/ethereum.go
View file @
20ea7894
...
@@ -122,28 +122,8 @@ func main() {
...
@@ -122,28 +122,8 @@ func main() {
// Set the max peers
// Set the max peers
ethereum
.
MaxPeers
=
MaxPeer
ethereum
.
MaxPeers
=
MaxPeer
if
StartConsole
{
// Set Mining status
err
:=
os
.
Mkdir
(
ethutil
.
Config
.
ExecPath
,
os
.
ModePerm
)
ethereum
.
Mining
=
StartMining
// Error is OK if the error is ErrExist
if
err
!=
nil
&&
!
os
.
IsExist
(
err
)
{
log
.
Panic
(
"Unable to create EXECPATH:"
,
err
)
}
console
:=
NewConsole
(
ethereum
)
go
console
.
Start
()
}
if
StartRpc
{
ethereum
.
RpcServer
,
err
=
ethrpc
.
NewJsonRpcServer
(
ethpub
.
NewPEthereum
(
ethereum
),
RpcPort
)
if
err
!=
nil
{
logger
.
Infoln
(
"Could not start RPC interface:"
,
err
)
}
else
{
go
ethereum
.
RpcServer
.
Start
()
}
}
RegisterInterrupts
(
ethereum
)
ethereum
.
Start
(
UseSeed
)
if
StartMining
{
if
StartMining
{
logger
.
Infoln
(
"Miner started"
)
logger
.
Infoln
(
"Miner started"
)
...
@@ -168,6 +148,29 @@ func main() {
...
@@ -168,6 +148,29 @@ func main() {
}
}
if
StartConsole
{
err
:=
os
.
Mkdir
(
ethutil
.
Config
.
ExecPath
,
os
.
ModePerm
)
// Error is OK if the error is ErrExist
if
err
!=
nil
&&
!
os
.
IsExist
(
err
)
{
log
.
Panic
(
"Unable to create EXECPATH:"
,
err
)
}
console
:=
NewConsole
(
ethereum
)
go
console
.
Start
()
}
if
StartRpc
{
ethereum
.
RpcServer
,
err
=
ethrpc
.
NewJsonRpcServer
(
ethpub
.
NewPEthereum
(
ethereum
),
RpcPort
)
if
err
!=
nil
{
logger
.
Infoln
(
"Could not start RPC interface:"
,
err
)
}
else
{
go
ethereum
.
RpcServer
.
Start
()
}
}
RegisterInterrupts
(
ethereum
)
ethereum
.
Start
(
UseSeed
)
// Wait for shutdown
// Wait for shutdown
ethereum
.
WaitForShutdown
()
ethereum
.
WaitForShutdown
()
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment