aboutsummaryrefslogtreecommitdiffstats
path: root/crypto.cpp
diff options
context:
space:
mode:
authorGav Wood <i@gavwood.com>2014-01-20 22:53:02 +0800
committerGav Wood <i@gavwood.com>2014-01-20 22:53:02 +0800
commita08ce2bde1ea3f7650251e96c62389166972a249 (patch)
treeb5c06fa2bedb4378cf5cbcfbef8cc415f925e91e /crypto.cpp
parent6eafb9e6f8ff3cd5520bdba953d69ea789a74a30 (diff)
downloaddexon-solidity-a08ce2bde1ea3f7650251e96c62389166972a249.tar
dexon-solidity-a08ce2bde1ea3f7650251e96c62389166972a249.tar.gz
dexon-solidity-a08ce2bde1ea3f7650251e96c62389166972a249.tar.bz2
dexon-solidity-a08ce2bde1ea3f7650251e96c62389166972a249.tar.lz
dexon-solidity-a08ce2bde1ea3f7650251e96c62389166972a249.tar.xz
dexon-solidity-a08ce2bde1ea3f7650251e96c62389166972a249.tar.zst
dexon-solidity-a08ce2bde1ea3f7650251e96c62389166972a249.zip
Various fixes.
Diffstat (limited to 'crypto.cpp')
-rw-r--r--crypto.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/crypto.cpp b/crypto.cpp
index 0c9f9e35..75ac9e91 100644
--- a/crypto.cpp
+++ b/crypto.cpp
@@ -34,8 +34,16 @@ int cryptoTest()
bytes tx = fromUserHex("88005401010101010101010101010101010101010101011f0de0b6b3a76400001ce8d4a5100080181c373130a009ba1f10285d4e659568bfcfec85067855c5a3c150100815dad4ef98fd37cf0593828c89db94bd6c64e210a32ef8956eaa81ea9307194996a3b879441f5d");
cout << "TX: " << RLP(tx) << endl;
- Transaction t(tx);
- cout << "SENDER: " << hex << t.sender() << endl;
+ Transaction t2(tx);
+ cout << "SENDER: " << hex << t2.sender() << endl;
+
+ secp256k1_start();
+
+ Transaction t;
+ t.nonce = 0;
+ t.fee = 0;
+ t.value = 1; // 1 wei.
+ t.receiveAddress = toAddress(sha3("123"));
bytes sig64 = toBigEndian(t.vrs.r) + toBigEndian(t.vrs.s);
cout << "SIG: " << sig64.size() << " " << asHex(sig64) << " " << t.vrs.v << endl;
@@ -48,8 +56,6 @@ int cryptoTest()
bytes privkey = sha3Bytes("123");
- secp256k1_start();
-
{
bytes pubkey(65);
int pubkeylen = 65;
@@ -68,6 +74,9 @@ int cryptoTest()
bytes sig(64);
u256 nonce = 0;
int v = 0;
+ cout << asHex(hmsg) << endl;
+ cout << asHex(privkey) << endl;
+ cout << hex << nonce << endl;
int ret = secp256k1_ecdsa_sign_compact((byte const*)hmsg.data(), hmsg.size(), sig.data(), privkey.data(), (byte const*)&nonce, &v);
cout << "MYSIG: " << dec << ret << " " << sig.size() << " " << asHex(sig) << " " << v << endl;