Skip to content

Instantly share code, notes, and snippets.

View romanman's full-sized avatar

Roman Mandeleil romanman

View GitHub Profile
package test.ethereum.dht;
import org.ethereum.net.dht.Bucket;
import org.ethereum.net.dht.Peer;
import org.junit.Test;
import org.spongycastle.util.encoders.Hex;
import java.util.List;
import static org.ethereum.net.dht.DHTUtils.getAllLeafs;
private static byte[] decrypt(byte[] data, byte[] key)
{
// 16 bytes is the IV size for AES256
try
{
PaddedBufferedBlockCipher cipher = new PaddedBufferedBlockCipher(new CBCBlockCipher(new AESFastEngine()));
byte[] ivBytes = new byte[16];
System.arraycopy(data, 0, ivBytes, 0, ivBytes.length); // Get iv from data
byte[] dataonly = new byte[data.length - ivBytes.length];
System.arraycopy(data, ivBytes.length, dataonly, 0, data.length - ivBytes.length);
[ {
"op" : "PUSH1",
"pc" : "0",
"gas" : "9375",
"stack" : [ ],
"memory" : "",
"storage" : {
"eb958b3d36129feb1b68fe68dde79c19087eaccb627dfc448f85a46b0d4b9451" : "5b693efb982a0d267a95ba4dae9c70063dc24416613530146521905fe6612da8",
"e508bd3a9bbbca7f989089a584f379340118d1a353f62d70804525d8bc55e26d" : "e7cab0eb11e3b8880441028015bcd3c53bd33bf344c8cbcc6a1a1ad87bd83337",
"755acf8297287fb246a5659b1894b1649a603121941e2ee5aa324060a210b05c" : "064dda2b3c0ce96cc85b8afc9dddfcfd0d7607576c9b6d2ff01f5068e46da780",
{
"encseed" : "957e46d54c10da45351554eb60d731b164043743dfb212ccf1827491a01cf344b390e4ac5af640e4f54ff28b046e48dc84094b99011d72ca79f2da9aa2792f4d2b8545455ca8dbba15d69048b3f95eccfed2d19427abcb2c9483e7491163eb1b",
"ethaddr" : "ba73facb4f8291f09f27f90fe1213537b910065e",
"email" : "foo@bar.com",
"btcaddr" : "1JEQr5LHrY8yVmWFaB31BVa9Y6sLQ9Kg41"
}
import org.ethereum.core.Block;
import org.ethereum.core.Genesis;
import org.ethereum.core.Transaction;
import org.ethereum.core.TransactionReceipt;
import org.ethereum.crypto.ECKey;
import org.ethereum.crypto.HashUtil;
import org.ethereum.facade.Ethereum;
import org.ethereum.facade.EthereumFactory;
import org.ethereum.listener.EthereumListenerAdapter;
import org.ethereum.net.p2p.HelloMessage;
turn:
http://www.ethergit.com/raw-transaction/b609708553831adb3d0f6ddeef1d5e27240288a1d568c6d8f2fd32323e5876ca
into:
http://imgur.com/LLKOA2g
the RLP encode rules can be found here:
https://github.com/ethereum/wiki/wiki/RLP
important points
Running 1 test case...
Entering test suite "EthereumTests"
Entering test suite "StateTests"
Entering test case "userDefinedFileState"
*** [ 10:42:42 | main ] Testing user defined test: /root/cpp-poc-7/tests/StateTests/stInitCodeTest.json
=S= [ 10:42:42 | main ] Executing {[CREATE]/0$1+590@3<-a94f5374… #22} on 2974910d080e91cfa47d432d338ce689777dd10e15dc13cd2817edc157aa5b97
=S= [ 10:42:42 | main ] f861800382024e800196600a80600c6000396000f200600160008035811a81001ba0075203471abeffa60d9766fcdd33d4c02050841e2e1f0b86ee13ee72237baa62a07d10656fd6049aecb8e760d35cb9f49efcc3033aa9f587b9762b65190ff4960a
EVM [ 10:42:42 | main ]
STACK
MEMORY
Running 1 test case...
Entering test suite "EthereumTests"
Entering test suite "StateTests"
Entering test case "userDefinedFileState"
*** [ 08:47:54 | main ] Testing user defined test: /root/cpp-poc-7/tests/StateTests/stInitCodeTest.json
=S= [ 08:47:54 | main ] Executing {[CREATE]/0$1+599@1<-a94f5374… #22} on 14cf9687b4d7c09eb76c31dc1eeb7c1ee1b2658b891eda5243852c261f55a754
=S= [ 08:47:54 | main ] f8618001820257800196600a80600c6000396000f200600160008035811a81001ca08a0295e29365e00c233a822920622ec2476f89a2fb8bb2b4a9519c226dedb5a1a010338f935d058199680913c8c864919d2b8d091acd561cddc8a252c72b0326a8
EVM [ 08:47:54 | main ]
STACK
MEMORY
contract Ballot {
// Create a new ballot with $(_numProposals) different proposals.
function Ballot(uint8 _numProposals) {
address sender = msg.sender;
chairperson = sender;
numProposals = _numProposals;
}
// Give $(voter) the right to vote on this ballot.
// May only be called by $(chairperson).