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.17; | |
contract PoL { | |
// Declare variables, structures, mapping functions, events | |
struct pol { | |
address receiver; | |
uint initialBlockNumber; | |
uint deposit; | |
} |
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
var merklePatriciaTree = require('merkle-patricia-tree'); | |
var rlp = require('rlp'); | |
var db = global.db; | |
var Trie = function () {} | |
Trie.getInfoByAddress = function (root, address) { | |
var root = new Buffer(root, 'hex'); | |
var address = new Buffer(address, 'hex'); | |
var trie = new merklePatriciaTree(db, root); |
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
// Hash algorithm is Keccak256 | |
var s = Math.floor((Math.random() * 1000000000) + 1); // s = 830178382 | |
var selection = ‘rock’; | |
var combination = selection + s; // combination = ‘rock830178382’ | |
var hashOfCombination = keccak256(combination); | |
// hashOfCombination = 4d49bb261ecb887e152051da601d028e070635d24da07da2828fca8fecedee50 |
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
var db = global.db; | |
var ethBlock = require('ethereumjs-block'); | |
var rlp = require('rlp'); | |
var utils = require('./libs/utils'); | |
var geth = require('./libs/geth'); | |
var trie = require('./libs/trie'); | |
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
var path = require('path'); | |
var levelup = require('levelup'); | |
var leveldown = require('leveldown'); | |
/** | |
* Level DB | |
*/ | |
var levelDBPath = path.relative('./', '/Users/User/Library/Ethereum/ropsten/geth/chaindata'); | |
var db = levelup(leveldown(levelDBPath)); |
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
var Web3 = require('web3'); | |
var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); | |
console.log("\n==========================================="); | |
console.log("========== Geth connected:", web3.isConnected(), "==========="); | |
console.log("===========================================\n"); | |
var Geth = function () {} | |
Geth.getStateRoot = function (blockNumber) { |
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
{ | |
'cab8': 'dog', | |
'cabe': 'cat', | |
'39': 'chicken', | |
'395': 'duck', | |
'56f0': 'horse' | |
} |
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
{ | |
do: 0, | |
dog: 1, | |
dax: 2, | |
dogu: 3, | |
dodo: 4, | |
house: 5, | |
houses: 6 | |
} |
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
> [ 1, 2, 3, 4, 5] | |
'11 23 45' | |
> [ 0, 1, 2, 3, 4, 5] | |
'00 01 23 45' | |
> [ 0, f, 1, c, b, 8, 16] | |
'20 0f 1c b8' | |
> [ f, 1, c, b, 8, 16] | |
'3f 1c b8' |
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
node type path length | prefix hexchar | |
-------------------------------------------------- | |
extension even | 0000 0x0 | |
extension odd | 0001 0x1 | |
leaf even | 0010 0x2 | |
leaf odd | 0011 0x3 |
NewerOlder