aboutsummaryrefslogtreecommitdiffstats
path: root/state.cpp
diff options
context:
space:
mode:
authorGav Wood <i@gavwood.com>2014-01-20 04:15:07 +0800
committerGav Wood <i@gavwood.com>2014-01-20 04:15:07 +0800
commit6eafb9e6f8ff3cd5520bdba953d69ea789a74a30 (patch)
tree0b1f37458696684456e2d201354ed281b36e18cc /state.cpp
parentb73cbf3ecbc2ca7df9741c19e18b95a84b1ee5bd (diff)
downloaddexon-solidity-6eafb9e6f8ff3cd5520bdba953d69ea789a74a30.tar.gz
dexon-solidity-6eafb9e6f8ff3cd5520bdba953d69ea789a74a30.tar.zst
dexon-solidity-6eafb9e6f8ff3cd5520bdba953d69ea789a74a30.zip
Fake dagger, and moves to test the state transitions.
Diffstat (limited to 'state.cpp')
-rw-r--r--state.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/state.cpp b/state.cpp
index 0e2967d7..c4c148b4 100644
--- a/state.cpp
+++ b/state.cpp
@@ -24,9 +24,39 @@
using namespace std;
using namespace eth;
+struct KeyPair
+{
+ KeyPair() {}
+ KeyPair(PrivateKey _k): priv(_k), addr(toPublic(_k)) {}
+ PrivateKey priv;
+ Address addr;
+};
+
int stateTest()
{
- State s(toPublic(sha3("123")));
+ KeyPair me = sha3("Gav Wood");
+ KeyPair myMiner = sha3("Gav's Miner");
+// KeyPair you = sha3("123");
+
+ State s(myMiner.addr);
+
+ // Mine to get some ether!
+ s.mine();
+
+ bytes tx;
+ {
+ Transaction t;
+ t.nonce = s.transactionsFrom(myMiner.addr);
+ t.fee = 0;
+ t.value = 1; // 1 wei.
+ t.receiveAddress = me.addr;
+ t.sign(myMiner.priv);
+ tx = t.rlp();
+ }
+ cout << RLP(tx) << endl;
+ s.execute(tx);
+
+ // TODO: Mine to set in stone.
return 0;
}