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
fd9da725
Commit
fd9da725
authored
Oct 31, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ethcrypto => crypto
parent
3ee0461c
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
69 additions
and
69 deletions
+69
-69
block.go
chain/block.go
+5
-5
dagger.go
chain/dagger.go
+2
-2
genesis.go
chain/genesis.go
+3
-3
state_manager.go
chain/state_manager.go
+2
-2
transaction.go
chain/transaction.go
+6
-6
main.go
cmd/ethereum/main.go
+2
-2
ui_lib.go
cmd/mist/ui_lib.go
+2
-2
crypto.go
crypto/crypto.go
+1
-1
crypto_test.go
crypto/crypto_test.go
+1
-1
key_manager.go
crypto/key_manager.go
+1
-1
key_store.go
crypto/key_store.go
+1
-1
keypair.go
crypto/keypair.go
+1
-1
keyring.go
crypto/keyring.go
+1
-1
keys_test.go
crypto/keys_test.go
+1
-1
mnemonic.go
crypto/mnemonic.go
+1
-1
mnemonic_test.go
crypto/mnemonic_test.go
+1
-1
mnemonic_words.go
crypto/mnemonic_words.go
+1
-1
ethereum.go
ethereum.go
+4
-4
js_pipe.go
ethpipe/js_pipe.go
+5
-5
js_types.go
ethpipe/js_types.go
+2
-2
pipe.go
ethpipe/pipe.go
+4
-4
state_object.go
ethstate/state_object.go
+2
-2
trie.go
ethtrie/trie.go
+3
-3
cmd.go
utils/cmd.go
+7
-7
address.go
vm/address.go
+4
-4
vm.go
vm/vm.go
+3
-3
vm_debug.go
vm/vm_debug.go
+3
-3
No files found.
chain/block.go
View file @
fd9da725
...
@@ -7,7 +7,7 @@ import (
...
@@ -7,7 +7,7 @@ import (
"sort"
"sort"
"time"
"time"
"github.com/ethereum/go-ethereum/
eth
crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethtrie"
"github.com/ethereum/go-ethereum/ethtrie"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethutil"
...
@@ -144,12 +144,12 @@ func CreateBlock(root interface{},
...
@@ -144,12 +144,12 @@ func CreateBlock(root interface{},
// Returns a hash of the block
// Returns a hash of the block
func
(
block
*
Block
)
Hash
()
ethutil
.
Bytes
{
func
(
block
*
Block
)
Hash
()
ethutil
.
Bytes
{
return
eth
crypto
.
Sha3
(
ethutil
.
NewValue
(
block
.
header
())
.
Encode
())
return
crypto
.
Sha3
(
ethutil
.
NewValue
(
block
.
header
())
.
Encode
())
//return
eth
crypto.Sha3(block.Value().Encode())
//return crypto.Sha3(block.Value().Encode())
}
}
func
(
block
*
Block
)
HashNoNonce
()
[]
byte
{
func
(
block
*
Block
)
HashNoNonce
()
[]
byte
{
return
eth
crypto
.
Sha3
(
ethutil
.
Encode
(
block
.
miningHeader
()))
return
crypto
.
Sha3
(
ethutil
.
Encode
(
block
.
miningHeader
()))
}
}
func
(
block
*
Block
)
State
()
*
ethstate
.
State
{
func
(
block
*
Block
)
State
()
*
ethstate
.
State
{
...
@@ -232,7 +232,7 @@ func (block *Block) rlpUncles() interface{} {
...
@@ -232,7 +232,7 @@ func (block *Block) rlpUncles() interface{} {
func
(
block
*
Block
)
SetUncles
(
uncles
[]
*
Block
)
{
func
(
block
*
Block
)
SetUncles
(
uncles
[]
*
Block
)
{
block
.
Uncles
=
uncles
block
.
Uncles
=
uncles
block
.
UncleSha
=
eth
crypto
.
Sha3
(
ethutil
.
Encode
(
block
.
rlpUncles
()))
block
.
UncleSha
=
crypto
.
Sha3
(
ethutil
.
Encode
(
block
.
rlpUncles
()))
}
}
func
(
self
*
Block
)
SetReceipts
(
receipts
Receipts
)
{
func
(
self
*
Block
)
SetReceipts
(
receipts
Receipts
)
{
...
...
chain/dagger.go
View file @
fd9da725
...
@@ -6,7 +6,7 @@ import (
...
@@ -6,7 +6,7 @@ import (
"math/rand"
"math/rand"
"time"
"time"
"github.com/ethereum/go-ethereum/
eth
crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/obscuren/sha3"
"github.com/obscuren/sha3"
...
@@ -60,7 +60,7 @@ func (pow *EasyPow) Search(block *Block, stop <-chan struct{}) []byte {
...
@@ -60,7 +60,7 @@ func (pow *EasyPow) Search(block *Block, stop <-chan struct{}) []byte {
t
=
time
.
Now
()
t
=
time
.
Now
()
}
}
sha
:=
eth
crypto
.
Sha3
(
big
.
NewInt
(
r
.
Int63
())
.
Bytes
())
sha
:=
crypto
.
Sha3
(
big
.
NewInt
(
r
.
Int63
())
.
Bytes
())
if
pow
.
Verify
(
hash
,
diff
,
sha
)
{
if
pow
.
Verify
(
hash
,
diff
,
sha
)
{
return
sha
return
sha
}
}
...
...
chain/genesis.go
View file @
fd9da725
...
@@ -3,7 +3,7 @@ package chain
...
@@ -3,7 +3,7 @@ package chain
import
(
import
(
"math/big"
"math/big"
"github.com/ethereum/go-ethereum/
eth
crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethutil"
)
)
...
@@ -14,7 +14,7 @@ import (
...
@@ -14,7 +14,7 @@ import (
var
ZeroHash256
=
make
([]
byte
,
32
)
var
ZeroHash256
=
make
([]
byte
,
32
)
var
ZeroHash160
=
make
([]
byte
,
20
)
var
ZeroHash160
=
make
([]
byte
,
20
)
var
ZeroHash512
=
make
([]
byte
,
64
)
var
ZeroHash512
=
make
([]
byte
,
64
)
var
EmptyShaList
=
eth
crypto
.
Sha3
(
ethutil
.
Encode
([]
interface
{}{}))
var
EmptyShaList
=
crypto
.
Sha3
(
ethutil
.
Encode
([]
interface
{}{}))
var
GenesisHeader
=
[]
interface
{}{
var
GenesisHeader
=
[]
interface
{}{
// Previous hash (none)
// Previous hash (none)
...
@@ -47,7 +47,7 @@ var GenesisHeader = []interface{}{
...
@@ -47,7 +47,7 @@ var GenesisHeader = []interface{}{
// Extra
// Extra
nil
,
nil
,
// Nonce
// Nonce
eth
crypto
.
Sha3
(
big
.
NewInt
(
42
)
.
Bytes
()),
crypto
.
Sha3
(
big
.
NewInt
(
42
)
.
Bytes
()),
}
}
var
Genesis
=
[]
interface
{}{
GenesisHeader
,
[]
interface
{}{},
[]
interface
{}{}}
var
Genesis
=
[]
interface
{}{
GenesisHeader
,
[]
interface
{}{},
[]
interface
{}{}}
chain/state_manager.go
View file @
fd9da725
...
@@ -9,7 +9,7 @@ import (
...
@@ -9,7 +9,7 @@ import (
"sync"
"sync"
"time"
"time"
"github.com/ethereum/go-ethereum/
eth
crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethutil"
...
@@ -40,7 +40,7 @@ type EthManager interface {
...
@@ -40,7 +40,7 @@ type EthManager interface {
IsMining
()
bool
IsMining
()
bool
IsListening
()
bool
IsListening
()
bool
Peers
()
*
list
.
List
Peers
()
*
list
.
List
KeyManager
()
*
eth
crypto
.
KeyManager
KeyManager
()
*
crypto
.
KeyManager
ClientIdentity
()
ethwire
.
ClientIdentity
ClientIdentity
()
ethwire
.
ClientIdentity
Db
()
ethutil
.
Database
Db
()
ethutil
.
Database
EventMux
()
*
event
.
TypeMux
EventMux
()
*
event
.
TypeMux
...
...
chain/transaction.go
View file @
fd9da725
...
@@ -5,7 +5,7 @@ import (
...
@@ -5,7 +5,7 @@ import (
"fmt"
"fmt"
"math/big"
"math/big"
"github.com/ethereum/go-ethereum/
eth
crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/obscuren/secp256k1-go"
"github.com/obscuren/secp256k1-go"
...
@@ -66,7 +66,7 @@ func (self *Transaction) TotalValue() *big.Int {
...
@@ -66,7 +66,7 @@ func (self *Transaction) TotalValue() *big.Int {
func
(
tx
*
Transaction
)
Hash
()
[]
byte
{
func
(
tx
*
Transaction
)
Hash
()
[]
byte
{
data
:=
[]
interface
{}{
tx
.
Nonce
,
tx
.
GasPrice
,
tx
.
Gas
,
tx
.
Recipient
,
tx
.
Value
,
tx
.
Data
}
data
:=
[]
interface
{}{
tx
.
Nonce
,
tx
.
GasPrice
,
tx
.
Gas
,
tx
.
Recipient
,
tx
.
Value
,
tx
.
Data
}
return
eth
crypto
.
Sha3
(
ethutil
.
NewValue
(
data
)
.
Encode
())
return
crypto
.
Sha3
(
ethutil
.
NewValue
(
data
)
.
Encode
())
}
}
func
(
tx
*
Transaction
)
CreatesContract
()
bool
{
func
(
tx
*
Transaction
)
CreatesContract
()
bool
{
...
@@ -80,9 +80,9 @@ func (tx *Transaction) IsContract() bool {
...
@@ -80,9 +80,9 @@ func (tx *Transaction) IsContract() bool {
func
(
tx
*
Transaction
)
CreationAddress
(
state
*
ethstate
.
State
)
[]
byte
{
func
(
tx
*
Transaction
)
CreationAddress
(
state
*
ethstate
.
State
)
[]
byte
{
// Generate a new address
// Generate a new address
addr
:=
eth
crypto
.
Sha3
(
ethutil
.
NewValue
([]
interface
{}{
tx
.
Sender
(),
tx
.
Nonce
})
.
Encode
())[
12
:
]
addr
:=
crypto
.
Sha3
(
ethutil
.
NewValue
([]
interface
{}{
tx
.
Sender
(),
tx
.
Nonce
})
.
Encode
())[
12
:
]
//for i := uint64(0); state.GetStateObject(addr) != nil; i++ {
//for i := uint64(0); state.GetStateObject(addr) != nil; i++ {
// addr =
eth
crypto.Sha3(ethutil.NewValue([]interface{}{tx.Sender(), tx.Nonce + i}).Encode())[12:]
// addr = crypto.Sha3(ethutil.NewValue([]interface{}{tx.Sender(), tx.Nonce + i}).Encode())[12:]
//}
//}
return
addr
return
addr
...
@@ -106,7 +106,7 @@ func (tx *Transaction) PublicKey() []byte {
...
@@ -106,7 +106,7 @@ func (tx *Transaction) PublicKey() []byte {
sig
:=
append
(
r
,
s
...
)
sig
:=
append
(
r
,
s
...
)
sig
=
append
(
sig
,
tx
.
v
-
27
)
sig
=
append
(
sig
,
tx
.
v
-
27
)
pubkey
:=
eth
crypto
.
Ecrecover
(
append
(
hash
,
sig
...
))
pubkey
:=
crypto
.
Ecrecover
(
append
(
hash
,
sig
...
))
//pubkey, _ := secp256k1.RecoverPubkey(hash, sig)
//pubkey, _ := secp256k1.RecoverPubkey(hash, sig)
return
pubkey
return
pubkey
...
@@ -121,7 +121,7 @@ func (tx *Transaction) Sender() []byte {
...
@@ -121,7 +121,7 @@ func (tx *Transaction) Sender() []byte {
return
nil
return
nil
}
}
return
eth
crypto
.
Sha3
(
pubkey
[
1
:
])[
12
:
]
return
crypto
.
Sha3
(
pubkey
[
1
:
])[
12
:
]
}
}
func
(
tx
*
Transaction
)
Sign
(
privk
[]
byte
)
error
{
func
(
tx
*
Transaction
)
Sign
(
privk
[]
byte
)
error
{
...
...
cmd/ethereum/main.go
View file @
fd9da725
...
@@ -22,7 +22,7 @@ import (
...
@@ -22,7 +22,7 @@ import (
"os"
"os"
"runtime"
"runtime"
"github.com/ethereum/go-ethereum/
eth
chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/utils"
"github.com/ethereum/go-ethereum/utils"
...
@@ -74,7 +74,7 @@ func main() {
...
@@ -74,7 +74,7 @@ func main() {
ethereum
:=
utils
.
NewEthereum
(
db
,
clientIdentity
,
keyManager
,
UseUPnP
,
OutboundPort
,
MaxPeer
)
ethereum
:=
utils
.
NewEthereum
(
db
,
clientIdentity
,
keyManager
,
UseUPnP
,
OutboundPort
,
MaxPeer
)
if
Dump
{
if
Dump
{
var
block
*
eth
chain
.
Block
var
block
*
chain
.
Block
if
len
(
DumpHash
)
==
0
&&
DumpNumber
==
-
1
{
if
len
(
DumpHash
)
==
0
&&
DumpNumber
==
-
1
{
block
=
ethereum
.
ChainManager
()
.
CurrentBlock
block
=
ethereum
.
ChainManager
()
.
CurrentBlock
...
...
cmd/mist/ui_lib.go
View file @
fd9da725
...
@@ -26,7 +26,7 @@ import (
...
@@ -26,7 +26,7 @@ import (
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/
eth
crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethpipe"
"github.com/ethereum/go-ethereum/ethpipe"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethutil"
...
@@ -69,7 +69,7 @@ func (self *UiLib) LookupDomain(domain string) string {
...
@@ -69,7 +69,7 @@ func (self *UiLib) LookupDomain(domain string) string {
world
:=
self
.
World
()
world
:=
self
.
World
()
if
len
(
domain
)
>
32
{
if
len
(
domain
)
>
32
{
domain
=
string
(
eth
crypto
.
Sha3
([]
byte
(
domain
)))
domain
=
string
(
crypto
.
Sha3
([]
byte
(
domain
)))
}
}
data
:=
world
.
Config
()
.
Get
(
"DnsReg"
)
.
StorageString
(
domain
)
.
Bytes
()
data
:=
world
.
Config
()
.
Get
(
"DnsReg"
)
.
StorageString
(
domain
)
.
Bytes
()
...
...
eth
crypto/crypto.go
→
crypto/crypto.go
View file @
fd9da725
package
eth
crypto
package
crypto
import
(
import
(
"crypto/sha256"
"crypto/sha256"
...
...
eth
crypto/crypto_test.go
→
crypto/crypto_test.go
View file @
fd9da725
package
eth
crypto
package
crypto
import
(
import
(
"bytes"
"bytes"
...
...
eth
crypto/key_manager.go
→
crypto/key_manager.go
View file @
fd9da725
package
eth
crypto
package
crypto
import
(
import
(
"fmt"
"fmt"
...
...
eth
crypto/key_store.go
→
crypto/key_store.go
View file @
fd9da725
package
eth
crypto
package
crypto
import
(
import
(
"fmt"
"fmt"
...
...
eth
crypto/keypair.go
→
crypto/keypair.go
View file @
fd9da725
package
eth
crypto
package
crypto
import
(
import
(
"strings"
"strings"
...
...
eth
crypto/keyring.go
→
crypto/keyring.go
View file @
fd9da725
package
eth
crypto
package
crypto
import
(
import
(
"fmt"
"fmt"
...
...
eth
crypto/keys_test.go
→
crypto/keys_test.go
View file @
fd9da725
package
eth
crypto
package
crypto
import
(
import
(
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethdb"
...
...
eth
crypto/mnemonic.go
→
crypto/mnemonic.go
View file @
fd9da725
package
eth
crypto
package
crypto
import
(
import
(
"fmt"
"fmt"
...
...
eth
crypto/mnemonic_test.go
→
crypto/mnemonic_test.go
View file @
fd9da725
package
eth
crypto
package
crypto
import
(
import
(
"testing"
"testing"
...
...
eth
crypto/mnemonic_words.go
→
crypto/mnemonic_words.go
View file @
fd9da725
package
eth
crypto
package
crypto
var
MnemonicWords
[]
string
=
[]
string
{
var
MnemonicWords
[]
string
=
[]
string
{
"like"
,
"like"
,
...
...
ethereum.go
View file @
fd9da725
...
@@ -15,7 +15,7 @@ import (
...
@@ -15,7 +15,7 @@ import (
"time"
"time"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/
eth
crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethutil"
...
@@ -86,7 +86,7 @@ type Ethereum struct {
...
@@ -86,7 +86,7 @@ type Ethereum struct {
RpcServer
*
rpc
.
JsonRpcServer
RpcServer
*
rpc
.
JsonRpcServer
keyManager
*
eth
crypto
.
KeyManager
keyManager
*
crypto
.
KeyManager
clientIdentity
ethwire
.
ClientIdentity
clientIdentity
ethwire
.
ClientIdentity
...
@@ -97,7 +97,7 @@ type Ethereum struct {
...
@@ -97,7 +97,7 @@ type Ethereum struct {
filters
map
[
int
]
*
chain
.
Filter
filters
map
[
int
]
*
chain
.
Filter
}
}
func
New
(
db
ethutil
.
Database
,
clientIdentity
ethwire
.
ClientIdentity
,
keyManager
*
eth
crypto
.
KeyManager
,
caps
Caps
,
usePnp
bool
)
(
*
Ethereum
,
error
)
{
func
New
(
db
ethutil
.
Database
,
clientIdentity
ethwire
.
ClientIdentity
,
keyManager
*
crypto
.
KeyManager
,
caps
Caps
,
usePnp
bool
)
(
*
Ethereum
,
error
)
{
var
err
error
var
err
error
var
nat
NAT
var
nat
NAT
...
@@ -138,7 +138,7 @@ func New(db ethutil.Database, clientIdentity ethwire.ClientIdentity, keyManager
...
@@ -138,7 +138,7 @@ func New(db ethutil.Database, clientIdentity ethwire.ClientIdentity, keyManager
return
ethereum
,
nil
return
ethereum
,
nil
}
}
func
(
s
*
Ethereum
)
KeyManager
()
*
eth
crypto
.
KeyManager
{
func
(
s
*
Ethereum
)
KeyManager
()
*
crypto
.
KeyManager
{
return
s
.
keyManager
return
s
.
keyManager
}
}
...
...
ethpipe/js_pipe.go
View file @
fd9da725
...
@@ -6,7 +6,7 @@ import (
...
@@ -6,7 +6,7 @@ import (
"sync/atomic"
"sync/atomic"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/
eth
crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethutil"
)
)
...
@@ -114,7 +114,7 @@ func (self *JSPipe) IsContract(address string) bool {
...
@@ -114,7 +114,7 @@ func (self *JSPipe) IsContract(address string) bool {
}
}
func
(
self
*
JSPipe
)
SecretToAddress
(
key
string
)
string
{
func
(
self
*
JSPipe
)
SecretToAddress
(
key
string
)
string
{
pair
,
err
:=
eth
crypto
.
NewKeyPairFromSec
(
ethutil
.
Hex2Bytes
(
key
))
pair
,
err
:=
crypto
.
NewKeyPairFromSec
(
ethutil
.
Hex2Bytes
(
key
))
if
err
!=
nil
{
if
err
!=
nil
{
return
""
return
""
}
}
...
@@ -192,12 +192,12 @@ func (self *JSPipe) Transact(key, toStr, valueStr, gasStr, gasPriceStr, codeStr
...
@@ -192,12 +192,12 @@ func (self *JSPipe) Transact(key, toStr, valueStr, gasStr, gasPriceStr, codeStr
}
}
}
}
var
keyPair
*
eth
crypto
.
KeyPair
var
keyPair
*
crypto
.
KeyPair
var
err
error
var
err
error
if
ethutil
.
IsHex
(
key
)
{
if
ethutil
.
IsHex
(
key
)
{
keyPair
,
err
=
eth
crypto
.
NewKeyPairFromSec
([]
byte
(
ethutil
.
Hex2Bytes
(
key
[
2
:
])))
keyPair
,
err
=
crypto
.
NewKeyPairFromSec
([]
byte
(
ethutil
.
Hex2Bytes
(
key
[
2
:
])))
}
else
{
}
else
{
keyPair
,
err
=
eth
crypto
.
NewKeyPairFromSec
([]
byte
(
ethutil
.
Hex2Bytes
(
key
)))
keyPair
,
err
=
crypto
.
NewKeyPairFromSec
([]
byte
(
ethutil
.
Hex2Bytes
(
key
)))
}
}
if
err
!=
nil
{
if
err
!=
nil
{
...
...
ethpipe/js_types.go
View file @
fd9da725
...
@@ -6,7 +6,7 @@ import (
...
@@ -6,7 +6,7 @@ import (
"strings"
"strings"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/
eth
crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethutil"
)
)
...
@@ -119,7 +119,7 @@ type JSKey struct {
...
@@ -119,7 +119,7 @@ type JSKey struct {
PublicKey
string
`json:"publicKey"`
PublicKey
string
`json:"publicKey"`
}
}
func
NewJSKey
(
key
*
eth
crypto
.
KeyPair
)
*
JSKey
{
func
NewJSKey
(
key
*
crypto
.
KeyPair
)
*
JSKey
{
return
&
JSKey
{
ethutil
.
Bytes2Hex
(
key
.
Address
()),
ethutil
.
Bytes2Hex
(
key
.
PrivateKey
),
ethutil
.
Bytes2Hex
(
key
.
PublicKey
)}
return
&
JSKey
{
ethutil
.
Bytes2Hex
(
key
.
Address
()),
ethutil
.
Bytes2Hex
(
key
.
PrivateKey
),
ethutil
.
Bytes2Hex
(
key
.
PublicKey
)}
}
}
...
...
ethpipe/pipe.go
View file @
fd9da725
...
@@ -5,7 +5,7 @@ import (
...
@@ -5,7 +5,7 @@ import (
"strings"
"strings"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/
eth
crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethutil"
...
@@ -77,7 +77,7 @@ func (self *Pipe) Storage(addr, storageAddr []byte) *ethutil.Value {
...
@@ -77,7 +77,7 @@ func (self *Pipe) Storage(addr, storageAddr []byte) *ethutil.Value {
}
}
func
(
self
*
Pipe
)
ToAddress
(
priv
[]
byte
)
[]
byte
{
func
(
self
*
Pipe
)
ToAddress
(
priv
[]
byte
)
[]
byte
{
pair
,
err
:=
eth
crypto
.
NewKeyPairFromSec
(
priv
)
pair
,
err
:=
crypto
.
NewKeyPairFromSec
(
priv
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
return
nil
}
}
...
@@ -89,7 +89,7 @@ func (self *Pipe) Exists(addr []byte) bool {
...
@@ -89,7 +89,7 @@ func (self *Pipe) Exists(addr []byte) bool {
return
self
.
World
()
.
Get
(
addr
)
!=
nil
return
self
.
World
()
.
Get
(
addr
)
!=
nil
}
}
func
(
self
*
Pipe
)
TransactString
(
key
*
eth
crypto
.
KeyPair
,
rec
string
,
value
,
gas
,
price
*
ethutil
.
Value
,
data
[]
byte
)
([]
byte
,
error
)
{
func
(
self
*
Pipe
)
TransactString
(
key
*
crypto
.
KeyPair
,
rec
string
,
value
,
gas
,
price
*
ethutil
.
Value
,
data
[]
byte
)
([]
byte
,
error
)
{
// Check if an address is stored by this address
// Check if an address is stored by this address
var
hash
[]
byte
var
hash
[]
byte
addr
:=
self
.
World
()
.
Config
()
.
Get
(
"NameReg"
)
.
StorageString
(
rec
)
.
Bytes
()
addr
:=
self
.
World
()
.
Config
()
.
Get
(
"NameReg"
)
.
StorageString
(
rec
)
.
Bytes
()
...
@@ -104,7 +104,7 @@ func (self *Pipe) TransactString(key *ethcrypto.KeyPair, rec string, value, gas,
...
@@ -104,7 +104,7 @@ func (self *Pipe) TransactString(key *ethcrypto.KeyPair, rec string, value, gas,
return
self
.
Transact
(
key
,
hash
,
value
,
gas
,
price
,
data
)
return
self
.
Transact
(
key
,
hash
,
value
,
gas
,
price
,
data
)
}
}
func
(
self
*
Pipe
)
Transact
(
key
*
eth
crypto
.
KeyPair
,
rec
[]
byte
,
value
,
gas
,
price
*
ethutil
.
Value
,
data
[]
byte
)
([]
byte
,
error
)
{
func
(
self
*
Pipe
)
Transact
(
key
*
crypto
.
KeyPair
,
rec
[]
byte
,
value
,
gas
,
price
*
ethutil
.
Value
,
data
[]
byte
)
([]
byte
,
error
)
{
var
hash
[]
byte
var
hash
[]
byte
var
contractCreation
bool
var
contractCreation
bool
if
rec
==
nil
{
if
rec
==
nil
{
...
...
ethstate/state_object.go
View file @
fd9da725
...
@@ -4,7 +4,7 @@ import (
...
@@ -4,7 +4,7 @@ import (
"fmt"
"fmt"
"math/big"
"math/big"
"github.com/ethereum/go-ethereum/
eth
crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethtrie"
"github.com/ethereum/go-ethereum/ethtrie"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethutil"
)
)
...
@@ -310,7 +310,7 @@ func (c *StateObject) RlpEncode() []byte {
...
@@ -310,7 +310,7 @@ func (c *StateObject) RlpEncode() []byte {
func
(
c
*
StateObject
)
CodeHash
()
ethutil
.
Bytes
{
func
(
c
*
StateObject
)
CodeHash
()
ethutil
.
Bytes
{
var
codeHash
[]
byte
var
codeHash
[]
byte
if
len
(
c
.
Code
)
>
0
{
if
len
(
c
.
Code
)
>
0
{
codeHash
=
eth
crypto
.
Sha3
(
c
.
Code
)
codeHash
=
crypto
.
Sha3
(
c
.
Code
)
}
}
return
codeHash
return
codeHash
...
...
ethtrie/trie.go
View file @
fd9da725
...
@@ -5,7 +5,7 @@ import (
...
@@ -5,7 +5,7 @@ import (
"fmt"
"fmt"
"sync"
"sync"
"github.com/ethereum/go-ethereum/
eth
crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethutil"
)
)
...
@@ -64,7 +64,7 @@ func (cache *Cache) PutValue(v interface{}, force bool) interface{} {
...
@@ -64,7 +64,7 @@ func (cache *Cache) PutValue(v interface{}, force bool) interface{} {
enc
:=
value
.
Encode
()
enc
:=
value
.
Encode
()
if
len
(
enc
)
>=
32
||
force
{
if
len
(
enc
)
>=
32
||
force
{
sha
:=
eth
crypto
.
Sha3
(
enc
)
sha
:=
crypto
.
Sha3
(
enc
)
cache
.
nodes
[
string
(
sha
)]
=
NewNode
(
sha
,
value
,
true
)
cache
.
nodes
[
string
(
sha
)]
=
NewNode
(
sha
,
value
,
true
)
cache
.
IsDirty
=
true
cache
.
IsDirty
=
true
...
@@ -178,7 +178,7 @@ func (self *Trie) setRoot(root interface{}) {
...
@@ -178,7 +178,7 @@ func (self *Trie) setRoot(root interface{}) {
switch
t
:=
root
.
(
type
)
{
switch
t
:=
root
.
(
type
)
{
case
string
:
case
string
:
if
t
==
""
{
if
t
==
""
{
root
=
eth
crypto
.
Sha3
([]
byte
(
""
))
root
=
crypto
.
Sha3
([]
byte
(
""
))
}
}
self
.
Root
=
root
self
.
Root
=
root
case
[]
byte
:
case
[]
byte
:
...
...
utils/cmd.go
View file @
fd9da725
...
@@ -14,7 +14,7 @@ import (
...
@@ -14,7 +14,7 @@ import (
"bitbucket.org/kardianos/osext"
"bitbucket.org/kardianos/osext"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/
eth
crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethminer"
"github.com/ethereum/go-ethereum/ethminer"
...
@@ -149,7 +149,7 @@ func NewClientIdentity(clientIdentifier, version, customIdentifier string) *ethw
...
@@ -149,7 +149,7 @@ func NewClientIdentity(clientIdentifier, version, customIdentifier string) *ethw
return
ethwire
.
NewSimpleClientIdentity
(
clientIdentifier
,
version
,
customIdentifier
)
return
ethwire
.
NewSimpleClientIdentity
(
clientIdentifier
,
version
,
customIdentifier
)
}
}
func
NewEthereum
(
db
ethutil
.
Database
,
clientIdentity
ethwire
.
ClientIdentity
,
keyManager
*
eth
crypto
.
KeyManager
,
usePnp
bool
,
OutboundPort
string
,
MaxPeer
int
)
*
eth
.
Ethereum
{
func
NewEthereum
(
db
ethutil
.
Database
,
clientIdentity
ethwire
.
ClientIdentity
,
keyManager
*
crypto
.
KeyManager
,
usePnp
bool
,
OutboundPort
string
,
MaxPeer
int
)
*
eth
.
Ethereum
{
ethereum
,
err
:=
eth
.
New
(
db
,
clientIdentity
,
keyManager
,
eth
.
CapDefault
,
usePnp
)
ethereum
,
err
:=
eth
.
New
(
db
,
clientIdentity
,
keyManager
,
eth
.
CapDefault
,
usePnp
)
if
err
!=
nil
{
if
err
!=
nil
{
logger
.
Fatalln
(
"eth start err:"
,
err
)
logger
.
Fatalln
(
"eth start err:"
,
err
)
...
@@ -173,13 +173,13 @@ func ShowGenesis(ethereum *eth.Ethereum) {
...
@@ -173,13 +173,13 @@ func ShowGenesis(ethereum *eth.Ethereum) {
exit
(
nil
)
exit
(
nil
)
}
}
func
NewKeyManager
(
KeyStore
string
,
Datadir
string
,
db
ethutil
.
Database
)
*
eth
crypto
.
KeyManager
{
func
NewKeyManager
(
KeyStore
string
,
Datadir
string
,
db
ethutil
.
Database
)
*
crypto
.
KeyManager
{
var
keyManager
*
eth
crypto
.
KeyManager
var
keyManager
*
crypto
.
KeyManager
switch
{
switch
{
case
KeyStore
==
"db"
:
case
KeyStore
==
"db"
:
keyManager
=
eth
crypto
.
NewDBKeyManager
(
db
)
keyManager
=
crypto
.
NewDBKeyManager
(
db
)
case
KeyStore
==
"file"
:
case
KeyStore
==
"file"
:
keyManager
=
eth
crypto
.
NewFileKeyManager
(
Datadir
)
keyManager
=
crypto
.
NewFileKeyManager
(
Datadir
)
default
:
default
:
exit
(
fmt
.
Errorf
(
"unknown keystore type: %s"
,
KeyStore
))
exit
(
fmt
.
Errorf
(
"unknown keystore type: %s"
,
KeyStore
))
}
}
...
@@ -211,7 +211,7 @@ func DefaultAssetPath() string {
...
@@ -211,7 +211,7 @@ func DefaultAssetPath() string {
return
assetPath
return
assetPath
}
}
func
KeyTasks
(
keyManager
*
eth
crypto
.
KeyManager
,
KeyRing
string
,
GenAddr
bool
,
SecretFile
string
,
ExportDir
string
,
NonInteractive
bool
)
{
func
KeyTasks
(
keyManager
*
crypto
.
KeyManager
,
KeyRing
string
,
GenAddr
bool
,
SecretFile
string
,
ExportDir
string
,
NonInteractive
bool
)
{
var
err
error
var
err
error
switch
{
switch
{
...
...
vm/address.go
View file @
fd9da725
...
@@ -3,7 +3,7 @@ package vm
...
@@ -3,7 +3,7 @@ package vm
import
(
import
(
"math/big"
"math/big"
"github.com/ethereum/go-ethereum/
eth
crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethutil"
)
)
...
@@ -27,16 +27,16 @@ var Precompiled = map[uint64]*PrecompiledAddress{
...
@@ -27,16 +27,16 @@ var Precompiled = map[uint64]*PrecompiledAddress{
}
}
func
sha256Func
(
in
[]
byte
)
[]
byte
{
func
sha256Func
(
in
[]
byte
)
[]
byte
{
return
eth
crypto
.
Sha256
(
in
)
return
crypto
.
Sha256
(
in
)
}
}
func
ripemd160Func
(
in
[]
byte
)
[]
byte
{
func
ripemd160Func
(
in
[]
byte
)
[]
byte
{
return
ethutil
.
RightPadBytes
(
eth
crypto
.
Ripemd160
(
in
),
32
)
return
ethutil
.
RightPadBytes
(
crypto
.
Ripemd160
(
in
),
32
)
}
}
func
ecrecoverFunc
(
in
[]
byte
)
[]
byte
{
func
ecrecoverFunc
(
in
[]
byte
)
[]
byte
{
// In case of an invalid sig. Defaults to return nil
// In case of an invalid sig. Defaults to return nil
defer
func
()
{
recover
()
}()
defer
func
()
{
recover
()
}()
return
eth
crypto
.
Ecrecover
(
in
)
return
crypto
.
Ecrecover
(
in
)
}
}
vm/vm.go
View file @
fd9da725
...
@@ -4,7 +4,7 @@ import (
...
@@ -4,7 +4,7 @@ import (
"fmt"
"fmt"
"math/big"
"math/big"
"github.com/ethereum/go-ethereum/
eth
crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethutil"
)
)
...
@@ -391,7 +391,7 @@ func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
...
@@ -391,7 +391,7 @@ func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
case
SHA3
:
case
SHA3
:
require
(
2
)
require
(
2
)
size
,
offset
:=
stack
.
Popn
()
size
,
offset
:=
stack
.
Popn
()
data
:=
eth
crypto
.
Sha3
(
mem
.
Get
(
offset
.
Int64
(),
size
.
Int64
()))
data
:=
crypto
.
Sha3
(
mem
.
Get
(
offset
.
Int64
(),
size
.
Int64
()))
stack
.
Push
(
ethutil
.
BigD
(
data
))
stack
.
Push
(
ethutil
.
BigD
(
data
))
...
@@ -627,7 +627,7 @@ func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
...
@@ -627,7 +627,7 @@ func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
)
)
// Generate a new address
// Generate a new address
addr
:=
eth
crypto
.
CreateAddress
(
closure
.
Address
(),
closure
.
object
.
Nonce
)
addr
:=
crypto
.
CreateAddress
(
closure
.
Address
(),
closure
.
object
.
Nonce
)
closure
.
object
.
Nonce
++
closure
.
object
.
Nonce
++
closure
.
UseGas
(
closure
.
Gas
)
closure
.
UseGas
(
closure
.
Gas
)
...
...
vm/vm_debug.go
View file @
fd9da725
...
@@ -4,7 +4,7 @@ import (
...
@@ -4,7 +4,7 @@ import (
"fmt"
"fmt"
"math/big"
"math/big"
"github.com/ethereum/go-ethereum/
eth
crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethutil"
)
)
...
@@ -519,7 +519,7 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) {
...
@@ -519,7 +519,7 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) {
// 0x20 range
// 0x20 range
case
SHA3
:
case
SHA3
:
size
,
offset
:=
stack
.
Popn
()
size
,
offset
:=
stack
.
Popn
()
data
:=
eth
crypto
.
Sha3
(
mem
.
Get
(
offset
.
Int64
(),
size
.
Int64
()))
data
:=
crypto
.
Sha3
(
mem
.
Get
(
offset
.
Int64
(),
size
.
Int64
()))
stack
.
Push
(
ethutil
.
BigD
(
data
))
stack
.
Push
(
ethutil
.
BigD
(
data
))
...
@@ -785,7 +785,7 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) {
...
@@ -785,7 +785,7 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) {
// Generate a new address
// Generate a new address
n
:=
state
.
GetNonce
(
closure
.
Address
())
n
:=
state
.
GetNonce
(
closure
.
Address
())
addr
:=
eth
crypto
.
CreateAddress
(
closure
.
Address
(),
n
)
addr
:=
crypto
.
CreateAddress
(
closure
.
Address
(),
n
)
state
.
SetNonce
(
closure
.
Address
(),
n
+
1
)
state
.
SetNonce
(
closure
.
Address
(),
n
+
1
)
self
.
Printf
(
" (*) %x"
,
addr
)
.
Endl
()
self
.
Printf
(
" (*) %x"
,
addr
)
.
Endl
()
...
...
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