Skip to content

Instantly share code, notes, and snippets.

View killerstorm's full-sized avatar

Alex Mizrahi killerstorm

View GitHub Profile
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-}
module CoreTypes (
Record, Transaction, Block,
get_key, tx_dependencies, apply_tx, validate_block_header,
block_transactions
) where
class Ord k => Record r k | r -> k where
get_key :: r -> k
if (process.argv.length < 3) {
console.log('need address')
process.exit(1)
}
var rpc = require('node-json-rpc');
var client = new rpc.Client({
port: 80,
host: "regtest-controller.chromanode.com"
});
var rpc = require('node-json-rpc');
var client = new rpc.Client({
port: 80,
host: "regtest-controller.chromanode.com"
});
client.call({method: 'add_confirmations', params: [1], id: 1},
function(err, res) {
console.log(err || res)
})
var _ = require('lodash')
var bitcore = require('bitcore') // 0.12.5
var network = bitcore.Networks.testnet
var totalKeys = 3
var requiredSignatures = 2
var rawPrivateKeys = [
'cUTyK6kpESjzWRtvzb5KfenFB6PaGofwojkJMx68AQA6t2mQSKmV',
'cVQS3PFi9t1XWXAH2fKs5xczmeXKb5v4ZbwJ8u7vPgK9Xjx9CDts',
import qualified Data.Map as Map
type ColorKernel txPayload coinState = txPayload -> [coinState] -> [coinState]
data ColorTx txPayload = ColorTx { payload :: txPayload,
inputIndices :: [Int],
outputIndices :: [Int],
outputCount :: Int}
type TxId = String
class ITOGColorDefinition(GenesisColorDefinition):
CLASS_CODE = 'itog'
class GenesisDesc(object):
def __init__(self, exponent, mantissa):
self.exponent = exponent
self.mantissa = mantissa
@classmethod
def from_value(cls, value):
tx_queue = [genesis_tx]
for cur_block_height in xrange(genesis_height, max_height):
# remove txs from this block from the queue
block_tx_queue = [tx for tx in tx_queue if tx.block_height == cur_block_height]
tx_queue = [tx for tx in tx_queue if tx.block_height != cur_block_height]
block_txs = {}
while block_tx_queue:
tx = block_tx_queue.pop()
block_txs[tx.txhash] = tx
@killerstorm
killerstorm / config.js
Created June 9, 2013 08:26
bitcoinjs-gui config
//
// bitcoinjs-gui server configuration defaults
//
// These settings are used as the defaults for all users connecting to
// this version of the client.
//
// If you don't wish to change a setting, it is recommended that you
// leave it commented out, so the global default will apply, which may
// be updated/improved in the future.
//
@killerstorm
killerstorm / p2ptrade.js
Created May 17, 2013 17:11
p2ptrade.js
var mockComm = {
postMessage : function (o) { console.log(o);}
};
var mockWallet = {
getSomeAddress : function () {
return "111111111";
}
};
@killerstorm
killerstorm / color.html
Created September 30, 2012 15:46
interactive output coloring demo
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
</head>
<body>
<div id="inputs">
Inputs:<br />
<select><option>---</option><option>Red</option><option>Blue</option><option>Uncolored</option><option>Mixed</option></select><input> <br />