Skip to content

Instantly share code, notes, and snippets.

contract Billboard{
uint minimumBid = 10;
uint minimumBidDelta = 10;
Slot[] slots; //an array of slots. Each slot is one period of time (for example one day)
struct Slot{
address winner; // winner of the slot
uint bid; // amount of wei the winner bid
contract Order{
address owner;
uint timestamp;
function Order(){
owner = msg.sender;
timestamp = now;
}
}
@aakilfernandes
aakilfernandes / Order.sol
Last active January 24, 2016 01:25
Order 2
contract Order implements DataStorageInterface{
function Order(){
//a private function only accessible internally
this._setValue('address', 'owner', msg.sender)
this._setValue('uint', 'timestamp', now)
}
function setValue(valueType,valueVar,value){ //a public function anyone can call
var owner = this._getValue('address', 'owner');
@aakilfernandes
aakilfernandes / gist:e45f3b3e7a383507110f
Created February 17, 2016 00:36
broken ordering log
Running: geth --port 30304 --rpc --rpcaddr 127.0.0.1 --rpcport 8101 --rpccorsdomain http://127.0.0.1:8000 --genesis config/development/genesis.json --datadir datadir/development/ --networkid 5473 --bootnodes enode://05a87dcaf7a5014b38d4eec48119fa2afd942a2b4a69c0e7fdcebeac00de7827e7da64a17dbce2238ec1b84870163ccde76d730a90334762c2da9c0c9c920567@40.117.36.75:30303 --unlock 42c35b6c220d570bd8898a540406e0b026479f7b --password config/development/password --vmodule downloader=6,fetcher=6
I0216 19:32:33.591320 26863 database.go:71] Alloted 16MB cache to datadir/development/chaindata
I0216 19:32:34.253622 26863 database.go:71] Alloted 16MB cache to datadir/development/dapp
I0216 19:32:34.263135 26863 backend.go:314] Protocol Versions: [63 62 61], Network Id: 5473
I0216 19:32:34.279367 26863 genesis.go:89] Genesis block already in chain. Writing canonical number
I0216 19:32:34.279467 26863 backend.go:326] Successfully wrote genesis block. New genesis hash = 661ecc133725444e7e8afad49342f96a5f6315eab7b58f8dd868
var miner = miner || admin.miner
web3.eth.filter("pending").watch(function () {
if (miner.hashrate > 0) return;
console.log("===== Pending transactions! Looking for next block... =====");
miner.start(1);
});
web3.eth.filter("latest").watch(function () {
contract AuctionContract {
address owner;
address currentWinner;
uint minRaise = 1 ether;
bool isComplete = false;
function bid() {
server {
listen 80;
server_name _;
location / {
proxy_pass http://127.0.01:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
Manager.prototype.sendGetBlockHeaders = function(startHeight, maxHeaders, skip, reverse, cb) {
var msg = [
startHeight,
maxHeaders || 255,
skip || 0,
reverse ? 1 : 0
];
this.send(OFFSETS.getBlockHeaders, msg, cb);
};
var peerEnode = 'enode://739b275e0d6d895aad6f88dba61850d58cc90a0b3c1f05f8564707fb90a98310696f3e7ac15a51486a0582a1bebc403aa0a02ad8230c2614f33d9665311a0069@40.117.36.75:30303'
console.log('Adding peer with enode',peerEnode)
admin.addPeer(peerEnode)
var interval = setInterval(function(){
if(!admin.peers || admin.peers.length === 0){
console.log('Waiting to connect...')
geth --rpc --rpcaddr 127.0.0.1 --rpcport 8101 --rpccorsdomain http://127.0.0.1:8000 --datadir datadir/development/ --keystore config/development/keystore/ --networkid 5473 --unlock 42c35b6c220d570bd8898a540406e0b026479f7b --password config/development/password --nodiscover --verbosity 6 --maxpeers 1 js js/peer.js
I0824 14:24:33.169701 ethdb/database.go:82] Alloted 128MB cache and 1024 file handles to datadir/development/chaindata
I0824 14:24:33.193685 ethdb/database.go:169] closed db:datadir/development/chaindata
I0824 14:24:33.193984 accounts/addrcache.go:215] reloaded keys, cache has 1 accounts
I0824 14:24:33.194111 accounts/addrcache.go:215] reloaded keys, cache has 1 accounts
I0824 14:24:33.194623 ethdb/database.go:82] Alloted 128MB cache and 1024 file handles to datadir/development/chaindata
I0824 14:24:33.235948 ethdb/database.go:82] Alloted 16MB cache and 16 file handles to datadir/development/dapp
I0824 14:24:33.240434 eth/backend.go:172] Protocol Versions: [63 62], Network Id: 5473
I0824 14:24:33.240