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
f73a5f06
Commit
f73a5f06
authored
May 10, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fxed
parent
1471585a
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
619 additions
and
4 deletions
+619
-4
big.js
ethereal/assets/ext/big.js
+380
-0
ethereum.js
ethereal/assets/ext/ethereum.js
+121
-0
pre.js
ethereal/assets/ext/pre.js
+58
-0
string.js
ethereal/assets/ext/string.js
+58
-0
samplecoin.html
ethereal/assets/samplecoin/samplecoin.html
+2
-4
No files found.
ethereal/assets/ext/big.js
0 → 100644
View file @
f73a5f06
This diff is collapsed.
Click to expand it.
ethereal/assets/ext/ethereum.js
0 → 100644
View file @
f73a5f06
// Main Ethereum library
window
.
eth
=
{
prototype
:
Object
(),
// Retrieve block
//
// Either supply a number or a string. Type is determent for the lookup method
// string - Retrieves the block by looking up the hash
// number - Retrieves the block by looking up the block number
getBlock
:
function
(
numberOrHash
,
cb
)
{
var
func
;
if
(
typeof
numberOrHash
==
"string"
)
{
func
=
"getBlockByHash"
;
}
else
{
func
=
"getBlockByNumber"
;
}
postData
({
call
:
func
,
args
:
[
numberOrHash
]},
cb
);
},
// Create transaction
//
// Transact between two state objects
transact
:
function
(
sec
,
recipient
,
value
,
gas
,
gasPrice
,
data
,
cb
)
{
postData
({
call
:
"transact"
,
args
:
[
sec
,
recipient
,
value
,
gas
,
gasPrice
,
data
]},
cb
);
},
create
:
function
(
sec
,
value
,
gas
,
gasPrice
,
init
,
body
,
cb
)
{
postData
({
call
:
"create"
,
args
:
[
sec
,
value
,
gas
,
gasPrice
,
init
,
body
]},
cb
);
},
getStorageAt
:
function
(
address
,
storageAddress
,
cb
)
{
postData
({
call
:
"getStorage"
,
args
:
[
address
,
storageAddress
]},
cb
);
},
getKey
:
function
(
cb
)
{
postData
({
call
:
"getKey"
},
cb
);
},
getBalanceAt
:
function
(
address
,
cb
)
{
postData
({
call
:
"getBalance"
,
args
:
[
address
]},
cb
);
},
getSecretToAddress
:
function
(
sec
,
cb
)
{
postData
({
call
:
"getSecretToAddress"
,
args
:
[
sec
]},
cb
);
},
watch
:
function
(
address
,
storageAddrOrCb
,
cb
)
{
var
ev
;
if
(
cb
===
undefined
)
{
cb
=
storageAddrOrCb
;
storageAddrOrCb
=
""
;
ev
=
"object:"
+
address
;
}
else
{
ev
=
"storage:"
+
address
+
":"
+
storageAddrOrCb
;
}
eth
.
on
(
ev
,
cb
)
postData
({
call
:
"watch"
,
args
:
[
address
,
storageAddrOrCb
]});
},
disconnect
:
function
(
address
,
storageAddrOrCb
,
cb
)
{
var
ev
;
if
(
cb
===
undefined
)
{
cb
=
storageAddrOrCb
;
storageAddrOrCb
=
""
;
ev
=
"object:"
+
address
;
}
else
{
ev
=
"storage:"
+
address
+
":"
+
storageAddrOrCb
;
}
eth
.
off
(
ev
,
cb
)
postData
({
call
:
"disconnect"
,
args
:
[
address
,
storageAddrOrCb
]});
},
set
:
function
(
props
)
{
postData
({
call
:
"set"
,
args
:
props
});
},
on
:
function
(
event
,
cb
)
{
if
(
eth
.
_onCallbacks
[
event
]
===
undefined
)
{
eth
.
_onCallbacks
[
event
]
=
[];
}
eth
.
_onCallbacks
[
event
].
push
(
cb
);
return
this
},
off
:
function
(
event
,
cb
)
{
if
(
eth
.
_onCallbacks
[
event
]
!==
undefined
)
{
var
callbacks
=
eth
.
_onCallbacks
[
event
];
for
(
var
i
=
0
;
i
<
callbacks
.
length
;
i
++
)
{
if
(
callbacks
[
i
]
===
cb
)
{
delete
callbacks
[
i
];
}
}
}
return
this
},
trigger
:
function
(
event
,
data
)
{
var
callbacks
=
eth
.
_onCallbacks
[
event
];
if
(
callbacks
!==
undefined
)
{
for
(
var
i
=
0
;
i
<
callbacks
.
length
;
i
++
)
{
// Figure out whether the returned data was an array
// array means multiple return arguments (multiple params)
if
(
data
instanceof
Array
)
{
callbacks
[
i
].
apply
(
this
,
data
);
}
else
{
callbacks
[
i
].
call
(
this
,
data
);
}
}
}
},
}
window
.
eth
.
_callbacks
=
{}
window
.
eth
.
_onCallbacks
=
{}
ethereal/assets/ext/pre.js
0 → 100644
View file @
f73a5f06
function
debug
(
/**/
)
{
var
args
=
arguments
;
var
msg
=
""
for
(
var
i
=
0
;
i
<
args
.
length
;
i
++
){
if
(
typeof
args
[
i
]
===
"object"
)
{
msg
+=
" "
+
JSON
.
stringify
(
args
[
i
])
}
else
{
msg
+=
" "
+
args
[
i
]
}
}
postData
({
call
:
"debug"
,
args
:[
msg
]})
document
.
getElementById
(
"debug"
).
innerHTML
+=
"<br>"
+
msg
}
// Helper function for generating pseudo callbacks and sending data to the QML part of the application
function
postData
(
data
,
cb
)
{
data
.
_seed
=
Math
.
floor
(
Math
.
random
()
*
1000000
)
if
(
cb
)
{
eth
.
_callbacks
[
data
.
_seed
]
=
cb
;
}
if
(
data
.
args
===
undefined
)
{
data
.
args
=
[];
}
navigator
.
qt
.
postMessage
(
JSON
.
stringify
(
data
));
}
navigator
.
qt
.
onmessage
=
function
(
ev
)
{
var
data
=
JSON
.
parse
(
ev
.
data
)
if
(
data
.
_event
!==
undefined
)
{
eth
.
trigger
(
data
.
_event
,
data
.
data
);
}
else
{
if
(
data
.
_seed
)
{
var
cb
=
eth
.
_callbacks
[
data
.
_seed
];
if
(
cb
)
{
// Figure out whether the returned data was an array
// array means multiple return arguments (multiple params)
if
(
data
.
data
instanceof
Array
)
{
cb
.
apply
(
this
,
data
.
data
)
}
else
{
cb
.
call
(
this
,
data
.
data
)
}
// Remove the "trigger" callback
delete
eth
.
_callbacks
[
ev
.
_seed
];
}
}
}
}
window
.
onerror
=
function
(
message
,
file
,
lineNumber
,
column
,
errorObj
)
{
debug
(
file
,
message
,
lineNumber
+
":"
+
column
,
errorObj
);
return
false
;
}
ethereal/assets/ext/string.js
0 → 100644
View file @
f73a5f06
String
.
prototype
.
pad
=
function
(
l
,
r
)
{
if
(
r
===
undefined
)
{
r
=
l
if
(
!
(
this
.
substr
(
0
,
2
)
==
"0x"
||
/^
\d
+$/
.
test
(
this
)))
l
=
0
}
var
ret
=
this
.
bin
();
while
(
ret
.
length
<
l
)
ret
=
"
\
0"
+
ret
while
(
ret
.
length
<
r
)
ret
=
ret
+
"
\
0"
return
ret
;
}
String
.
prototype
.
unpad
=
function
()
{
var
i
=
this
.
length
;
while
(
i
&&
this
[
i
-
1
]
==
"
\
0"
)
--
i
return
this
.
substr
(
0
,
i
)
}
String
.
prototype
.
bin
=
function
()
{
if
(
this
.
substr
(
0
,
2
)
==
"0x"
)
{
bytes
=
[]
var
i
=
2
;
// Check if it's odd - pad with a zero if so.
if
(
this
.
length
%
2
)
bytes
.
push
(
parseInt
(
this
.
substr
(
i
++
,
1
),
16
))
for
(;
i
<
this
.
length
-
1
;
i
+=
2
)
bytes
.
push
(
parseInt
(
this
.
substr
(
i
,
2
),
16
));
return
String
.
fromCharCode
.
apply
(
String
,
bytes
);
}
else
if
(
/^
\d
+$/
.
test
(
this
))
return
bigInt
(
this
.
substr
(
0
)).
toHex
().
bin
()
// Otherwise we'll return the "String" object instead of an actual string
return
this
.
substr
(
0
,
this
.
length
)
}
String
.
prototype
.
unbin
=
function
()
{
var
i
,
l
,
o
=
''
;
for
(
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
)
{
var
n
=
this
.
charCodeAt
(
i
).
toString
(
16
);
o
+=
n
.
length
<
2
?
'0'
+
n
:
n
;
}
return
"0x"
+
o
;
}
String
.
prototype
.
dec
=
function
()
{
return
bigInt
(
this
.
substr
(
0
)).
toString
()
}
String
.
prototype
.
hex
=
function
()
{
return
bigInt
(
this
.
substr
(
0
)).
toHex
()
}
ethereal/assets/samplecoin/samplecoin.html
View file @
f73a5f06
...
...
@@ -13,11 +13,9 @@ var jefcoinAddr = "b7cb72c47ec4f31751d0d628b5a33fd6671bbba0"
var
mAddr
=
""
function
createTransaction
()
{
var
addr
=
document
.
querySelector
(
"#addr"
).
value
;
var
amount
=
document
.
querySelector
(
"#amount"
).
value
;
var
addr
=
(
"0x"
+
document
.
querySelector
(
"#addr"
).
value
).
pad
(
32
)
;
var
amount
=
document
.
querySelector
(
"#amount"
).
value
.
pad
(
32
)
;
addr
=
(
"0x"
+
addr
).
pad
(
32
)
amount
=
amount
.
pad
(
32
)
var
data
=
(
addr
+
amount
).
unbin
();
eth
.
transact
(
mAddr
,
jefcoinAddr
,
0
,
"10000000"
,
"250"
,
data
,
function
(
receipt
)
{
debug
(
"received tx hash:"
,
reciept
.
address
)
...
...
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