Skip to content

Instantly share code, notes, and snippets.

View amiller's full-sized avatar

Andrew Miller amiller

View GitHub Profile
What’s the price per kilobyte of Ethereum transaction data?
*************************************************************
As of October 2016, it's about $0.023 USD per kilobyte (2.3 cents per kilobyte)
Step 1: Gas price:
=================
= 25gigawei per gas (As of October 2016) https://etherscan.io/charts/gasprice
Ether unit conversion:
25 Gwei = 0.000000025 Ether http://ether.fund/tool/converter
@amiller
amiller / lotto.sol
Created August 27, 2015 10:19
Illustration of the Ethereum call-stack hazard found in the wild
// Call stack hazards in Solidity!!
//
// This file is *slightly* modified relative to
// https://github.com/etherpot/contract/blob/f87501ddf319559346b2983b27770ace22771ad0/app/contracts/lotto.sol
// in order to demonstrate a flaw:
// Changes:
// - function () changed to function send()
// - function trigger() added
// - blocksPerRound changed from 6800 to 6
//
type 'a once = 'a option ref;;
let notyet : unit -> 'a once = fun () -> ref None;;
let write : 'a once -> 'a -> unit =
fun o a -> match !o with
| None -> o := Some a
| _ -> failwith "can't overwrite"
let read : 'a once -> 'a option = fun o -> !o;;
@amiller
amiller / monoid.fst
Last active August 29, 2015 14:13
Monoids and Groups in F*
// Andrew Miller - monoid.fst
// compiles under the school14.1 release of F*
// https://github.com/FStarLang/FStar/releases/tag/school14.1
// This is an example of constructive algebra in F*. We're going to define the
// class of mathematical objects called "monoids", and give several constructions,
// using F* to prove the constructions are sound.
// For similar developments in other languages, see:
// [Agda] http://people.inf.elte.hu/divip/AgdaTutorial/Application.Algebra.html
amiller@dreyfus:~/projects/netmine$ make
./autogen.pl
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
make all -C logserver
@amiller
amiller / README.md
Last active August 29, 2015 14:12
liarsdice

test

One of the main points in this note is that you can use a
"proof-of-publication" system to implement an "anti-replay" system.
However this isn't true - at least not given the description of
proof-of-(non)-publication in 2) and the definition of "anti-replay"
given here.
In 2), proof-of-*non*-publication allows you to prove that *some
specific message* has never been published. You can imagine having a
function ProveNotPublished(m), which proves "message m was not
published."
@amiller
amiller / glass.html
Last active August 29, 2015 14:00 — forked from amiller/glass.html
[wearscript] Map Trace
<html style="width:100%; height:100%; overflow:hidden">
<head>
<script src="https://gist.githubusercontent.com/amiller/11100038/raw/pacman.js"></script>
<!-- You can include external scripts here like so... -->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<div id="pacman"></div>
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
@amiller
amiller / glass.html
Created April 20, 2014 00:08 — forked from amiller/glass.html
[wearscript] Dizzy Glass Pacman
<html style="width:100%; height:100%; overflow:hidden">
<head>
<script src="https://gist.githubusercontent.com/amiller/11100038/raw/pacman.js"></script>
<!-- You can include external scripts here like so... -->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<div id="pacman"></div>
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
@amiller
amiller / glass.html
Last active August 29, 2015 14:00
[wearscript] pacman + tango
<html style="width:100%; height:100%; overflow:hidden">
<head>
<script src="https://gist.githubusercontent.com/amiller/11100038/raw/pacman.js"></script>
<!-- You can include external scripts here like so... -->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<div id="pacman"></div>
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>