-
-
Save naterush/c7252c762a3b26c923d44c2017602e3d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.11; | |
contract Parsing { | |
using RLP for RLP.RLPItem; | |
using RLP for RLP.Iterator; | |
using RLP for bytes; | |
struct BlockHeader { | |
bytes32 parentHash; | |
bytes32 ommersHash; | |
address beneficiary; | |
bytes32 stateRoot; | |
bytes32 transactionsRoot; | |
bytes32 receiptsRoot; | |
//bytes32 logsBloom; | |
uint difficulty; | |
uint number; | |
uint gasLimit; | |
uint gasUsed; | |
uint timestamp; | |
} | |
struct Transaction { | |
} | |
struct Receipt { | |
} | |
function parseBlockHeader(bytes rlpHeader) constant internal returns (BlockHeader) { | |
var it = rlpHeader.toRLPItem().iterator(); | |
BlockHeader memory header; | |
header.parentHash = it.next().toUint(); | |
header.ommersHash = bytes32(it.next().toUint()); | |
header.beneficiary = // | |
header.stateRoot = bytes32(it.next().toUint()); | |
header.transactionsRoot = bytes32(it.next().toUint()); | |
header.receiptsRoot = bytes32(it.next().toUint()); | |
it.next() // bytes32 logsBloom; | |
header.difficulty = it.next().toUint(); | |
header.number = it.next().toUint(); | |
header.gasLimit = it.next().toUint(); | |
header.gasUsed it.next().toUint(); | |
header.timestamp = it.next().toUint(); | |
return header; | |
} | |
function parseTransaction(bytes rlpTransaction) constant internal returns (Transaction) { | |
} | |
function parseReceipt(bytes rlpReceipt) constant internal returns (Receipt) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment