Skip to content

Instantly share code, notes, and snippets.

View amiller's full-sized avatar

Andrew Miller amiller

View GitHub Profile
pragma solidity ^0.4.0;
// This contract is used for making a new opcode via a softfork.
// It works for opcodes that just evaluate an arbitrary function,
// returning y = f(x).
//
// The idea is to create a contract that implements an arbitrary key-value
// mapping, but miners (after the softfork) enforce that the only updates to the
// contract respect the correct function.
//
@amiller
amiller / testcontract.sol
Created June 14, 2017 18:42 — forked from anonymous/testcontract.sol
Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version=soljson-v0.4.11+commit.68ef5810.js&optimize=undefined&gist=
pragma solidity ^0.4.0;
contract TestContract {
struct Proposal {
uint voteCount;
string description;
}
address public owner;
Proposal[] public proposals;
#! python2.7
#
# tinybitcoinpeer.py
# A toy bitcoin node in Python. Connects to a random testnet
# node, shakes hands, reacts to pings, and asks for pongs.
# - Andrew Miller https://soc1024.com/
#
# Dependencies:
# - gevent
# - https://github.com/petertodd/python-bitcoinlib
amiller@amiller-lenovo ~/installing/parity $ target/debug/parity --testnet --nodiscover --bootnodes "" -l network=trace --log-file parity.log
Adding ver.lock
Executed 1 upgrade scripts - ok
2016-07-15 18:24:30 INFO:parity: Starting Parity/v1.3.0-unstable-d14b687-20160715/x86_64-linux-gnu/rustc1.10.0
2016-07-15 18:24:30 INFO:parity: Using state DB journalling strategy fast
2016-07-15 18:24:30 INFO:ethcore::service: Configured for Morden using Ethash engine
enode://c9b35f1370d9d5b36d6d2a5c78192d3c46d0ccae0f5cad37209f1b366de3585ea59a81e69250eaaebd951e206522877f639d8354c7c82865a328ba7b0c359c8f@0.0.0.0:30303
2016-07-15 18:24:31 INFO:mode: Public node URL: enode://c9b35f1370d9d5b36d6d2a5c78192d3c46d0ccae0f5cad37209f1b366de3585ea59a81e69250eaaebd951e206522877f639d8354c7c82865a328ba7b0c359c8f@0.0.0.0:30303
2016-07-15 18:24:32 DEBUG:network: Connecting peers: 0 sessions, 0 pending, 0 started
2016-07-15 18:24:33 DEBUG:network: Connecting peers: 0 sessions, 0 pending, 0 started
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