Skip to content

Instantly share code, notes, and snippets.

View chevdor's full-sized avatar

Chevdor chevdor

View GitHub Profile
geth --fast --port 30303
contract RequiringFunds {
modifier NeedEth () {
if (msg.value <= 0 ) throw;
_
}
}
contract AmIOnTheFork {
function forked() constant returns(bool);
}
@chevdor
chevdor / Ethereum Contract Code Validation.adoc
Last active September 3, 2016 18:48
Ethereum contract bytecode validation

Considering the following contract:

 contract PayMultipleContract1  {
address private payee1;
address private payee2;
uint8 private percentagePayee1;
function PayMultipleContract1(address addr1, address addr2, uint8 percentage){
	payee1 = addr1;
	payee2 = addr2;
	percentagePayee1 = percentage;
@chevdor
chevdor / gist:73ca9a1484a5adb17e21ce1a238318ca
Last active September 7, 2016 11:22
WhitehatWithdraw bytecode using soljson-v0.3.6-2016-08-30-cf974fd

Validation of the WhitehatWithdraw contract

The WhitehatWithdraw contract is located at:

0x9f5304da62a5408416ea58a17a92611019bd5ce3

The goal of this verification is to ensure that the code running at the address 0x9f5304da62a5408416ea58a17a92611019bd5ce3 matches the code claimed to be deployed. This code can be found here: https://raw.githubusercontent.com/BitySA/whetcwithdraw/master/whetcwithdraw.sol

This verification is done by compiling the claimed code of the smart contract and checking whether or not it matches the bytecode stored at the contract address in the Ethereum Classic Blockchain.

The following is the output of a scan of the Ethereum mainnet blockchain
from 1427000 to 1738000.
The code of the official DAO (0xbb9bc244d798123fde783fcc1c72d3bb8c189413)
is taken as reference. The contracts found on the blockchain having the
same code are reported.
Many thanks to @rogermnoore from slack for his help scanning some parts of
the blocks.
Please note that the DAOs child contracts are NOT reported here.
// This script is reading various balances and comparing them
// at different points of time.
var ref = 1725885; // (Sat, 18 Jun 2016 12:08:33 CEST)
var dao = 'bb9bc244d798123fde783fcc1c72d3bb8c189413';
var attacker= '304a554a310c7e546dfe434669c62820b7d83490';
var refBlock = web3.eth.getBlock(ref);
var refDate = new Date(refBlock.timestamp*1000);
# Start with IE or a shell:
# START http://boxstarter.org/package/nr/url?https://gist.githubusercontent.com/chevdor/8d04225bee6950546a9c/raw/2c0a780f046e93aed2a06df067b3722aaf4c4f12/BoxStarterWork
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Enable-RemoteDesktop
Set-StartScreenOptions -EnableBootToDesktop
Install-WindowsUpdate -AcceptEula
# BoxStarter
cinst Boxstarter
@chevdor
chevdor / chocolateyInstall.ps1
Created April 30, 2015 13:20
K2 Service Broker - Chocolatey scripts
# New GUID: [guid]::NewGuid()
$guid = [guid]"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" # This GUID ** MUST BE ** unique. If you doubt, make a new one.
$brokerName = "your.broker.name"
$brokerSystemName = $brokerName
$brokerDLL = "$($brokerName).dll" # Make sure that matched the name of your file
$displayName = $brokerName -replace '\.',' ' # you can be creative here if you prefer...
$brokerDescription = "some desc"
Function GetK2InstallPath([string]$machine = $env:computername) {
<#
var pjson = require("./package.json");
var gulp = require('gulp');
var replace = require('gulp-replace');
var shell = require('gulp-shell');
var zip = require('gulp-zip');
var md5 = require("gulp-md5");
var print = require('gulp-print');
var clean = require('gulp-rimraf');
var debug = require('gulp-debug');
var bump = require('gulp-bump');
@chevdor
chevdor / chocolateyInstall.ps1
Created March 24, 2015 12:56
K2 Service Type registration
# This GUID ** MUST BE ** unique. If you doubt, make a new one. Do NOT reuse that one !!!
$guid = [guid]"4e3f9abc-c3c8-4355-b7d8-688e70c50124"
$brokerName = "TIS.ServiceBroker.YourBroker"
$brokerSystemName = $brokerName
$brokerDLL = "$($brokerName).dll" # Make sure that matched the name of your file
$displayName = $brokerName -replace '\.',' ' # you can be creative here if you prefer...
$brokerDescription = "Whatever blabla"
Function GetK2InstallPath([string]$machine = $env:computername) {