Samples and disams cmd for evm code
This commit is contained in:
@ -35,6 +35,19 @@ import (
|
||||
"github.com/ethereum/go-ethereum/xeth"
|
||||
)
|
||||
|
||||
func toHex(b []byte) string {
|
||||
return "0x" + ethutil.Bytes2Hex(b)
|
||||
}
|
||||
func fromHex(s string) []byte {
|
||||
if len(s) > 1 {
|
||||
if s[0:2] == "0x" {
|
||||
s = s[2:]
|
||||
}
|
||||
return ethutil.Hex2Bytes(s)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type RpcServer interface {
|
||||
Start()
|
||||
Stop()
|
||||
@ -163,7 +176,7 @@ func (p *EthereumApi) GetCodeAt(args *GetCodeAtArgs, reply *interface{}) error {
|
||||
}
|
||||
|
||||
func (p *EthereumApi) Sha3(args *Sha3Args, reply *interface{}) error {
|
||||
*reply = ethutil.Bytes2Hex(crypto.Sha3(ethutil.Hex2Bytes(args.Data)))
|
||||
*reply = toHex(crypto.Sha3(fromHex(args.Data)))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user