Skip to content

Instantly share code, notes, and snippets.

View killerstorm's full-sized avatar

Alex Mizrahi killerstorm

View GitHub Profile
Doesn't work:
2016-11-21 23:08:38 TRACE rpc Request: {"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"from":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":"0x1e8480","gasPrice":"0x174876e800","to":"0xa5bd94e55604de62e9b562f484da5eb20d7b7f70","data":"0xfdacd5760000000000000000000000000000000000000000000000000000000000000001"}],"id":7}
2016-11-21 23:08:38 TRACE miner send_transaction: dispatching tx: f88c8310002585174876e800831e848094a5bd94e55604de62e9b562f484da5eb20d7b7f7080a4fdacd57600000000000000000000000000000000000000000000000000000000000000011ca0af65128bb14d8e1fc4c6e67bb4f99127c27079811516d1f8f6cd2d5dcc7cf71da05a48101f784d1271fed0dfe955ef937bc953039ec6e979b7eceff062d1de9485 for network ID None
2016-11-21 23:08:38 TRACE rpc AsyncResponse: Some(AsyncStringResponse { response: Single(Sync(Success(Success { jsonrpc: V2, result: "0x50046748f220859070a665f9e468ff78962bfffc98fca5931efba4a65a11aeda", id: Num(7) }))) })
2016-11-21 23:08:38 DEBUG rpc Response: "{\"jsonrpc\":\"2.0\",\"res
$ parity --chain dev --jsonrpc-apis web3,eth,net,rpc,personal -l rpc,miner=trace | tee out.log
2016-11-21 17:00:34 main INFO parity::run Starting Parity/v1.5.0-unstable-60922b6-20161118/x86_64-macos/rustc1.13.0
2016-11-21 17:00:34 main INFO parity::run State DB configuation: fast
2016-11-21 17:00:34 main INFO parity::run Operating mode: active
2016-11-21 17:00:34 main INFO ethcore::service Configured for DevelopmentChain using InstantSeal engine
2016-11-21 17:00:35 IO Worker #2 INFO network Public node URL: enode://83f5b965c78153ec99ee57139383f0ef8d30d0d2fba9256b5a1a236e9d9d13b660bbc91c6da0bc46f7ddb6385e37a9b0bc1560c1644044bba9375916f94c1935@192.168.0.102:30303
2016-11-21 17:00:38 TRACE rpc Request: {"jsonrpc":"2.0","method":"personal_unlockAccount","params":["0x00a329c0648769A73afAc7F9381E08FB43dBEA72", "password", 99999],"id":76}
2016-11-21 17:00:38 TRACE rpc AsyncResponse: Some(AsyncStringResponse { response: Single(Sync(Success(Success { jsonrpc: V2, result: true, id: Num(76) }))) })
2016-
$ truffle migrate --reset --network live
Running migration: 1_initial_migration.js
Deploying Migrations...
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: The contract code couldn't be stored, please check your gas amount.
at Object.callback (/Users/macbook/.nvm/versions/node/v4.6.1/lib/node_modules/truffle/node_modules/ether-pudding/node_modules/web3/lib/web3/contract.js:147:46)
at /Users/macbook/.nvm/versions/node/v4.6.1/lib/node_modules/truffle/node_modules/ether-pudding/node_modules/web3/lib/web3/method.js:142:25
at /Users/macbook/.nvm/versions/node/v4.6.1/lib/node_modules/truffle/node_modules/ether-pudding/node_modules/web3/lib/web3/requestmanager.js:89:9
at null.request.onreadystatechange (/Users/macbook/.nvm/versions/node/v4.6.1/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:114:13)
at null.dispatchEvent (/Users/macbook/.nvm/versions/node/v4.6.1/lib/node_modules/truffle/node_modules/web3/node_modules/xmlhttpre
(defvar *locks* ())
(defmacro with-read (table index variable &body body)
`(let ((,variable (gethash ,index ,table))
(old-locks *locks*)
(*locks* (list* (cons ,table ,index) *locks*)))
(flet ((update (table index value)
(let ((*locks* old-locks))
(%update table index value))))
,@body)))
;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
$ ~/bitcoin-cli -testnet getblock 00000000000b5fd5fcada419cfa41f2d2dbbd0b74ba594edb2877f693bd328db false
000000200d6b8e876984d0d9893b0701da543b174a6ca7f10731fa3aeae9060000000000878ea15173242a89392ab9d7c01191aa4603d36a064deeea35251b54e01129333e88075830b3141b865814e705010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff2c0334500f0004ec84075804b2dade2f0c72450758af010000000000000a636b706f6f6c082f7365677769742fffffffff02685ba212000000001976a914d427a9318bc60db2766f9b02b7bbd470b78fa7a488ac0000000000000000266a24aa21a9ed848c32948db62167bf5b09326b82f3ced9688d42b08d80183f0638be2c4458c101200000000000000000000000000000000000000000000000000000000000000000000000000100000001ba92d9bba1eb0d904fc5e51dddf3974fe521dc81b12be413b46c7c71727c2123010000006b483045022100f596cee685ed32edc83ce2d1161dc3ed9d3c1ff6713e320e4d5492efb2d18fcb02202ea3978747a4bd21fd9dea27b0832886bfc7cce3d67fa92548e02cdee7ebc6580121020ad864dbaeac93a4629be1e40ae5f4603c9e37810a5af57f6c47b85305ab5ebdffffffff0200497f0f0000000017a914c84
'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.
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
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++) {
{-# 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