This file contains hidden or 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
| ;setup environment: module is submitted with keyset definition ... | |
| (env-data { "keyset": { "keys": ["ABCD"] , "pred": "keys-all" } }) | |
| ;... and is signed by ABCD key | |
| (env-keys "ABCD") | |
| ;define keyset to guard module | |
| (define-keyset 'module-keyset (read-keyset "keyset")) | |
| ;define smart-contract code | |
| (module payments 'module-keyset |
This file contains hidden or 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
| $ ~/bitcoin-cli -testnet getblock 00000000000b5fd5fcada419cfa41f2d2dbbd0b74ba594edb2877f693bd328db false | |
| 000000200d6b8e876984d0d9893b0701da543b174a6ca7f10731fa3aeae9060000000000878ea15173242a89392ab9d7c01191aa4603d36a064deeea35251b54e01129333e88075830b3141b865814e705010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff2c0334500f0004ec84075804b2dade2f0c72450758af010000000000000a636b706f6f6c082f7365677769742fffffffff02685ba212000000001976a914d427a9318bc60db2766f9b02b7bbd470b78fa7a488ac0000000000000000266a24aa21a9ed848c32948db62167bf5b09326b82f3ced9688d42b08d80183f0638be2c4458c101200000000000000000000000000000000000000000000000000000000000000000000000000100000001ba92d9bba1eb0d904fc5e51dddf3974fe521dc81b12be413b46c7c71727c2123010000006b483045022100f596cee685ed32edc83ce2d1161dc3ed9d3c1ff6713e320e4d5492efb2d18fcb02202ea3978747a4bd21fd9dea27b0832886bfc7cce3d67fa92548e02cdee7ebc6580121020ad864dbaeac93a4629be1e40ae5f4603c9e37810a5af57f6c47b85305ab5ebdffffffff0200497f0f0000000017a914c84 |
This file contains hidden or 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. |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |