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
contract Database{ | |
mapping(uint => uint) public _data; | |
mapping(address => bool) _owners; | |
function Database(address[] owners){ //Called once at creation, pass in initial owners | |
for(uint i; i<owners.length; i++){ | |
_owners[owners[i]]=true; | |
} | |
} | |
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
contract MultiSend{ | |
function multisend(address[] addrs, uint[] amounts) public { | |
uint sum; | |
for(uint i; i< amounts.length; i++){ | |
sum++; | |
} | |
if(addrs.length != amounts.length || sum > msg.value){ | |
addrs[addrs.length]; // Throw Exception | |
} | |
else{ |
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
contract BTCRelay{ | |
function getLastBlockHeight() public returns(int256); | |
function getBlockHash(int256) public returns(int256); | |
} | |
contract Powerball{ | |
mapping(address => uint8[6][]) public tickets; | |
mapping(address => uint) public balances; | |
uint public roundStart; |
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
library LamportVerify{ | |
function getBit(bytes32 data, uint256 index) constant returns(uint8) { // gets bit `i` from data | |
return uint8(uint256(data) / (2**((255-index)))) & 0x01; | |
} | |
function verify_sig(bytes32 msgHash, bytes32[512] pubKey, bytes32[256] signature) returns(bool){ | |
for(uint i; i < 256; i++){ | |
bytes32 pub; |
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
library HashLadder{ | |
function genPubKey(bytes32[2][32] privKey) returns (bytes32[2][32]){ | |
bytes32[2][32] memory pubKey; | |
for(uint8 i; i< 32; i++){ | |
bytes32 pa = privKey[i][0]; | |
bytes32 pb = privKey[i][1]; | |
for(uint k; k<258; k++){ | |
pa = sha3(pa); | |
pb = sha3(pb); |
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
library HashLadder{ | |
function genPubKey(bytes32[2][32] privKey) returns (bytes32[2][32]){ | |
bytes32[2][32] memory pubKey; | |
for(uint8 i; i< 32; i++){ | |
bytes32 pa = privKey[i][0]; | |
bytes32 pb = privKey[i][1]; | |
for(uint k; k<258; k++){ | |
pa = sha3(pa); |
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
contract RaiseGas { | |
uint currentLimit; | |
uint lastPayout; | |
function RaiseGas(){ | |
currentLimit = block.gaslimit; | |
lastPayout = block.number; | |
} | |
function(){ |
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
library ProofLib { | |
struct Proof { | |
address defender; | |
address challenger; | |
bytes32 lVal; | |
bytes32 rVal; | |
uint lIndex; | |
uint rIndex; |
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
contract complex{ | |
address add; | |
uint aa; | |
uint bb; | |
function thrower() | |
{ | |
throw; | |
} |
OlderNewer