mirror of https://github.com/ethereum/go-ethereum
commit
bab78bbeb6
Binary file not shown.
Binary file not shown.
@ -0,0 +1,40 @@ |
|||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"crypto/elliptic" |
||||||
|
"fmt" |
||||||
|
"log" |
||||||
|
"net" |
||||||
|
"os" |
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/crypto" |
||||||
|
"github.com/ethereum/go-ethereum/logger" |
||||||
|
"github.com/ethereum/go-ethereum/p2p" |
||||||
|
) |
||||||
|
|
||||||
|
func main() { |
||||||
|
logger.AddLogSystem(logger.NewStdLogSystem(os.Stdout, log.LstdFlags, logger.InfoLevel)) |
||||||
|
key, _ := crypto.GenerateKey() |
||||||
|
marshaled := elliptic.Marshal(crypto.S256(), key.PublicKey.X, key.PublicKey.Y) |
||||||
|
|
||||||
|
srv := p2p.Server{ |
||||||
|
MaxPeers: 10, |
||||||
|
Identity: p2p.NewSimpleClientIdentity("Ethereum(G)", "0.1", "Peer Server Two", string(marshaled)), |
||||||
|
ListenAddr: ":30301", |
||||||
|
NAT: p2p.UPNP(), |
||||||
|
} |
||||||
|
if err := srv.Start(); err != nil { |
||||||
|
fmt.Println("could not start server:", err) |
||||||
|
os.Exit(1) |
||||||
|
} |
||||||
|
|
||||||
|
// add seed peers
|
||||||
|
seed, err := net.ResolveTCPAddr("tcp", "poc-7.ethdev.com:30300") |
||||||
|
if err != nil { |
||||||
|
fmt.Println("couldn't resolve:", err) |
||||||
|
os.Exit(1) |
||||||
|
} |
||||||
|
srv.SuggestPeer(seed.IP, seed.Port, nil) |
||||||
|
|
||||||
|
select {} |
||||||
|
} |
@ -0,0 +1 @@ |
|||||||
|
package core |
@ -0,0 +1,363 @@ |
|||||||
|
package crypto |
||||||
|
|
||||||
|
// Copyright 2010 The Go Authors. All rights reserved.
|
||||||
|
// Copyright 2011 ThePiachu. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Package bitelliptic implements several Koblitz elliptic curves over prime
|
||||||
|
// fields.
|
||||||
|
|
||||||
|
// This package operates, internally, on Jacobian coordinates. For a given
|
||||||
|
// (x, y) position on the curve, the Jacobian coordinates are (x1, y1, z1)
|
||||||
|
// where x = x1/z1² and y = y1/z1³. The greatest speedups come when the whole
|
||||||
|
// calculation can be performed within the transform (as in ScalarMult and
|
||||||
|
// ScalarBaseMult). But even for Add and Double, it's faster to apply and
|
||||||
|
// reverse the transform than to operate in affine coordinates.
|
||||||
|
|
||||||
|
import ( |
||||||
|
"crypto/elliptic" |
||||||
|
"io" |
||||||
|
"math/big" |
||||||
|
"sync" |
||||||
|
) |
||||||
|
|
||||||
|
// A BitCurve represents a Koblitz Curve with a=0.
|
||||||
|
// See http://www.hyperelliptic.org/EFD/g1p/auto-shortw.html
|
||||||
|
type BitCurve struct { |
||||||
|
P *big.Int // the order of the underlying field
|
||||||
|
N *big.Int // the order of the base point
|
||||||
|
B *big.Int // the constant of the BitCurve equation
|
||||||
|
Gx, Gy *big.Int // (x,y) of the base point
|
||||||
|
BitSize int // the size of the underlying field
|
||||||
|
} |
||||||
|
|
||||||
|
func (BitCurve *BitCurve) Params() *elliptic.CurveParams { |
||||||
|
return &elliptic.CurveParams{BitCurve.P, BitCurve.N, BitCurve.B, BitCurve.Gx, BitCurve.Gy, BitCurve.BitSize} |
||||||
|
} |
||||||
|
|
||||||
|
// IsOnBitCurve returns true if the given (x,y) lies on the BitCurve.
|
||||||
|
func (BitCurve *BitCurve) IsOnCurve(x, y *big.Int) bool { |
||||||
|
// y² = x³ + b
|
||||||
|
y2 := new(big.Int).Mul(y, y) //y²
|
||||||
|
y2.Mod(y2, BitCurve.P) //y²%P
|
||||||
|
|
||||||
|
x3 := new(big.Int).Mul(x, x) //x²
|
||||||
|
x3.Mul(x3, x) //x³
|
||||||
|
|
||||||
|
x3.Add(x3, BitCurve.B) //x³+B
|
||||||
|
x3.Mod(x3, BitCurve.P) //(x³+B)%P
|
||||||
|
|
||||||
|
return x3.Cmp(y2) == 0 |
||||||
|
} |
||||||
|
|
||||||
|
//TODO: double check if the function is okay
|
||||||
|
// affineFromJacobian reverses the Jacobian transform. See the comment at the
|
||||||
|
// top of the file.
|
||||||
|
func (BitCurve *BitCurve) affineFromJacobian(x, y, z *big.Int) (xOut, yOut *big.Int) { |
||||||
|
zinv := new(big.Int).ModInverse(z, BitCurve.P) |
||||||
|
zinvsq := new(big.Int).Mul(zinv, zinv) |
||||||
|
|
||||||
|
xOut = new(big.Int).Mul(x, zinvsq) |
||||||
|
xOut.Mod(xOut, BitCurve.P) |
||||||
|
zinvsq.Mul(zinvsq, zinv) |
||||||
|
yOut = new(big.Int).Mul(y, zinvsq) |
||||||
|
yOut.Mod(yOut, BitCurve.P) |
||||||
|
return |
||||||
|
} |
||||||
|
|
||||||
|
// Add returns the sum of (x1,y1) and (x2,y2)
|
||||||
|
func (BitCurve *BitCurve) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int) { |
||||||
|
z := new(big.Int).SetInt64(1) |
||||||
|
return BitCurve.affineFromJacobian(BitCurve.addJacobian(x1, y1, z, x2, y2, z)) |
||||||
|
} |
||||||
|
|
||||||
|
// addJacobian takes two points in Jacobian coordinates, (x1, y1, z1) and
|
||||||
|
// (x2, y2, z2) and returns their sum, also in Jacobian form.
|
||||||
|
func (BitCurve *BitCurve) addJacobian(x1, y1, z1, x2, y2, z2 *big.Int) (*big.Int, *big.Int, *big.Int) { |
||||||
|
// See http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-add-2007-bl
|
||||||
|
z1z1 := new(big.Int).Mul(z1, z1) |
||||||
|
z1z1.Mod(z1z1, BitCurve.P) |
||||||
|
z2z2 := new(big.Int).Mul(z2, z2) |
||||||
|
z2z2.Mod(z2z2, BitCurve.P) |
||||||
|
|
||||||
|
u1 := new(big.Int).Mul(x1, z2z2) |
||||||
|
u1.Mod(u1, BitCurve.P) |
||||||
|
u2 := new(big.Int).Mul(x2, z1z1) |
||||||
|
u2.Mod(u2, BitCurve.P) |
||||||
|
h := new(big.Int).Sub(u2, u1) |
||||||
|
if h.Sign() == -1 { |
||||||
|
h.Add(h, BitCurve.P) |
||||||
|
} |
||||||
|
i := new(big.Int).Lsh(h, 1) |
||||||
|
i.Mul(i, i) |
||||||
|
j := new(big.Int).Mul(h, i) |
||||||
|
|
||||||
|
s1 := new(big.Int).Mul(y1, z2) |
||||||
|
s1.Mul(s1, z2z2) |
||||||
|
s1.Mod(s1, BitCurve.P) |
||||||
|
s2 := new(big.Int).Mul(y2, z1) |
||||||
|
s2.Mul(s2, z1z1) |
||||||
|
s2.Mod(s2, BitCurve.P) |
||||||
|
r := new(big.Int).Sub(s2, s1) |
||||||
|
if r.Sign() == -1 { |
||||||
|
r.Add(r, BitCurve.P) |
||||||
|
} |
||||||
|
r.Lsh(r, 1) |
||||||
|
v := new(big.Int).Mul(u1, i) |
||||||
|
|
||||||
|
x3 := new(big.Int).Set(r) |
||||||
|
x3.Mul(x3, x3) |
||||||
|
x3.Sub(x3, j) |
||||||
|
x3.Sub(x3, v) |
||||||
|
x3.Sub(x3, v) |
||||||
|
x3.Mod(x3, BitCurve.P) |
||||||
|
|
||||||
|
y3 := new(big.Int).Set(r) |
||||||
|
v.Sub(v, x3) |
||||||
|
y3.Mul(y3, v) |
||||||
|
s1.Mul(s1, j) |
||||||
|
s1.Lsh(s1, 1) |
||||||
|
y3.Sub(y3, s1) |
||||||
|
y3.Mod(y3, BitCurve.P) |
||||||
|
|
||||||
|
z3 := new(big.Int).Add(z1, z2) |
||||||
|
z3.Mul(z3, z3) |
||||||
|
z3.Sub(z3, z1z1) |
||||||
|
if z3.Sign() == -1 { |
||||||
|
z3.Add(z3, BitCurve.P) |
||||||
|
} |
||||||
|
z3.Sub(z3, z2z2) |
||||||
|
if z3.Sign() == -1 { |
||||||
|
z3.Add(z3, BitCurve.P) |
||||||
|
} |
||||||
|
z3.Mul(z3, h) |
||||||
|
z3.Mod(z3, BitCurve.P) |
||||||
|
|
||||||
|
return x3, y3, z3 |
||||||
|
} |
||||||
|
|
||||||
|
// Double returns 2*(x,y)
|
||||||
|
func (BitCurve *BitCurve) Double(x1, y1 *big.Int) (*big.Int, *big.Int) { |
||||||
|
z1 := new(big.Int).SetInt64(1) |
||||||
|
return BitCurve.affineFromJacobian(BitCurve.doubleJacobian(x1, y1, z1)) |
||||||
|
} |
||||||
|
|
||||||
|
// doubleJacobian takes a point in Jacobian coordinates, (x, y, z), and
|
||||||
|
// returns its double, also in Jacobian form.
|
||||||
|
func (BitCurve *BitCurve) doubleJacobian(x, y, z *big.Int) (*big.Int, *big.Int, *big.Int) { |
||||||
|
// See http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l
|
||||||
|
|
||||||
|
a := new(big.Int).Mul(x, x) //X1²
|
||||||
|
b := new(big.Int).Mul(y, y) //Y1²
|
||||||
|
c := new(big.Int).Mul(b, b) //B²
|
||||||
|
|
||||||
|
d := new(big.Int).Add(x, b) //X1+B
|
||||||
|
d.Mul(d, d) //(X1+B)²
|
||||||
|
d.Sub(d, a) //(X1+B)²-A
|
||||||
|
d.Sub(d, c) //(X1+B)²-A-C
|
||||||
|
d.Mul(d, big.NewInt(2)) //2*((X1+B)²-A-C)
|
||||||
|
|
||||||
|
e := new(big.Int).Mul(big.NewInt(3), a) //3*A
|
||||||
|
f := new(big.Int).Mul(e, e) //E²
|
||||||
|
|
||||||
|
x3 := new(big.Int).Mul(big.NewInt(2), d) //2*D
|
||||||
|
x3.Sub(f, x3) //F-2*D
|
||||||
|
x3.Mod(x3, BitCurve.P) |
||||||
|
|
||||||
|
y3 := new(big.Int).Sub(d, x3) //D-X3
|
||||||
|
y3.Mul(e, y3) //E*(D-X3)
|
||||||
|
y3.Sub(y3, new(big.Int).Mul(big.NewInt(8), c)) //E*(D-X3)-8*C
|
||||||
|
y3.Mod(y3, BitCurve.P) |
||||||
|
|
||||||
|
z3 := new(big.Int).Mul(y, z) //Y1*Z1
|
||||||
|
z3.Mul(big.NewInt(2), z3) //3*Y1*Z1
|
||||||
|
z3.Mod(z3, BitCurve.P) |
||||||
|
|
||||||
|
return x3, y3, z3 |
||||||
|
} |
||||||
|
|
||||||
|
//TODO: double check if it is okay
|
||||||
|
// ScalarMult returns k*(Bx,By) where k is a number in big-endian form.
|
||||||
|
func (BitCurve *BitCurve) ScalarMult(Bx, By *big.Int, k []byte) (*big.Int, *big.Int) { |
||||||
|
// We have a slight problem in that the identity of the group (the
|
||||||
|
// point at infinity) cannot be represented in (x, y) form on a finite
|
||||||
|
// machine. Thus the standard add/double algorithm has to be tweaked
|
||||||
|
// slightly: our initial state is not the identity, but x, and we
|
||||||
|
// ignore the first true bit in |k|. If we don't find any true bits in
|
||||||
|
// |k|, then we return nil, nil, because we cannot return the identity
|
||||||
|
// element.
|
||||||
|
|
||||||
|
Bz := new(big.Int).SetInt64(1) |
||||||
|
x := Bx |
||||||
|
y := By |
||||||
|
z := Bz |
||||||
|
|
||||||
|
seenFirstTrue := false |
||||||
|
for _, byte := range k { |
||||||
|
for bitNum := 0; bitNum < 8; bitNum++ { |
||||||
|
if seenFirstTrue { |
||||||
|
x, y, z = BitCurve.doubleJacobian(x, y, z) |
||||||
|
} |
||||||
|
if byte&0x80 == 0x80 { |
||||||
|
if !seenFirstTrue { |
||||||
|
seenFirstTrue = true |
||||||
|
} else { |
||||||
|
x, y, z = BitCurve.addJacobian(Bx, By, Bz, x, y, z) |
||||||
|
} |
||||||
|
} |
||||||
|
byte <<= 1 |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if !seenFirstTrue { |
||||||
|
return nil, nil |
||||||
|
} |
||||||
|
|
||||||
|
return BitCurve.affineFromJacobian(x, y, z) |
||||||
|
} |
||||||
|
|
||||||
|
// ScalarBaseMult returns k*G, where G is the base point of the group and k is
|
||||||
|
// an integer in big-endian form.
|
||||||
|
func (BitCurve *BitCurve) ScalarBaseMult(k []byte) (*big.Int, *big.Int) { |
||||||
|
return BitCurve.ScalarMult(BitCurve.Gx, BitCurve.Gy, k) |
||||||
|
} |
||||||
|
|
||||||
|
var mask = []byte{0xff, 0x1, 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f} |
||||||
|
|
||||||
|
//TODO: double check if it is okay
|
||||||
|
// GenerateKey returns a public/private key pair. The private key is generated
|
||||||
|
// using the given reader, which must return random data.
|
||||||
|
func (BitCurve *BitCurve) GenerateKey(rand io.Reader) (priv []byte, x, y *big.Int, err error) { |
||||||
|
byteLen := (BitCurve.BitSize + 7) >> 3 |
||||||
|
priv = make([]byte, byteLen) |
||||||
|
|
||||||
|
for x == nil { |
||||||
|
_, err = io.ReadFull(rand, priv) |
||||||
|
if err != nil { |
||||||
|
return |
||||||
|
} |
||||||
|
// We have to mask off any excess bits in the case that the size of the
|
||||||
|
// underlying field is not a whole number of bytes.
|
||||||
|
priv[0] &= mask[BitCurve.BitSize%8] |
||||||
|
// This is because, in tests, rand will return all zeros and we don't
|
||||||
|
// want to get the point at infinity and loop forever.
|
||||||
|
priv[1] ^= 0x42 |
||||||
|
x, y = BitCurve.ScalarBaseMult(priv) |
||||||
|
} |
||||||
|
return |
||||||
|
} |
||||||
|
|
||||||
|
// Marshal converts a point into the form specified in section 4.3.6 of ANSI
|
||||||
|
// X9.62.
|
||||||
|
func (BitCurve *BitCurve) Marshal(x, y *big.Int) []byte { |
||||||
|
byteLen := (BitCurve.BitSize + 7) >> 3 |
||||||
|
|
||||||
|
ret := make([]byte, 1+2*byteLen) |
||||||
|
ret[0] = 4 // uncompressed point
|
||||||
|
|
||||||
|
xBytes := x.Bytes() |
||||||
|
copy(ret[1+byteLen-len(xBytes):], xBytes) |
||||||
|
yBytes := y.Bytes() |
||||||
|
copy(ret[1+2*byteLen-len(yBytes):], yBytes) |
||||||
|
return ret |
||||||
|
} |
||||||
|
|
||||||
|
// Unmarshal converts a point, serialised by Marshal, into an x, y pair. On
|
||||||
|
// error, x = nil.
|
||||||
|
func (BitCurve *BitCurve) Unmarshal(data []byte) (x, y *big.Int) { |
||||||
|
byteLen := (BitCurve.BitSize + 7) >> 3 |
||||||
|
if len(data) != 1+2*byteLen { |
||||||
|
return |
||||||
|
} |
||||||
|
if data[0] != 4 { // uncompressed form
|
||||||
|
return |
||||||
|
} |
||||||
|
x = new(big.Int).SetBytes(data[1 : 1+byteLen]) |
||||||
|
y = new(big.Int).SetBytes(data[1+byteLen:]) |
||||||
|
return |
||||||
|
} |
||||||
|
|
||||||
|
//curve parameters taken from:
|
||||||
|
//http://www.secg.org/collateral/sec2_final.pdf
|
||||||
|
|
||||||
|
var initonce sync.Once |
||||||
|
var ecp160k1 *BitCurve |
||||||
|
var ecp192k1 *BitCurve |
||||||
|
var ecp224k1 *BitCurve |
||||||
|
var ecp256k1 *BitCurve |
||||||
|
|
||||||
|
func initAll() { |
||||||
|
initS160() |
||||||
|
initS192() |
||||||
|
initS224() |
||||||
|
initS256() |
||||||
|
} |
||||||
|
|
||||||
|
func initS160() { |
||||||
|
// See SEC 2 section 2.4.1
|
||||||
|
ecp160k1 = new(BitCurve) |
||||||
|
ecp160k1.P, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73", 16) |
||||||
|
ecp160k1.N, _ = new(big.Int).SetString("0100000000000000000001B8FA16DFAB9ACA16B6B3", 16) |
||||||
|
ecp160k1.B, _ = new(big.Int).SetString("0000000000000000000000000000000000000007", 16) |
||||||
|
ecp160k1.Gx, _ = new(big.Int).SetString("3B4C382CE37AA192A4019E763036F4F5DD4D7EBB", 16) |
||||||
|
ecp160k1.Gy, _ = new(big.Int).SetString("938CF935318FDCED6BC28286531733C3F03C4FEE", 16) |
||||||
|
ecp160k1.BitSize = 160 |
||||||
|
} |
||||||
|
|
||||||
|
func initS192() { |
||||||
|
// See SEC 2 section 2.5.1
|
||||||
|
ecp192k1 = new(BitCurve) |
||||||
|
ecp192k1.P, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37", 16) |
||||||
|
ecp192k1.N, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D", 16) |
||||||
|
ecp192k1.B, _ = new(big.Int).SetString("000000000000000000000000000000000000000000000003", 16) |
||||||
|
ecp192k1.Gx, _ = new(big.Int).SetString("DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D", 16) |
||||||
|
ecp192k1.Gy, _ = new(big.Int).SetString("9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D", 16) |
||||||
|
ecp192k1.BitSize = 192 |
||||||
|
} |
||||||
|
|
||||||
|
func initS224() { |
||||||
|
// See SEC 2 section 2.6.1
|
||||||
|
ecp224k1 = new(BitCurve) |
||||||
|
ecp224k1.P, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFE56D", 16) |
||||||
|
ecp224k1.N, _ = new(big.Int).SetString("010000000000000000000000000001DCE8D2EC6184CAF0A971769FB1F7", 16) |
||||||
|
ecp224k1.B, _ = new(big.Int).SetString("00000000000000000000000000000000000000000000000000000005", 16) |
||||||
|
ecp224k1.Gx, _ = new(big.Int).SetString("A1455B334DF099DF30FC28A169A467E9E47075A90F7E650EB6B7A45C", 16) |
||||||
|
ecp224k1.Gy, _ = new(big.Int).SetString("7E089FED7FBA344282CAFBD6F7E319F7C0B0BD59E2CA4BDB556D61A5", 16) |
||||||
|
ecp224k1.BitSize = 224 |
||||||
|
} |
||||||
|
|
||||||
|
func initS256() { |
||||||
|
// See SEC 2 section 2.7.1
|
||||||
|
ecp256k1 = new(BitCurve) |
||||||
|
ecp256k1.P, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F", 16) |
||||||
|
ecp256k1.N, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", 16) |
||||||
|
ecp256k1.B, _ = new(big.Int).SetString("0000000000000000000000000000000000000000000000000000000000000007", 16) |
||||||
|
ecp256k1.Gx, _ = new(big.Int).SetString("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798", 16) |
||||||
|
ecp256k1.Gy, _ = new(big.Int).SetString("483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8", 16) |
||||||
|
ecp256k1.BitSize = 256 |
||||||
|
} |
||||||
|
|
||||||
|
// S160 returns a BitCurve which implements secp160k1 (see SEC 2 section 2.4.1)
|
||||||
|
func S160() *BitCurve { |
||||||
|
initonce.Do(initAll) |
||||||
|
return ecp160k1 |
||||||
|
} |
||||||
|
|
||||||
|
// S192 returns a BitCurve which implements secp192k1 (see SEC 2 section 2.5.1)
|
||||||
|
func S192() *BitCurve { |
||||||
|
initonce.Do(initAll) |
||||||
|
return ecp192k1 |
||||||
|
} |
||||||
|
|
||||||
|
// S224 returns a BitCurve which implements secp224k1 (see SEC 2 section 2.6.1)
|
||||||
|
func S224() *BitCurve { |
||||||
|
initonce.Do(initAll) |
||||||
|
return ecp224k1 |
||||||
|
} |
||||||
|
|
||||||
|
// S256 returns a BitCurve which implements secp256k1 (see SEC 2 section 2.7.1)
|
||||||
|
func S256() *BitCurve { |
||||||
|
initonce.Do(initAll) |
||||||
|
return ecp256k1 |
||||||
|
} |
@ -0,0 +1,40 @@ |
|||||||
|
package crypto |
||||||
|
|
||||||
|
import ( |
||||||
|
"bytes" |
||||||
|
"fmt" |
||||||
|
"testing" |
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/ethutil" |
||||||
|
) |
||||||
|
|
||||||
|
func TestBox(t *testing.T) { |
||||||
|
prv1 := ToECDSA(ethutil.Hex2Bytes("4b50fa71f5c3eeb8fdc452224b2395af2fcc3d125e06c32c82e048c0559db03f")) |
||||||
|
prv2 := ToECDSA(ethutil.Hex2Bytes("d0b043b4c5d657670778242d82d68a29d25d7d711127d17b8e299f156dad361a")) |
||||||
|
pub2 := ToECDSAPub(ethutil.Hex2Bytes("04bd27a63c91fe3233c5777e6d3d7b39204d398c8f92655947eb5a373d46e1688f022a1632d264725cbc7dc43ee1cfebde42fa0a86d08b55d2acfbb5e9b3b48dc5")) |
||||||
|
|
||||||
|
message := []byte("Hello, world.") |
||||||
|
ct, err := Encrypt(pub2, message) |
||||||
|
if err != nil { |
||||||
|
fmt.Println(err.Error()) |
||||||
|
t.FailNow() |
||||||
|
} |
||||||
|
|
||||||
|
pt, err := Decrypt(prv2, ct) |
||||||
|
if err != nil { |
||||||
|
fmt.Println(err.Error()) |
||||||
|
t.FailNow() |
||||||
|
} |
||||||
|
|
||||||
|
if !bytes.Equal(pt, message) { |
||||||
|
fmt.Println("ecies: plaintext doesn't match message") |
||||||
|
t.FailNow() |
||||||
|
} |
||||||
|
|
||||||
|
_, err = Decrypt(prv1, pt) |
||||||
|
if err == nil { |
||||||
|
fmt.Println("ecies: encryption should not have succeeded") |
||||||
|
t.FailNow() |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,70 @@ |
|||||||
|
package filter |
||||||
|
|
||||||
|
import "reflect" |
||||||
|
|
||||||
|
type Filter interface { |
||||||
|
Compare(Filter) bool |
||||||
|
Trigger(data interface{}) |
||||||
|
} |
||||||
|
|
||||||
|
type FilterEvent struct { |
||||||
|
filter Filter |
||||||
|
data interface{} |
||||||
|
} |
||||||
|
|
||||||
|
type Filters struct { |
||||||
|
id int |
||||||
|
watchers map[int]Filter |
||||||
|
ch chan FilterEvent |
||||||
|
|
||||||
|
quit chan struct{} |
||||||
|
} |
||||||
|
|
||||||
|
func New() *Filters { |
||||||
|
return &Filters{ |
||||||
|
ch: make(chan FilterEvent), |
||||||
|
watchers: make(map[int]Filter), |
||||||
|
quit: make(chan struct{}), |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
func (self *Filters) Start() { |
||||||
|
go self.loop() |
||||||
|
} |
||||||
|
|
||||||
|
func (self *Filters) Stop() { |
||||||
|
close(self.quit) |
||||||
|
} |
||||||
|
|
||||||
|
func (self *Filters) Notify(filter Filter, data interface{}) { |
||||||
|
self.ch <- FilterEvent{filter, data} |
||||||
|
} |
||||||
|
|
||||||
|
func (self *Filters) Install(watcher Filter) int { |
||||||
|
self.watchers[self.id] = watcher |
||||||
|
self.id++ |
||||||
|
|
||||||
|
return self.id - 1 |
||||||
|
} |
||||||
|
|
||||||
|
func (self *Filters) Uninstall(id int) { |
||||||
|
delete(self.watchers, id) |
||||||
|
} |
||||||
|
|
||||||
|
func (self *Filters) loop() { |
||||||
|
out: |
||||||
|
for { |
||||||
|
select { |
||||||
|
case <-self.quit: |
||||||
|
break out |
||||||
|
case event := <-self.ch: |
||||||
|
for _, watcher := range self.watchers { |
||||||
|
if reflect.TypeOf(watcher) == reflect.TypeOf(event.filter) { |
||||||
|
if watcher.Compare(event.filter) { |
||||||
|
watcher.Trigger(event.data) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,34 @@ |
|||||||
|
package filter |
||||||
|
|
||||||
|
import "testing" |
||||||
|
|
||||||
|
func TestFilters(t *testing.T) { |
||||||
|
var success bool |
||||||
|
var failure bool |
||||||
|
|
||||||
|
fm := New() |
||||||
|
fm.Start() |
||||||
|
fm.Install(Generic{ |
||||||
|
Str1: "hello", |
||||||
|
Fn: func(data interface{}) { |
||||||
|
success = data.(bool) |
||||||
|
}, |
||||||
|
}) |
||||||
|
fm.Install(Generic{ |
||||||
|
Str1: "hello1", |
||||||
|
Str2: "hello", |
||||||
|
Fn: func(data interface{}) { |
||||||
|
failure = true |
||||||
|
}, |
||||||
|
}) |
||||||
|
fm.Notify(Generic{Str1: "hello"}, true) |
||||||
|
fm.Stop() |
||||||
|
|
||||||
|
if !success { |
||||||
|
t.Error("expected 'hello' to be posted") |
||||||
|
} |
||||||
|
|
||||||
|
if failure { |
||||||
|
t.Error("hello1 was triggered") |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,22 @@ |
|||||||
|
package filter |
||||||
|
|
||||||
|
type Generic struct { |
||||||
|
Str1, Str2, Str3 string |
||||||
|
|
||||||
|
Fn func(data interface{}) |
||||||
|
} |
||||||
|
|
||||||
|
func (self Generic) Compare(f Filter) bool { |
||||||
|
filter := f.(Generic) |
||||||
|
if (len(self.Str1) == 0 || filter.Str1 == self.Str1) && |
||||||
|
(len(self.Str2) == 0 || filter.Str2 == self.Str2) && |
||||||
|
(len(self.Str3) == 0 || filter.Str3 == self.Str3) { |
||||||
|
return true |
||||||
|
} |
||||||
|
|
||||||
|
return false |
||||||
|
} |
||||||
|
|
||||||
|
func (self Generic) Trigger(data interface{}) { |
||||||
|
self.Fn(data) |
||||||
|
} |
@ -0,0 +1,58 @@ |
|||||||
|
package p2p |
||||||
|
|
||||||
|
import ( |
||||||
|
"fmt" |
||||||
|
"testing" |
||||||
|
) |
||||||
|
|
||||||
|
func TestBaseProtocolDisconnect(t *testing.T) { |
||||||
|
peer := NewPeer(NewSimpleClientIdentity("p1", "", "", "foo"), nil) |
||||||
|
peer.ourID = NewSimpleClientIdentity("p2", "", "", "bar") |
||||||
|
peer.pubkeyHook = func(*peerAddr) error { return nil } |
||||||
|
|
||||||
|
rw1, rw2 := MsgPipe() |
||||||
|
done := make(chan struct{}) |
||||||
|
go func() { |
||||||
|
if err := expectMsg(rw2, handshakeMsg); err != nil { |
||||||
|
t.Error(err) |
||||||
|
} |
||||||
|
err := rw2.EncodeMsg(handshakeMsg, |
||||||
|
baseProtocolVersion, |
||||||
|
"", |
||||||
|
[]interface{}{}, |
||||||
|
0, |
||||||
|
make([]byte, 64), |
||||||
|
) |
||||||
|
if err != nil { |
||||||
|
t.Error(err) |
||||||
|
} |
||||||
|
if err := expectMsg(rw2, getPeersMsg); err != nil { |
||||||
|
t.Error(err) |
||||||
|
} |
||||||
|
if err := rw2.EncodeMsg(discMsg, DiscQuitting); err != nil { |
||||||
|
t.Error(err) |
||||||
|
} |
||||||
|
close(done) |
||||||
|
}() |
||||||
|
|
||||||
|
if err := runBaseProtocol(peer, rw1); err == nil { |
||||||
|
t.Errorf("base protocol returned without error") |
||||||
|
} else if reason, ok := err.(discRequestedError); !ok || reason != DiscQuitting { |
||||||
|
t.Errorf("base protocol returned wrong error: %v", err) |
||||||
|
} |
||||||
|
<-done |
||||||
|
} |
||||||
|
|
||||||
|
func expectMsg(r MsgReader, code uint64) error { |
||||||
|
msg, err := r.ReadMsg() |
||||||
|
if err != nil { |
||||||
|
return err |
||||||
|
} |
||||||
|
if err := msg.Discard(); err != nil { |
||||||
|
return err |
||||||
|
} |
||||||
|
if msg.Code != code { |
||||||
|
return fmt.Errorf("wrong message code: got %d, expected %d", msg.Code, code) |
||||||
|
} |
||||||
|
return nil |
||||||
|
} |
@ -0,0 +1,9 @@ |
|||||||
|
package pow |
||||||
|
|
||||||
|
import "math/big" |
||||||
|
|
||||||
|
type Block interface { |
||||||
|
Diff() *big.Int |
||||||
|
HashNoNonce() []byte |
||||||
|
N() []byte |
||||||
|
} |
@ -0,0 +1,89 @@ |
|||||||
|
package ezp |
||||||
|
|
||||||
|
import ( |
||||||
|
"math/big" |
||||||
|
"math/rand" |
||||||
|
"time" |
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/crypto" |
||||||
|
"github.com/ethereum/go-ethereum/ethutil" |
||||||
|
"github.com/ethereum/go-ethereum/logger" |
||||||
|
"github.com/ethereum/go-ethereum/pow" |
||||||
|
"github.com/obscuren/sha3" |
||||||
|
) |
||||||
|
|
||||||
|
var powlogger = logger.NewLogger("POW") |
||||||
|
|
||||||
|
type EasyPow struct { |
||||||
|
hash *big.Int |
||||||
|
HashRate int64 |
||||||
|
turbo bool |
||||||
|
} |
||||||
|
|
||||||
|
func New() *EasyPow { |
||||||
|
return &EasyPow{turbo: true} |
||||||
|
} |
||||||
|
|
||||||
|
func (pow *EasyPow) GetHashrate() int64 { |
||||||
|
return pow.HashRate |
||||||
|
} |
||||||
|
|
||||||
|
func (pow *EasyPow) Turbo(on bool) { |
||||||
|
pow.turbo = on |
||||||
|
} |
||||||
|
|
||||||
|
func (pow *EasyPow) Search(block pow.Block, stop <-chan struct{}) []byte { |
||||||
|
r := rand.New(rand.NewSource(time.Now().UnixNano())) |
||||||
|
hash := block.HashNoNonce() |
||||||
|
diff := block.Diff() |
||||||
|
i := int64(0) |
||||||
|
start := time.Now().UnixNano() |
||||||
|
t := time.Now() |
||||||
|
|
||||||
|
for { |
||||||
|
select { |
||||||
|
case <-stop: |
||||||
|
powlogger.Infoln("Breaking from mining") |
||||||
|
pow.HashRate = 0 |
||||||
|
return nil |
||||||
|
default: |
||||||
|
i++ |
||||||
|
|
||||||
|
if time.Since(t) > (1 * time.Second) { |
||||||
|
elapsed := time.Now().UnixNano() - start |
||||||
|
hashes := ((float64(1e9) / float64(elapsed)) * float64(i)) / 1000 |
||||||
|
pow.HashRate = int64(hashes) |
||||||
|
powlogger.Infoln("Hashing @", pow.HashRate, "khash") |
||||||
|
|
||||||
|
t = time.Now() |
||||||
|
} |
||||||
|
|
||||||
|
sha := crypto.Sha3(big.NewInt(r.Int63()).Bytes()) |
||||||
|
if pow.verify(hash, diff, sha) { |
||||||
|
return sha |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if !pow.turbo { |
||||||
|
time.Sleep(20 * time.Microsecond) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return nil |
||||||
|
} |
||||||
|
|
||||||
|
func (pow *EasyPow) verify(hash []byte, diff *big.Int, nonce []byte) bool { |
||||||
|
sha := sha3.NewKeccak256() |
||||||
|
|
||||||
|
d := append(hash, nonce...) |
||||||
|
sha.Write(d) |
||||||
|
|
||||||
|
verification := new(big.Int).Div(ethutil.BigPow(2, 256), diff) |
||||||
|
res := ethutil.U256(ethutil.BigD(sha.Sum(nil))) |
||||||
|
|
||||||
|
return res.Cmp(verification) <= 0 |
||||||
|
} |
||||||
|
|
||||||
|
func (pow *EasyPow) Verify(block pow.Block) bool { |
||||||
|
return pow.verify(block.HashNoNonce(), block.Diff(), block.N()) |
||||||
|
} |
@ -0,0 +1,8 @@ |
|||||||
|
package pow |
||||||
|
|
||||||
|
type PoW interface { |
||||||
|
Search(block Block, stop <-chan struct{}) []byte |
||||||
|
Verify(block Block) bool |
||||||
|
GetHashrate() int64 |
||||||
|
Turbo(bool) |
||||||
|
} |
@ -0,0 +1,870 @@ |
|||||||
|
{ |
||||||
|
"CallRecursiveContract" : { |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", |
||||||
|
"currentDifficulty" : "45678256", |
||||||
|
"currentGasLimit" : "1000000", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : 1, |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"04110d816c380812a427968ece99b1c963dfbce6" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x04110d816c380812a427968ece99b1c963dfbce6" |
||||||
|
} |
||||||
|
}, |
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : { |
||||||
|
"balance" : "1", |
||||||
|
"code" : "0x3060025560206000600039602060006000f0", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87" |
||||||
|
} |
||||||
|
}, |
||||||
|
"0a517d755cebbf66312b30fff713666a9cb917e0" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x0a517d755cebbf66312b30fff713666a9cb917e0" |
||||||
|
} |
||||||
|
}, |
||||||
|
"24dd378f51adc67a50e339e8031fe9bd4aafab36" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x24dd378f51adc67a50e339e8031fe9bd4aafab36" |
||||||
|
} |
||||||
|
}, |
||||||
|
"293f982d000532a7861ab122bdc4bbfd26bf9030" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x293f982d000532a7861ab122bdc4bbfd26bf9030" |
||||||
|
} |
||||||
|
}, |
||||||
|
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { |
||||||
|
"balance" : "10000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"2cf5732f017b0cf1b1f13a1478e10239716bf6b5" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x2cf5732f017b0cf1b1f13a1478e10239716bf6b5" |
||||||
|
} |
||||||
|
}, |
||||||
|
"31c640b92c21a1f1465c91070b4b3b4d6854195f" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"37f998764813b136ddf5a754f34063fd03065e36" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x37f998764813b136ddf5a754f34063fd03065e36" |
||||||
|
} |
||||||
|
}, |
||||||
|
"37fa399a749c121f8a15ce77e3d9f9bec8020d7a" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x37fa399a749c121f8a15ce77e3d9f9bec8020d7a" |
||||||
|
} |
||||||
|
}, |
||||||
|
"4f36659fa632310b6ec438dea4085b522a2dd077" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x4f36659fa632310b6ec438dea4085b522a2dd077" |
||||||
|
} |
||||||
|
}, |
||||||
|
"62c01474f089b07dae603491675dc5b5748f7049" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x62c01474f089b07dae603491675dc5b5748f7049" |
||||||
|
} |
||||||
|
}, |
||||||
|
"729af7294be595a0efd7d891c9e51f89c07950c7" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x729af7294be595a0efd7d891c9e51f89c07950c7" |
||||||
|
} |
||||||
|
}, |
||||||
|
"83e3e5a16d3b696a0314b30b2534804dd5e11197" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x83e3e5a16d3b696a0314b30b2534804dd5e11197" |
||||||
|
} |
||||||
|
}, |
||||||
|
"8703df2417e0d7c59d063caa9583cb10a4d20532" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x8703df2417e0d7c59d063caa9583cb10a4d20532" |
||||||
|
} |
||||||
|
}, |
||||||
|
"8dffcd74e5b5923512916c6a64b502689cfa65e1" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x8dffcd74e5b5923512916c6a64b502689cfa65e1" |
||||||
|
} |
||||||
|
}, |
||||||
|
"95a4d7cccb5204733874fa87285a176fe1e9e240" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x95a4d7cccb5204733874fa87285a176fe1e9e240" |
||||||
|
} |
||||||
|
}, |
||||||
|
"99b2fcba8120bedd048fe79f5262a6690ed38c39" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x99b2fcba8120bedd048fe79f5262a6690ed38c39" |
||||||
|
} |
||||||
|
}, |
||||||
|
"a4202b8b8afd5354e3e40a219bdc17f6001bf2cf" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0xa4202b8b8afd5354e3e40a219bdc17f6001bf2cf" |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "89999", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"a9647f4a0a14042d91dc33c0328030a7157c93ae" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0xa9647f4a0a14042d91dc33c0328030a7157c93ae" |
||||||
|
} |
||||||
|
}, |
||||||
|
"aa6cffe5185732689c18f37a7f86170cb7304c2a" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0xaa6cffe5185732689c18f37a7f86170cb7304c2a" |
||||||
|
} |
||||||
|
}, |
||||||
|
"aae4a2e3c51c04606dcb3723456e58f3ed214f45" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0xaae4a2e3c51c04606dcb3723456e58f3ed214f45" |
||||||
|
} |
||||||
|
}, |
||||||
|
"c37a43e940dfb5baf581a0b82b351d48305fc885" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0xc37a43e940dfb5baf581a0b82b351d48305fc885" |
||||||
|
} |
||||||
|
}, |
||||||
|
"d2571607e241ecf590ed94b12d87c94babe36db6" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0xd2571607e241ecf590ed94b12d87c94babe36db6" |
||||||
|
} |
||||||
|
}, |
||||||
|
"f735071cbee190d76b704ce68384fc21e389fbe7" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0xf735071cbee190d76b704ce68384fc21e389fbe7" |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x3060025560206000600039602060006000f0", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "100000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"transaction" : { |
||||||
|
"data" : "0x00", |
||||||
|
"gasLimit" : "10000", |
||||||
|
"gasPrice" : "1", |
||||||
|
"nonce" : "0", |
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", |
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", |
||||||
|
"value" : "1" |
||||||
|
} |
||||||
|
}, |
||||||
|
"CallTheContractToCreateContractWithInitCode" : { |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", |
||||||
|
"currentDifficulty" : "45678256", |
||||||
|
"currentGasLimit" : "1000000", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : 1, |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"04110d816c380812a427968ece99b1c963dfbce6" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x04110d816c380812a427968ece99b1c963dfbce6" |
||||||
|
} |
||||||
|
}, |
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : { |
||||||
|
"balance" : "10001", |
||||||
|
"code" : "0x3060025560206000600039602060006000f0", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87" |
||||||
|
} |
||||||
|
}, |
||||||
|
"0a517d755cebbf66312b30fff713666a9cb917e0" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x0a517d755cebbf66312b30fff713666a9cb917e0" |
||||||
|
} |
||||||
|
}, |
||||||
|
"24dd378f51adc67a50e339e8031fe9bd4aafab36" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x24dd378f51adc67a50e339e8031fe9bd4aafab36" |
||||||
|
} |
||||||
|
}, |
||||||
|
"293f982d000532a7861ab122bdc4bbfd26bf9030" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x293f982d000532a7861ab122bdc4bbfd26bf9030" |
||||||
|
} |
||||||
|
}, |
||||||
|
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { |
||||||
|
"balance" : "10000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"2cf5732f017b0cf1b1f13a1478e10239716bf6b5" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x2cf5732f017b0cf1b1f13a1478e10239716bf6b5" |
||||||
|
} |
||||||
|
}, |
||||||
|
"31c640b92c21a1f1465c91070b4b3b4d6854195f" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"37f998764813b136ddf5a754f34063fd03065e36" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x37f998764813b136ddf5a754f34063fd03065e36" |
||||||
|
} |
||||||
|
}, |
||||||
|
"37fa399a749c121f8a15ce77e3d9f9bec8020d7a" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x37fa399a749c121f8a15ce77e3d9f9bec8020d7a" |
||||||
|
} |
||||||
|
}, |
||||||
|
"4f36659fa632310b6ec438dea4085b522a2dd077" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x4f36659fa632310b6ec438dea4085b522a2dd077" |
||||||
|
} |
||||||
|
}, |
||||||
|
"62c01474f089b07dae603491675dc5b5748f7049" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x62c01474f089b07dae603491675dc5b5748f7049" |
||||||
|
} |
||||||
|
}, |
||||||
|
"729af7294be595a0efd7d891c9e51f89c07950c7" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x729af7294be595a0efd7d891c9e51f89c07950c7" |
||||||
|
} |
||||||
|
}, |
||||||
|
"83e3e5a16d3b696a0314b30b2534804dd5e11197" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x83e3e5a16d3b696a0314b30b2534804dd5e11197" |
||||||
|
} |
||||||
|
}, |
||||||
|
"8703df2417e0d7c59d063caa9583cb10a4d20532" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x8703df2417e0d7c59d063caa9583cb10a4d20532" |
||||||
|
} |
||||||
|
}, |
||||||
|
"8dffcd74e5b5923512916c6a64b502689cfa65e1" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x8dffcd74e5b5923512916c6a64b502689cfa65e1" |
||||||
|
} |
||||||
|
}, |
||||||
|
"95a4d7cccb5204733874fa87285a176fe1e9e240" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x95a4d7cccb5204733874fa87285a176fe1e9e240" |
||||||
|
} |
||||||
|
}, |
||||||
|
"99b2fcba8120bedd048fe79f5262a6690ed38c39" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0x99b2fcba8120bedd048fe79f5262a6690ed38c39" |
||||||
|
} |
||||||
|
}, |
||||||
|
"a4202b8b8afd5354e3e40a219bdc17f6001bf2cf" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0xa4202b8b8afd5354e3e40a219bdc17f6001bf2cf" |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "89999", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"a9647f4a0a14042d91dc33c0328030a7157c93ae" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0xa9647f4a0a14042d91dc33c0328030a7157c93ae" |
||||||
|
} |
||||||
|
}, |
||||||
|
"aa6cffe5185732689c18f37a7f86170cb7304c2a" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0xaa6cffe5185732689c18f37a7f86170cb7304c2a" |
||||||
|
} |
||||||
|
}, |
||||||
|
"aae4a2e3c51c04606dcb3723456e58f3ed214f45" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0xaae4a2e3c51c04606dcb3723456e58f3ed214f45" |
||||||
|
} |
||||||
|
}, |
||||||
|
"c37a43e940dfb5baf581a0b82b351d48305fc885" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0xc37a43e940dfb5baf581a0b82b351d48305fc885" |
||||||
|
} |
||||||
|
}, |
||||||
|
"d2571607e241ecf590ed94b12d87c94babe36db6" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0xd2571607e241ecf590ed94b12d87c94babe36db6" |
||||||
|
} |
||||||
|
}, |
||||||
|
"f735071cbee190d76b704ce68384fc21e389fbe7" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
"0x02" : "0xf735071cbee190d76b704ce68384fc21e389fbe7" |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : { |
||||||
|
"balance" : "10000", |
||||||
|
"code" : "0x3060025560206000600039602060006000f0", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "100000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"transaction" : { |
||||||
|
"data" : "0x00", |
||||||
|
"gasLimit" : "10000", |
||||||
|
"gasPrice" : "1", |
||||||
|
"nonce" : "0", |
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", |
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", |
||||||
|
"value" : "1" |
||||||
|
} |
||||||
|
}, |
||||||
|
"CallTheContractToCreateEmptyContract" : { |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", |
||||||
|
"currentDifficulty" : "45678256", |
||||||
|
"currentGasLimit" : "1000000", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : 1, |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : { |
||||||
|
"balance" : "1", |
||||||
|
"code" : "0x602060006000f0", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { |
||||||
|
"balance" : "605", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "99394", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"d2571607e241ecf590ed94b12d87c94babe36db6" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x602060006000f0", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "100000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"transaction" : { |
||||||
|
"data" : "0x00", |
||||||
|
"gasLimit" : "10000", |
||||||
|
"gasPrice" : "1", |
||||||
|
"nonce" : "0", |
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", |
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", |
||||||
|
"value" : "1" |
||||||
|
} |
||||||
|
}, |
||||||
|
"NotEnoughCashContractCreation" : { |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", |
||||||
|
"currentDifficulty" : "45678256", |
||||||
|
"currentGasLimit" : "1000000", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : 1, |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "2", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "2", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"transaction" : { |
||||||
|
"data" : "0x600a80600c6000396000f200600160008035811a8100", |
||||||
|
"gasLimit" : "599", |
||||||
|
"gasPrice" : "1", |
||||||
|
"nonce" : "0", |
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", |
||||||
|
"to" : "", |
||||||
|
"value" : "1" |
||||||
|
} |
||||||
|
}, |
||||||
|
"OutOfGasContractCreation" : { |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", |
||||||
|
"currentDifficulty" : "45678256", |
||||||
|
"currentGasLimit" : "1000000", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : 1, |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { |
||||||
|
"balance" : "1770", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"6295ee1b4f6dd65047762f924ecd367c17eabf8f" : { |
||||||
|
"balance" : "1", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "8229", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "10000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"transaction" : { |
||||||
|
"data" : "0x600a80600c6000396000f200600160008035811a8100", |
||||||
|
"gasLimit" : "590", |
||||||
|
"gasPrice" : "3", |
||||||
|
"nonce" : "0", |
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", |
||||||
|
"to" : "", |
||||||
|
"value" : "1" |
||||||
|
} |
||||||
|
}, |
||||||
|
"TransactionContractCreation" : { |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", |
||||||
|
"currentDifficulty" : "45678256", |
||||||
|
"currentGasLimit" : "1000000", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : 1, |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { |
||||||
|
"balance" : "599", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"6295ee1b4f6dd65047762f924ecd367c17eabf8f" : { |
||||||
|
"balance" : "1", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "99400", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "100000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"transaction" : { |
||||||
|
"data" : "0x600a80600c6000396000f200600160008035811a8100", |
||||||
|
"gasLimit" : "599", |
||||||
|
"gasPrice" : "1", |
||||||
|
"nonce" : "0", |
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", |
||||||
|
"to" : "", |
||||||
|
"value" : "1" |
||||||
|
} |
||||||
|
}, |
||||||
|
"TransactionCreateSuicideContract" : { |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", |
||||||
|
"currentDifficulty" : "45678256", |
||||||
|
"currentGasLimit" : "1000000", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : 1, |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { |
||||||
|
"balance" : "1000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"6295ee1b4f6dd65047762f924ecd367c17eabf8f" : { |
||||||
|
"balance" : "1", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "8999", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "10000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"transaction" : { |
||||||
|
"data" : "0x600a80600c6000396000f200ff600160008035811a81", |
||||||
|
"gasLimit" : "1000", |
||||||
|
"gasPrice" : "1", |
||||||
|
"nonce" : "0", |
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", |
||||||
|
"to" : "", |
||||||
|
"value" : "1" |
||||||
|
} |
||||||
|
}, |
||||||
|
"TransactionStopInitCode" : { |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", |
||||||
|
"currentDifficulty" : "45678256", |
||||||
|
"currentGasLimit" : "1000000", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : 1, |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { |
||||||
|
"balance" : "599", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"6295ee1b4f6dd65047762f924ecd367c17eabf8f" : { |
||||||
|
"balance" : "1", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "9400", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "10000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"transaction" : { |
||||||
|
"data" : "0x600a80600c600039600000f20000600160008035811a81", |
||||||
|
"gasLimit" : "1000", |
||||||
|
"gasPrice" : "1", |
||||||
|
"nonce" : "0", |
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", |
||||||
|
"to" : "", |
||||||
|
"value" : "1" |
||||||
|
} |
||||||
|
}, |
||||||
|
"TransactionSuicideInitCode" : { |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", |
||||||
|
"currentDifficulty" : "45678256", |
||||||
|
"currentGasLimit" : "1000000", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : 1, |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"0000000000000000000000000000000000000000" : { |
||||||
|
"balance" : "1", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { |
||||||
|
"balance" : "611", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "9388", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "10000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"transaction" : { |
||||||
|
"data" : "0x600a80600c6000396000fff2ffff600160008035811a81", |
||||||
|
"gasLimit" : "1000", |
||||||
|
"gasPrice" : "1", |
||||||
|
"nonce" : "0", |
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", |
||||||
|
"to" : "", |
||||||
|
"value" : "1" |
||||||
|
} |
||||||
|
} |
||||||
|
} |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,523 @@ |
|||||||
|
{ |
||||||
|
"refund500" : { |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", |
||||||
|
"currentDifficulty" : "256", |
||||||
|
"currentGasLimit" : "1000000", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : 1, |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : { |
||||||
|
"balance" : "1000000000000000000", |
||||||
|
"code" : "0x600154506002545060ff60020a600a553031600b55600060015560006002556000600355600060045560006005556000600655", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
"0x0a" : "0x8000000000000000000000000000000000000000000000000000000000000000", |
||||||
|
"0x0b" : "0x0de0b6b3a7640000" |
||||||
|
} |
||||||
|
}, |
||||||
|
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { |
||||||
|
"balance" : "592", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "9408", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : { |
||||||
|
"balance" : "1000000000000000000", |
||||||
|
"code" : "0x600154506002545060ff60020a600a553031600b55600060015560006002556000600355600060045560006005556000600655", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
"0x01" : "0x01", |
||||||
|
"0x02" : "0x01", |
||||||
|
"0x03" : "0x01", |
||||||
|
"0x04" : "0x01", |
||||||
|
"0x05" : "0x01", |
||||||
|
"0x06" : "0x01" |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "10000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"transaction" : { |
||||||
|
"data" : "", |
||||||
|
"gasLimit" : "10000", |
||||||
|
"gasPrice" : "1", |
||||||
|
"nonce" : "0", |
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", |
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", |
||||||
|
"value" : "0" |
||||||
|
} |
||||||
|
}, |
||||||
|
"refund50_1" : { |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", |
||||||
|
"currentDifficulty" : "256", |
||||||
|
"currentGasLimit" : "1000000", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : 1, |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : { |
||||||
|
"balance" : "1000000000000000000", |
||||||
|
"code" : "0x60006001556000600255600060035560006004556000600555", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { |
||||||
|
"balance" : "255", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "9745", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : { |
||||||
|
"balance" : "1000000000000000000", |
||||||
|
"code" : "0x60006001556000600255600060035560006004556000600555", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
"0x01" : "0x01", |
||||||
|
"0x02" : "0x01", |
||||||
|
"0x03" : "0x01", |
||||||
|
"0x04" : "0x01", |
||||||
|
"0x05" : "0x01" |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "10000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"transaction" : { |
||||||
|
"data" : "", |
||||||
|
"gasLimit" : "10000", |
||||||
|
"gasPrice" : "1", |
||||||
|
"nonce" : "0", |
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", |
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", |
||||||
|
"value" : "0" |
||||||
|
} |
||||||
|
}, |
||||||
|
"refund50_2" : { |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", |
||||||
|
"currentDifficulty" : "256", |
||||||
|
"currentGasLimit" : "1000000", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : 1, |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : { |
||||||
|
"balance" : "1000000000000000000", |
||||||
|
"code" : "0x6001600a556001600b5560006001556000600255600060035560006004556000600555", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
"0x0a" : "0x01", |
||||||
|
"0x0b" : "0x01" |
||||||
|
} |
||||||
|
}, |
||||||
|
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { |
||||||
|
"balance" : "614", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "9386", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : { |
||||||
|
"balance" : "1000000000000000000", |
||||||
|
"code" : "0x6001600a556001600b5560006001556000600255600060035560006004556000600555", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
"0x01" : "0x01", |
||||||
|
"0x02" : "0x01", |
||||||
|
"0x03" : "0x01", |
||||||
|
"0x04" : "0x01", |
||||||
|
"0x05" : "0x01" |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "10000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"transaction" : { |
||||||
|
"data" : "", |
||||||
|
"gasLimit" : "10000", |
||||||
|
"gasPrice" : "1", |
||||||
|
"nonce" : "0", |
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", |
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", |
||||||
|
"value" : "0" |
||||||
|
} |
||||||
|
}, |
||||||
|
"refund600" : { |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", |
||||||
|
"currentDifficulty" : "256", |
||||||
|
"currentGasLimit" : "1000000", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : 1, |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : { |
||||||
|
"balance" : "1000000000000000000", |
||||||
|
"code" : "0x600154506002545061ffff60020a600a553031600b55600060015560006002556000600355600060045560006005556000600655", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
"0x0b" : "0x0de0b6b3a7640000" |
||||||
|
} |
||||||
|
}, |
||||||
|
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { |
||||||
|
"balance" : "492", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "9508", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : { |
||||||
|
"balance" : "1000000000000000000", |
||||||
|
"code" : "0x600154506002545061ffff60020a600a553031600b55600060015560006002556000600355600060045560006005556000600655", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
"0x01" : "0x01", |
||||||
|
"0x02" : "0x01", |
||||||
|
"0x03" : "0x01", |
||||||
|
"0x04" : "0x01", |
||||||
|
"0x05" : "0x01", |
||||||
|
"0x06" : "0x01" |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "10000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"transaction" : { |
||||||
|
"data" : "", |
||||||
|
"gasLimit" : "10000", |
||||||
|
"gasPrice" : "1", |
||||||
|
"nonce" : "0", |
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", |
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", |
||||||
|
"value" : "0" |
||||||
|
} |
||||||
|
}, |
||||||
|
"refund_NoOOG_1" : { |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", |
||||||
|
"currentDifficulty" : "256", |
||||||
|
"currentGasLimit" : "1000000", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : 1, |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : { |
||||||
|
"balance" : "1000000000000000000", |
||||||
|
"code" : "0x6000600155", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { |
||||||
|
"balance" : "402", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "100", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : { |
||||||
|
"balance" : "1000000000000000000", |
||||||
|
"code" : "0x6000600155", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
"0x01" : "0x01" |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "502", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"transaction" : { |
||||||
|
"data" : "", |
||||||
|
"gasLimit" : "502", |
||||||
|
"gasPrice" : "1", |
||||||
|
"nonce" : "0", |
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", |
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", |
||||||
|
"value" : "0" |
||||||
|
} |
||||||
|
}, |
||||||
|
"refund_OOG" : { |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", |
||||||
|
"currentDifficulty" : "256", |
||||||
|
"currentGasLimit" : "1000000", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : 1, |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : { |
||||||
|
"balance" : "1000000000000000000", |
||||||
|
"code" : "0x6000600155", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
"0x01" : "0x01" |
||||||
|
} |
||||||
|
}, |
||||||
|
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { |
||||||
|
"balance" : "500", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : { |
||||||
|
"balance" : "1000000000000000000", |
||||||
|
"code" : "0x6000600155", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
"0x01" : "0x01" |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "500", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"transaction" : { |
||||||
|
"data" : "", |
||||||
|
"gasLimit" : "500", |
||||||
|
"gasPrice" : "1", |
||||||
|
"nonce" : "0", |
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", |
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", |
||||||
|
"value" : "0" |
||||||
|
} |
||||||
|
}, |
||||||
|
"refund_changeNonZeroStorage" : { |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", |
||||||
|
"currentDifficulty" : "256", |
||||||
|
"currentGasLimit" : "1000000", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : 1, |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : { |
||||||
|
"balance" : "1000000000000000010", |
||||||
|
"code" : "0x6017600155", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
"0x01" : "0x17" |
||||||
|
} |
||||||
|
}, |
||||||
|
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { |
||||||
|
"balance" : "602", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "388", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : { |
||||||
|
"balance" : "1000000000000000000", |
||||||
|
"code" : "0x6017600155", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
"0x01" : "0x01" |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "1000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"transaction" : { |
||||||
|
"data" : "", |
||||||
|
"gasLimit" : "850", |
||||||
|
"gasPrice" : "1", |
||||||
|
"nonce" : "0", |
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", |
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", |
||||||
|
"value" : "10" |
||||||
|
} |
||||||
|
}, |
||||||
|
"refund_getEtherBack" : { |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", |
||||||
|
"currentDifficulty" : "256", |
||||||
|
"currentGasLimit" : "1000000", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : 1, |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : { |
||||||
|
"balance" : "1000000000000000010", |
||||||
|
"code" : "0x6000600155", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { |
||||||
|
"balance" : "402", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "588", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : { |
||||||
|
"balance" : "1000000000000000000", |
||||||
|
"code" : "0x6000600155", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
"0x01" : "0x01" |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "1000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"transaction" : { |
||||||
|
"data" : "", |
||||||
|
"gasLimit" : "850", |
||||||
|
"gasPrice" : "1", |
||||||
|
"nonce" : "0", |
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", |
||||||
|
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", |
||||||
|
"value" : "10" |
||||||
|
} |
||||||
|
} |
||||||
|
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,277 @@ |
|||||||
|
{ |
||||||
|
"EmptyTransaction" : { |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", |
||||||
|
"currentDifficulty" : "45678256", |
||||||
|
"currentGasLimit" : "1000000", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : 1, |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "100000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "100000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"transaction" : { |
||||||
|
"data" : "", |
||||||
|
"gasLimit" : "", |
||||||
|
"gasPrice" : "", |
||||||
|
"nonce" : "", |
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", |
||||||
|
"to" : "", |
||||||
|
"value" : "" |
||||||
|
} |
||||||
|
}, |
||||||
|
"TransactionFromCoinbaseNotEnoughFounds" : { |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "a94f5374fce5edbc8e2a8697c15331677e6ebf0b", |
||||||
|
"currentDifficulty" : "45678256", |
||||||
|
"currentGasLimit" : "1100", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : 1, |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "1000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "1000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"transaction" : { |
||||||
|
"data" : "", |
||||||
|
"gasLimit" : "600", |
||||||
|
"gasPrice" : "1", |
||||||
|
"nonce" : "", |
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", |
||||||
|
"to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", |
||||||
|
"value" : "502" |
||||||
|
} |
||||||
|
}, |
||||||
|
"TransactionSendingToEmpty" : { |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", |
||||||
|
"currentDifficulty" : "45678256", |
||||||
|
"currentGasLimit" : "1000000", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : 1, |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { |
||||||
|
"balance" : "500", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"6295ee1b4f6dd65047762f924ecd367c17eabf8f" : { |
||||||
|
"balance" : "0", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "99500", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "100000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"transaction" : { |
||||||
|
"data" : "", |
||||||
|
"gasLimit" : "500", |
||||||
|
"gasPrice" : "1", |
||||||
|
"nonce" : "", |
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", |
||||||
|
"to" : "", |
||||||
|
"value" : "" |
||||||
|
} |
||||||
|
}, |
||||||
|
"TransactionSendingToZero" : { |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", |
||||||
|
"currentDifficulty" : "45678256", |
||||||
|
"currentGasLimit" : "1000000", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : 1, |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"0000000000000000000000000000000000000000" : { |
||||||
|
"balance" : "1", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { |
||||||
|
"balance" : "500", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "99499", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "100000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"transaction" : { |
||||||
|
"data" : "", |
||||||
|
"gasLimit" : "5000", |
||||||
|
"gasPrice" : "1", |
||||||
|
"nonce" : "", |
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", |
||||||
|
"to" : "0000000000000000000000000000000000000000", |
||||||
|
"value" : "1" |
||||||
|
} |
||||||
|
}, |
||||||
|
"TransactionToItself" : { |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", |
||||||
|
"currentDifficulty" : "45678256", |
||||||
|
"currentGasLimit" : "1000000", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : 1, |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { |
||||||
|
"balance" : "500", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
}, |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "99500", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "1", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "100000", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"transaction" : { |
||||||
|
"data" : "", |
||||||
|
"gasLimit" : "5000", |
||||||
|
"gasPrice" : "1", |
||||||
|
"nonce" : "", |
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", |
||||||
|
"to" : "a94f5374fce5edbc8e2a8697c15331677e6ebf0b", |
||||||
|
"value" : "1" |
||||||
|
} |
||||||
|
}, |
||||||
|
"TransactionToItselfNotEnoughFounds" : { |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", |
||||||
|
"currentDifficulty" : "45678256", |
||||||
|
"currentGasLimit" : "1000000", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : 1, |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "1101", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { |
||||||
|
"balance" : "1101", |
||||||
|
"code" : "0x", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"transaction" : { |
||||||
|
"data" : "", |
||||||
|
"gasLimit" : "600", |
||||||
|
"gasPrice" : "1", |
||||||
|
"nonce" : "", |
||||||
|
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", |
||||||
|
"to" : "a94f5374fce5edbc8e2a8697c15331677e6ebf0b", |
||||||
|
"value" : "502" |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,55 @@ |
|||||||
|
{ |
||||||
|
"singleItem": { |
||||||
|
"in": { |
||||||
|
"A": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
||||||
|
}, |
||||||
|
"root": "0xd23786fb4a010da3ce639d66d5e904a11dbc02746d1ce25029e53290cabf28ab" |
||||||
|
}, |
||||||
|
"dogs": { |
||||||
|
"in": { |
||||||
|
"doe": "reindeer", |
||||||
|
"dog": "puppy", |
||||||
|
"dogglesworth": "cat" |
||||||
|
}, |
||||||
|
"root": "0x8aad789dff2f538bca5d8ea56e8abe10f4c7ba3a5dea95fea4cd6e7c3a1168d3" |
||||||
|
}, |
||||||
|
"puppy": { |
||||||
|
"in": { |
||||||
|
"do": "verb", |
||||||
|
"horse": "stallion", |
||||||
|
"doge": "coin", |
||||||
|
"dog": "puppy" |
||||||
|
}, |
||||||
|
"root": "0x5991bb8c6514148a29db676a14ac506cd2cd5775ace63c30a4fe457715e9ac84" |
||||||
|
}, |
||||||
|
"foo": { |
||||||
|
"in": { |
||||||
|
"foo": "bar", |
||||||
|
"food": "bat", |
||||||
|
"food": "bass" |
||||||
|
}, |
||||||
|
"root": "0x17beaa1648bafa633cda809c90c04af50fc8aed3cb40d16efbddee6fdf63c4c3" |
||||||
|
}, |
||||||
|
"smallValues": { |
||||||
|
"in": { |
||||||
|
"be": "e", |
||||||
|
"dog": "puppy", |
||||||
|
"bed": "d" |
||||||
|
}, |
||||||
|
"root": "0x3f67c7a47520f79faa29255d2d3c084a7a6df0453116ed7232ff10277a8be68b" |
||||||
|
}, |
||||||
|
"testy": { |
||||||
|
"in": { |
||||||
|
"test": "test", |
||||||
|
"te": "testy" |
||||||
|
}, |
||||||
|
"root": "0x8452568af70d8d140f58d941338542f645fcca50094b20f3c3d8c3df49337928" |
||||||
|
}, |
||||||
|
"hex": { |
||||||
|
"in": { |
||||||
|
"0x0045": "0x0123456789", |
||||||
|
"0x4500": "0x9876543210" |
||||||
|
}, |
||||||
|
"root": "0x285505fcabe84badc8aa310e2aae17eddc7d120aabec8a476902c8184b3a3503" |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,46 @@ |
|||||||
|
{ |
||||||
|
"randomVMtest" : { |
||||||
|
"callcreates" : [ |
||||||
|
], |
||||||
|
"env" : { |
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", |
||||||
|
"currentDifficulty" : "256", |
||||||
|
"currentGasLimit" : "1000000", |
||||||
|
"currentNumber" : "0", |
||||||
|
"currentTimestamp" : "1", |
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" |
||||||
|
}, |
||||||
|
"exec" : { |
||||||
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", |
||||||
|
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", |
||||||
|
"code" : "0x675545", |
||||||
|
"data" : "0x", |
||||||
|
"gas" : "10000", |
||||||
|
"gasPrice" : "100000000000000", |
||||||
|
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", |
||||||
|
"value" : "1000000000000000000" |
||||||
|
}, |
||||||
|
"gas" : "9999", |
||||||
|
"logs" : [ |
||||||
|
], |
||||||
|
"out" : "0x", |
||||||
|
"post" : { |
||||||
|
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { |
||||||
|
"balance" : "1000000000000000000", |
||||||
|
"code" : "0x675545", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"pre" : { |
||||||
|
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { |
||||||
|
"balance" : "1000000000000000000", |
||||||
|
"code" : "0x675545", |
||||||
|
"nonce" : "0", |
||||||
|
"storage" : { |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,70 @@ |
|||||||
|
package qwhisper |
||||||
|
|
||||||
|
import ( |
||||||
|
"time" |
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/crypto" |
||||||
|
"github.com/ethereum/go-ethereum/ethutil" |
||||||
|
"github.com/ethereum/go-ethereum/whisper" |
||||||
|
) |
||||||
|
|
||||||
|
func fromHex(s string) []byte { |
||||||
|
if len(s) > 1 { |
||||||
|
return ethutil.Hex2Bytes(s[2:]) |
||||||
|
} |
||||||
|
return nil |
||||||
|
} |
||||||
|
func toHex(b []byte) string { return "0x" + ethutil.Bytes2Hex(b) } |
||||||
|
|
||||||
|
type Whisper struct { |
||||||
|
*whisper.Whisper |
||||||
|
} |
||||||
|
|
||||||
|
func New(w *whisper.Whisper) *Whisper { |
||||||
|
return &Whisper{w} |
||||||
|
} |
||||||
|
|
||||||
|
func (self *Whisper) Post(data string, pow, ttl uint32, to, from string) { |
||||||
|
msg := whisper.NewMessage(fromHex(data)) |
||||||
|
envelope, err := msg.Seal(time.Duration(pow), whisper.Opts{ |
||||||
|
Ttl: time.Duration(ttl), |
||||||
|
To: crypto.ToECDSAPub(fromHex(to)), |
||||||
|
From: crypto.ToECDSA(fromHex(from)), |
||||||
|
}) |
||||||
|
if err != nil { |
||||||
|
// handle error
|
||||||
|
return |
||||||
|
} |
||||||
|
|
||||||
|
if err := self.Whisper.Send(envelope); err != nil { |
||||||
|
// handle error
|
||||||
|
return |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
func (self *Whisper) NewIdentity() string { |
||||||
|
return toHex(self.Whisper.NewIdentity().D.Bytes()) |
||||||
|
} |
||||||
|
|
||||||
|
func (self *Whisper) HasIdentify(key string) bool { |
||||||
|
return self.Whisper.HasIdentity(crypto.ToECDSA(fromHex(key))) |
||||||
|
} |
||||||
|
|
||||||
|
func (self *Whisper) Watch(opts map[string]interface{}) { |
||||||
|
filter := filterFromMap(opts) |
||||||
|
filter.Fn = func(msg *whisper.Message) { |
||||||
|
// TODO POST TO QT WINDOW
|
||||||
|
} |
||||||
|
self.Whisper.Watch(filter) |
||||||
|
} |
||||||
|
|
||||||
|
func filterFromMap(opts map[string]interface{}) (f whisper.Filter) { |
||||||
|
if to, ok := opts["to"].(string); ok { |
||||||
|
f.To = crypto.ToECDSA(fromHex(to)) |
||||||
|
} |
||||||
|
if from, ok := opts["from"].(string); ok { |
||||||
|
f.From = crypto.ToECDSAPub(fromHex(from)) |
||||||
|
} |
||||||
|
|
||||||
|
return |
||||||
|
} |
@ -1,181 +1,3 @@ |
|||||||
package vm |
package vm |
||||||
|
|
||||||
import ( |
// Tests have been removed in favour of general tests. If anything implementation specific needs testing, put it here
|
||||||
"fmt" |
|
||||||
"io/ioutil" |
|
||||||
"log" |
|
||||||
"math/big" |
|
||||||
"os" |
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/crypto" |
|
||||||
"github.com/ethereum/go-ethereum/ethutil" |
|
||||||
"github.com/ethereum/go-ethereum/logger" |
|
||||||
"github.com/ethereum/go-ethereum/state" |
|
||||||
"github.com/ethereum/go-ethereum/trie" |
|
||||||
checker "gopkg.in/check.v1" |
|
||||||
// "github.com/obscuren/mutan"
|
|
||||||
) |
|
||||||
|
|
||||||
type VmSuite struct{} |
|
||||||
|
|
||||||
var _ = checker.Suite(&VmSuite{}) |
|
||||||
var big9 = ethutil.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000009") |
|
||||||
|
|
||||||
const mutcode = ` |
|
||||||
var x = 0; |
|
||||||
for i := 0; i < 10; i++ { |
|
||||||
x = i |
|
||||||
} |
|
||||||
|
|
||||||
return x` |
|
||||||
|
|
||||||
type TestEnv struct{} |
|
||||||
|
|
||||||
func (TestEnv) Origin() []byte { return nil } |
|
||||||
func (TestEnv) BlockNumber() *big.Int { return nil } |
|
||||||
func (TestEnv) BlockHash() []byte { return nil } |
|
||||||
func (TestEnv) PrevHash() []byte { return nil } |
|
||||||
func (TestEnv) Coinbase() []byte { return nil } |
|
||||||
func (TestEnv) Time() int64 { return 0 } |
|
||||||
func (TestEnv) GasLimit() *big.Int { return nil } |
|
||||||
func (TestEnv) Difficulty() *big.Int { return nil } |
|
||||||
func (TestEnv) Value() *big.Int { return nil } |
|
||||||
func (TestEnv) AddLog(*state.Log) {} |
|
||||||
func (TestEnv) Transfer(from, to Account, amount *big.Int) error { |
|
||||||
return nil |
|
||||||
} |
|
||||||
|
|
||||||
// This is likely to fail if anything ever gets looked up in the state trie :-)
|
|
||||||
func (TestEnv) State() *state.State { |
|
||||||
return state.New(trie.New(nil, "")) |
|
||||||
} |
|
||||||
|
|
||||||
func setup(level logger.LogLevel, typ Type) (*Closure, VirtualMachine) { |
|
||||||
code, err := ethutil.Compile(mutcode, true) |
|
||||||
if err != nil { |
|
||||||
log.Fatal(err) |
|
||||||
} |
|
||||||
|
|
||||||
// Pipe output to /dev/null
|
|
||||||
logger.AddLogSystem(logger.NewStdLogSystem(ioutil.Discard, log.LstdFlags, level)) |
|
||||||
|
|
||||||
ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "") |
|
||||||
|
|
||||||
stateObject := state.NewStateObject([]byte{'j', 'e', 'f', 'f'}) |
|
||||||
callerClosure := NewClosure(nil, stateObject, stateObject, code, big.NewInt(1000000), big.NewInt(0)) |
|
||||||
|
|
||||||
return callerClosure, New(TestEnv{}, typ) |
|
||||||
} |
|
||||||
|
|
||||||
func (s *VmSuite) TestDebugVm(c *checker.C) { |
|
||||||
// if mutan.Version < "0.6" {
|
|
||||||
// t.Skip("skipping for mutan version", mutan.Version, " < 0.6")
|
|
||||||
// }
|
|
||||||
closure, vm := setup(logger.DebugLevel, DebugVmTy) |
|
||||||
ret, _, e := closure.Call(vm, nil) |
|
||||||
c.Assert(e, checker.NotNil) |
|
||||||
c.Skip("Depends on mutan") |
|
||||||
c.Assert(ret, checker.DeepEquals, big9) |
|
||||||
} |
|
||||||
|
|
||||||
func (s *VmSuite) TestVm(c *checker.C) { |
|
||||||
// if mutan.Version < "0.6" {
|
|
||||||
// t.Skip("skipping for mutan version", mutan.Version, " < 0.6")
|
|
||||||
// }
|
|
||||||
closure, vm := setup(logger.DebugLevel, StandardVmTy) |
|
||||||
ret, _, e := closure.Call(vm, nil) |
|
||||||
c.Assert(e, checker.NotNil) |
|
||||||
c.Skip("Depends on mutan") |
|
||||||
c.Assert(ret, checker.DeepEquals, big9) |
|
||||||
} |
|
||||||
|
|
||||||
func (s *VmSuite) BenchmarkDebugVm(c *checker.C) { |
|
||||||
closure, vm := setup(logger.InfoLevel, StandardVmTy) |
|
||||||
|
|
||||||
c.ResetTimer() |
|
||||||
|
|
||||||
for i := 0; i < c.N; i++ { |
|
||||||
closure.Call(vm, nil) |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
func (s *VmSuite) BenchmarkVm(c *checker.C) { |
|
||||||
closure, vm := setup(logger.InfoLevel, DebugVmTy) |
|
||||||
|
|
||||||
c.ResetTimer() |
|
||||||
|
|
||||||
for i := 0; i < c.N; i++ { |
|
||||||
closure.Call(vm, nil) |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
func RunCode(mutCode string, typ Type) []byte { |
|
||||||
code, err := ethutil.Compile(mutCode, true) |
|
||||||
if err != nil { |
|
||||||
log.Fatal(err) |
|
||||||
} |
|
||||||
|
|
||||||
logger.AddLogSystem(logger.NewStdLogSystem(os.Stdout, log.LstdFlags, logger.InfoLevel)) |
|
||||||
|
|
||||||
ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "") |
|
||||||
|
|
||||||
stateObject := state.NewStateObject([]byte{'j', 'e', 'f', 'f'}) |
|
||||||
closure := NewClosure(nil, stateObject, stateObject, code, big.NewInt(1000000), big.NewInt(0)) |
|
||||||
|
|
||||||
vm := New(TestEnv{}, typ) |
|
||||||
ret, _, e := closure.Call(vm, nil) |
|
||||||
if e != nil { |
|
||||||
fmt.Println(e) |
|
||||||
} |
|
||||||
|
|
||||||
return ret |
|
||||||
} |
|
||||||
|
|
||||||
func (s *VmSuite) TestBuildInSha256(c *checker.C) { |
|
||||||
ret := RunCode(` |
|
||||||
var in = 42 |
|
||||||
var out = 0 |
|
||||||
|
|
||||||
call(0x2, 0, 10000, in, out) |
|
||||||
|
|
||||||
return out |
|
||||||
`, DebugVmTy) |
|
||||||
|
|
||||||
exp := crypto.Sha256(ethutil.LeftPadBytes([]byte{42}, 32)) |
|
||||||
c.Skip("Depends on mutan") |
|
||||||
c.Assert(ret, checker.DeepEquals, exp) |
|
||||||
} |
|
||||||
|
|
||||||
func (s *VmSuite) TestBuildInRipemd(c *checker.C) { |
|
||||||
ret := RunCode(` |
|
||||||
var in = 42 |
|
||||||
var out = 0 |
|
||||||
|
|
||||||
call(0x3, 0, 10000, in, out) |
|
||||||
|
|
||||||
return out |
|
||||||
`, DebugVmTy) |
|
||||||
|
|
||||||
exp := ethutil.RightPadBytes(crypto.Ripemd160(ethutil.LeftPadBytes([]byte{42}, 32)), 32) |
|
||||||
c.Skip("Depends on mutan") |
|
||||||
c.Assert(ret, checker.DeepEquals, exp) |
|
||||||
} |
|
||||||
|
|
||||||
func (s *VmSuite) TestOog(c *checker.C) { |
|
||||||
// This tests takes a long time and will eventually run out of gas
|
|
||||||
// t.Skip()
|
|
||||||
c.Skip("This tests takes a long time and will eventually run out of gas") |
|
||||||
|
|
||||||
logger.AddLogSystem(logger.NewStdLogSystem(os.Stdout, log.LstdFlags, logger.InfoLevel)) |
|
||||||
|
|
||||||
ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "") |
|
||||||
|
|
||||||
stateObject := state.NewStateObject([]byte{'j', 'e', 'f', 'f'}) |
|
||||||
closure := NewClosure(nil, stateObject, stateObject, ethutil.Hex2Bytes("60ff60ff600057"), big.NewInt(1000000), big.NewInt(0)) |
|
||||||
|
|
||||||
vm := New(TestEnv{}, DebugVmTy) |
|
||||||
_, _, e := closure.Call(vm, nil) |
|
||||||
if e != nil { |
|
||||||
fmt.Println(e) |
|
||||||
} |
|
||||||
} |
|
||||||
|
@ -0,0 +1,121 @@ |
|||||||
|
package whisper |
||||||
|
|
||||||
|
import ( |
||||||
|
"bytes" |
||||||
|
"crypto/ecdsa" |
||||||
|
"encoding/binary" |
||||||
|
"fmt" |
||||||
|
"io" |
||||||
|
"time" |
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/crypto" |
||||||
|
"github.com/ethereum/go-ethereum/ethutil" |
||||||
|
"github.com/ethereum/go-ethereum/rlp" |
||||||
|
) |
||||||
|
|
||||||
|
const ( |
||||||
|
DefaultPow = 50 * time.Millisecond |
||||||
|
) |
||||||
|
|
||||||
|
type Envelope struct { |
||||||
|
Expiry uint32 // Whisper protocol specifies int32, really should be int64
|
||||||
|
Ttl uint32 // ^^^^^^
|
||||||
|
Topics [][]byte |
||||||
|
Data []byte |
||||||
|
Nonce uint32 |
||||||
|
|
||||||
|
hash Hash |
||||||
|
} |
||||||
|
|
||||||
|
func NewEnvelopeFromReader(reader io.Reader) (*Envelope, error) { |
||||||
|
var envelope Envelope |
||||||
|
|
||||||
|
buf := new(bytes.Buffer) |
||||||
|
buf.ReadFrom(reader) |
||||||
|
|
||||||
|
h := H(crypto.Sha3(buf.Bytes())) |
||||||
|
if err := rlp.Decode(buf, &envelope); err != nil { |
||||||
|
return nil, err |
||||||
|
} |
||||||
|
|
||||||
|
envelope.hash = h |
||||||
|
|
||||||
|
return &envelope, nil |
||||||
|
} |
||||||
|
|
||||||
|
func (self *Envelope) Hash() Hash { |
||||||
|
if self.hash == EmptyHash { |
||||||
|
self.hash = H(crypto.Sha3(ethutil.Encode(self))) |
||||||
|
} |
||||||
|
|
||||||
|
return self.hash |
||||||
|
} |
||||||
|
|
||||||
|
func NewEnvelope(ttl time.Duration, topics [][]byte, data *Message) *Envelope { |
||||||
|
exp := time.Now().Add(ttl) |
||||||
|
|
||||||
|
return &Envelope{uint32(exp.Unix()), uint32(ttl.Seconds()), topics, data.Bytes(), 0, Hash{}} |
||||||
|
} |
||||||
|
|
||||||
|
func (self *Envelope) Seal(pow time.Duration) { |
||||||
|
self.proveWork(pow) |
||||||
|
} |
||||||
|
|
||||||
|
func (self *Envelope) Open(prv *ecdsa.PrivateKey) (msg *Message, err error) { |
||||||
|
data := self.Data |
||||||
|
var message Message |
||||||
|
dataStart := 1 |
||||||
|
if data[0] > 0 { |
||||||
|
if len(data) < 66 { |
||||||
|
return nil, fmt.Errorf("unable to open envelope. First bit set but len(data) < 66") |
||||||
|
} |
||||||
|
dataStart = 66 |
||||||
|
message.Flags = data[0] |
||||||
|
message.Signature = data[1:66] |
||||||
|
} |
||||||
|
message.Payload = data[dataStart:] |
||||||
|
if prv != nil { |
||||||
|
message.Payload, err = crypto.Decrypt(prv, message.Payload) |
||||||
|
if err != nil { |
||||||
|
return nil, fmt.Errorf("unable to open envelope. Decrypt failed: %v", err) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return &message, nil |
||||||
|
} |
||||||
|
|
||||||
|
func (self *Envelope) proveWork(dura time.Duration) { |
||||||
|
var bestBit int |
||||||
|
d := make([]byte, 64) |
||||||
|
copy(d[:32], ethutil.Encode(self.withoutNonce())) |
||||||
|
|
||||||
|
then := time.Now().Add(dura).UnixNano() |
||||||
|
for n := uint32(0); time.Now().UnixNano() < then; { |
||||||
|
for i := 0; i < 1024; i++ { |
||||||
|
binary.BigEndian.PutUint32(d[60:], n) |
||||||
|
|
||||||
|
fbs := ethutil.FirstBitSet(ethutil.BigD(crypto.Sha3(d))) |
||||||
|
if fbs > bestBit { |
||||||
|
bestBit = fbs |
||||||
|
self.Nonce = n |
||||||
|
} |
||||||
|
|
||||||
|
n++ |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
func (self *Envelope) valid() bool { |
||||||
|
d := make([]byte, 64) |
||||||
|
copy(d[:32], ethutil.Encode(self.withoutNonce())) |
||||||
|
binary.BigEndian.PutUint32(d[60:], self.Nonce) |
||||||
|
return ethutil.FirstBitSet(ethutil.BigD(crypto.Sha3(d))) > 0 |
||||||
|
} |
||||||
|
|
||||||
|
func (self *Envelope) withoutNonce() interface{} { |
||||||
|
return []interface{}{self.Expiry, self.Ttl, ethutil.ByteSliceToInterface(self.Topics), self.Data} |
||||||
|
} |
||||||
|
|
||||||
|
func (self *Envelope) RlpData() interface{} { |
||||||
|
return []interface{}{self.Expiry, self.Ttl, ethutil.ByteSliceToInterface(self.Topics), self.Data, self.Nonce} |
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
package whisper |
||||||
|
|
||||||
|
import "crypto/ecdsa" |
||||||
|
|
||||||
|
type Filter struct { |
||||||
|
To *ecdsa.PrivateKey |
||||||
|
From *ecdsa.PublicKey |
||||||
|
Topics [][]byte |
||||||
|
Fn func(*Message) |
||||||
|
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue