Skip to content

Instantly share code, notes, and snippets.

@colm
Created May 24, 2016 00:20
Show Gist options
  • Save colm/4e44e375a89612e7ba7298d588d1871f to your computer and use it in GitHub Desktop.
Save colm/4e44e375a89612e7ba7298d588d1871f to your computer and use it in GitHub Desktop.
#!/bin/bash
git clone https://github.com/slockit/DAO
nodejs --stack-size=64000 bruteforce.js
//verify SamppleOFfer
var crypto = require('crypto');
var fs= require('fs');
var solc = require('solc');
var geth = require("geth");
var web3 = require('web3');
var web3 = new web3;
params = "asdfdsf ";
web3.setProvider(new web3.providers.HttpProvider('http://localhost:1050'));
var input = {
'SampleOffer.sol' : fs.readFileSync('./DAO/SampleOffer.sol', 'utf8'),
'Token.sol' : fs.readFileSync('DAO/Token.sol', 'utf8'),
'TokenCreation.sol' : fs.readFileSync('DAO/TokenCreation.sol', 'utf8'),
'ManagedAccount.sol' : fs.readFileSync('DAO/ManagedAccount.sol', 'utf8'),
'DAO.sol' : fs.readFileSync('DAO/DAO.sol', 'utf8')
};
output = solc.compile({sources: input}, 1);
hash = crypto.createHash('sha256').update(output.contracts.SampleOffer.bytecode).digest('hex');
code = output.contracts.SampleOffer.bytecode;
trans = web3.eth.getTransaction("0xe9ebfecc2fa10100db51a4408d18193b3ac504584b51a4e55bdef1318f0a30f9");
console.log(crypto.createHash('sha256').update(output.contracts.SampleOffer.bytecode + params).digest('hex'));
console.log(crypto.createHash('sha256').update(trans.input).digest('hex'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment