Skip to content

Instantly share code, notes, and snippets.

View killerstorm's full-sized avatar

Alex Mizrahi killerstorm

View GitHub Profile
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
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):
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
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',
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)
})
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"
});
{-# 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
var HmacSHA1 = require('crypto-js/hmac-sha1')
var _ = require('lodash')
var crypto = require('crypto')
function addHMAC(data, api_secret) {
data['hmac_fields'] = ""
var hmac_fields = _.keys(data).sort()
data['hmac_fields'] = hmac_fields.join(',')
var dataString = ''
for (var i = 0; i < hmac_fields.length; i++) {
contract EthGrowthToken {
uint256 ethBalance = 0;
uint constant depositFeePc = 1;
uint constant withdrawFeePc = 1;
// Following function implement growth logic:
// ether can be converted to and from tokens according to a current price which
// is calculated as (ethBalance / totalTokens), however we charge deposit
've finally got a good idea how to do a "community currency" kind of
thing we were discussion a year ago :)
As you probably know, nowadays people talk about so-called
"decentralized autonomous corporations" (and "decentralized
applications").
So decentralized corporation is how it might work, i.e. owners can
vote on various issues and plan actions together.