This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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. |