From 14560913b6779475a9844b182e9ef3ff991d0398 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sat, 8 Aug 2015 11:36:00 -0400 Subject: [PATCH 01/44] take into account when no cmds are specified --- lib/deploy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/deploy.js b/lib/deploy.js index 899a8822..6bdf1f64 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -125,7 +125,7 @@ Deploy.prototype.deploy_contracts = function(env) { }; Deploy.prototype.execute_cmds = function(cmds) { - if (cmds.length === 0) return; + if (cmds == undefined || cmds.length === 0) return; eval(this.generate_abi_file()); for (var i = 0; i < cmds.length; i++) { From 0252177a7916a7263693d204ccfd786119342114 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sat, 8 Aug 2015 11:36:49 -0400 Subject: [PATCH 02/44] update to 0.8.5 --- bin/embark | 2 +- boilerplate/package.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/embark b/bin/embark index 98fd67e3..5cd6faa3 100644 --- a/bin/embark +++ b/bin/embark @@ -32,7 +32,7 @@ var deploy = function(env, embarkConfig) { } program - .version('0.8.4') + .version('0.8.5') program.command('new [name]').description('New application').action(function(name) { if (name === undefined) { diff --git a/boilerplate/package.json b/boilerplate/package.json index 77076986..ed111e75 100644 --- a/boilerplate/package.json +++ b/boilerplate/package.json @@ -10,7 +10,7 @@ "license": "ISC", "homepage": "", "devDependencies": { - "embark-framework": "^0.8.4", + "embark-framework": "^0.8.5", "grunt-embark": "^0.3.0", "grunt-contrib-clean": "^0.6.0", "grunt-contrib-coffee": "^0.13.0", diff --git a/package.json b/package.json index cf0d2514..60ddf6e4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "embark-framework", - "version": "0.8.4", + "version": "0.8.5", "description": "", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" From 426012223835f686c6f5815035291883ac1fe9bd Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sat, 8 Aug 2015 11:53:57 -0400 Subject: [PATCH 03/44] don't track contract if there was an error deploying it --- lib/deploy.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/deploy.js b/lib/deploy.js index 6bdf1f64..d00b0c7b 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -110,13 +110,12 @@ Deploy.prototype.deploy_contracts = function(env) { } else { console.log("deployed " + className + " at " + contractAddress); + this.chainManager.addContract(className, contract.compiled.code, realArgs, contractAddress); + this.chainManager.save(); } this.deployedContracts[className] = contractAddress; - this.chainManager.addContract(className, contract.compiled.code, realArgs, contractAddress); - this.chainManager.save(); - console.log("deployed " + className + " at " + contractAddress); this.execute_cmds(contract.onDeploy); } } From 4609a21643e6a4e313297662c245a611ae70c24f Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sun, 9 Aug 2015 16:41:42 -0400 Subject: [PATCH 04/44] add support to enable whisper --- lib/blockchain.js | 8 ++++++++ lib/config/blockchain.js | 1 + 2 files changed, 9 insertions(+) diff --git a/lib/blockchain.js b/lib/blockchain.js index 5d6a91d0..4afd8d4d 100644 --- a/lib/blockchain.js +++ b/lib/blockchain.js @@ -9,6 +9,7 @@ Blockchain.prototype.generate_basic_command = function() { var address = config.account.address; var cmd = "geth "; + var rpc_api = ['eth', 'web3']; if (config.datadir !== "default") { cmd += "--datadir=\"" + config.datadir + "\" "; @@ -31,6 +32,13 @@ Blockchain.prototype.generate_basic_command = function() { cmd += "--genesis=\"" + config.genesisBlock + "\" "; } + if (config.whisper) { + cmd += "--shh "; + rpc_api.push('shh') + } + + cmd += '--rpcapi "' + rpc_api.join(',') + '" '; + //TODO: this should be configurable cmd += "--maxpeers " + config.maxPeers + " "; diff --git a/lib/config/blockchain.js b/lib/config/blockchain.js index 935ba130..368fa493 100644 --- a/lib/config/blockchain.js +++ b/lib/config/blockchain.js @@ -45,6 +45,7 @@ BlockchainConfig.prototype.config = function(env) { port: config.port || "30303", console_toggle: config.console || false, mine_when_needed: config.mine_when_needed || false, + whisper: config.whisper || false, account: config.account } From 8de45a1bedfe02de63c27157d64e86f39072e1e1 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sun, 9 Aug 2015 16:42:31 -0400 Subject: [PATCH 05/44] update to 0.8.6 --- bin/embark | 2 +- boilerplate/package.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/embark b/bin/embark index 5cd6faa3..868a4eea 100644 --- a/bin/embark +++ b/bin/embark @@ -32,7 +32,7 @@ var deploy = function(env, embarkConfig) { } program - .version('0.8.5') + .version('0.8.6') program.command('new [name]').description('New application').action(function(name) { if (name === undefined) { diff --git a/boilerplate/package.json b/boilerplate/package.json index ed111e75..b845b07c 100644 --- a/boilerplate/package.json +++ b/boilerplate/package.json @@ -10,7 +10,7 @@ "license": "ISC", "homepage": "", "devDependencies": { - "embark-framework": "^0.8.5", + "embark-framework": "^0.8.6", "grunt-embark": "^0.3.0", "grunt-contrib-clean": "^0.6.0", "grunt-contrib-coffee": "^0.13.0", diff --git a/package.json b/package.json index 60ddf6e4..ae3ed391 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "embark-framework", - "version": "0.8.5", + "version": "0.8.6", "description": "", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" From 84daf7e82fd2f80d2e2f41c9da2d165383ae85c4 Mon Sep 17 00:00:00 2001 From: Joris Bontje Date: Wed, 5 Aug 2015 12:24:35 +0200 Subject: [PATCH 06/44] set embark binary file permissions as executable --- bin/embark | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 bin/embark diff --git a/bin/embark b/bin/embark old mode 100644 new mode 100755 From 92173c99072c336305914861c0bffe774e8ac057 Mon Sep 17 00:00:00 2001 From: Gerbrand van DIeijen Date: Tue, 18 Aug 2015 12:05:20 +0200 Subject: [PATCH 07/44] Add option to run geth with any command --- bin/embark | 13 ++++++++++++- lib/blockchain.js | 10 ++++++++++ lib/index.js | 6 +++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/bin/embark b/bin/embark index 868a4eea..9b258b11 100755 --- a/bin/embark +++ b/bin/embark @@ -139,6 +139,18 @@ program.command('blockchain [env]').description('run blockchain').action(functio } }); +program.command('geth [args...]').description('run geth with specified arguments').action(function(env_, args_) { + var env = env_ || 'development'; + var embarkConfig = readYaml.sync("./embark.yml"); + var args = args_.join(' '); + + Embark.init() + Embark.blockchainConfig.loadConfigFile(embarkConfig.blockchainConfig) + Embark.contractsConfig.loadConfigFile(embarkConfig.contractsConfig) + + Embark.geth(env, args); +}); + program.command('demo').description('create a working dapp with a SimpleStorage contract').action(function() { var boilerPath = path.join(__dirname + '/../boilerplate'); var demoPath = path.join(__dirname + '/../demo'); @@ -169,4 +181,3 @@ if (!process.argv.slice(2).length) { } exit(); - diff --git a/lib/blockchain.js b/lib/blockchain.js index 4afd8d4d..45c8bd9e 100644 --- a/lib/blockchain.js +++ b/lib/blockchain.js @@ -57,6 +57,10 @@ Blockchain.prototype.init_command = function() { return this.generate_basic_command() + "account new "; } +Blockchain.prototype.geth_command = function(geth_args) { + return this.generate_basic_command() + geth_args; +} + Blockchain.prototype.run_command = function(address, use_tmp) { var cmd = this.generate_basic_command(); var config = this.config; @@ -116,4 +120,10 @@ Blockchain.prototype.startChain = function(use_tmp) { exec(this.run_command(address, use_tmp)); } +Blockchain.prototype.execGeth = function(args) { + var cmd = this.geth_command(args); + console.log("executing: " + cmd); + exec(cmd); +} + module.exports = Blockchain diff --git a/lib/index.js b/lib/index.js index 95618130..e81dcc4b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -44,8 +44,12 @@ Embark = { return deploy.generate_abi_file(destFile); }, + geth: function(env, args) { + var chain = new Blockchain(this.blockchainConfig.config(env)); + chain.execGeth(args); + }, + release: Release } module.exports = Embark; - From dd5cd475a3259269ad9409e19b7226aa63a9c72d Mon Sep 17 00:00:00 2001 From: Ryan Casey Date: Fri, 21 Aug 2015 09:38:17 -0700 Subject: [PATCH 08/44] No reason to have any difficulty whatsoever on a private chain. --- boilerplate/config/genesis/dev_genesis.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boilerplate/config/genesis/dev_genesis.json b/boilerplate/config/genesis/dev_genesis.json index 9f60d776..0ddafb2e 100644 --- a/boilerplate/config/genesis/dev_genesis.json +++ b/boilerplate/config/genesis/dev_genesis.json @@ -1,6 +1,6 @@ { "nonce": "0x0000000000000042", - "difficulty": "0x40000", + "difficulty": "0x0", "alloc": { }, "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", From 1aad3313832635d04a7bfd9a6e2ddaebf94ea73f Mon Sep 17 00:00:00 2001 From: Ryan Casey Date: Fri, 21 Aug 2015 09:41:03 -0700 Subject: [PATCH 09/44] Use a more definite address than 0x0, since some clients have coerced invalid addresses to the 0x0 address in the past. --- boilerplate/config/genesis/dev_genesis.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boilerplate/config/genesis/dev_genesis.json b/boilerplate/config/genesis/dev_genesis.json index 0ddafb2e..76b6fe81 100644 --- a/boilerplate/config/genesis/dev_genesis.json +++ b/boilerplate/config/genesis/dev_genesis.json @@ -4,7 +4,7 @@ "alloc": { }, "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "coinbase": "0x0000000000000000000000000000000000000000", + "coinbase": "0x3333333333333333333333333333333333333333", "timestamp": "0x00", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "extraData": "0x", From 94a85339c4015fa0f61574b05b96e6bde0187a6f Mon Sep 17 00:00:00 2001 From: Ryan Casey Date: Fri, 21 Aug 2015 09:44:34 -0700 Subject: [PATCH 10/44] Allocate the coinbase some ether in the genesis block. --- boilerplate/config/genesis/dev_genesis.json | 1 + 1 file changed, 1 insertion(+) diff --git a/boilerplate/config/genesis/dev_genesis.json b/boilerplate/config/genesis/dev_genesis.json index 76b6fe81..9f2d1562 100644 --- a/boilerplate/config/genesis/dev_genesis.json +++ b/boilerplate/config/genesis/dev_genesis.json @@ -2,6 +2,7 @@ "nonce": "0x0000000000000042", "difficulty": "0x0", "alloc": { + "0x3333333333333333333333333333333333333333": {"balance": "15000000000000000000"} }, "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", "coinbase": "0x3333333333333333333333333333333333333333", From d23eec1081fe2a1092df99db0611a39cd38242b0 Mon Sep 17 00:00:00 2001 From: Ryan Casey Date: Fri, 21 Aug 2015 09:49:18 -0700 Subject: [PATCH 11/44] Change mining script to mine periodically and use filters instead of polling. --- js/mine.js | 123 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 99 insertions(+), 24 deletions(-) diff --git a/js/mine.js b/js/mine.js index c03fe5ec..27f3460d 100644 --- a/js/mine.js +++ b/js/mine.js @@ -1,16 +1,49 @@ -var miner_var; +// Adapted from Iuri Matias' Embark framework +// https://github.com/iurimatias/embark-framework +// Modified by ryepdx to mine at regular intervals. +(function() { + var main = function () { + /* TODO: Find a way to load mining config from YML. + + if (!loadScript("config.js")) { + console.log("== config.js not found"); + } -if (admin.miner === undefined) { - miner_var = miner; -} -else { - miner_var = admin.miner; -} + if (typeof(config) === "undefined") { + config = {}; + console.log("== config is undefined, proceeding with defaults"); + } -miner_var.setEtherbase(web3.eth.accounts[0]); + In the meantime, just set an empty config object. + */ + config = {} + + defaults = { + interval_ms: 15000, + mine_pending_txns: true, + mine_periodically: true, + mine_normally: false, + threads: 1 + } + + for (key in defaults) { + if (config[key] === undefined) { + config[key] = defaults[key]; + } + } + + var miner_obj = (admin.miner === undefined) ? miner : admin.miner; + + if (config.mine_normally) { + miner_obj.start(config.threads); + return; + } + miner_obj.stop(); + + if (config.mine_periodically) start_periodic_mining(config, miner_obj); + if (config.mine_pending_txns) start_transaction_mining(config, miner_obj); + }; -setInterval(function() { - var minimalAmount = (web3.eth.getBalance(web3.eth.coinbase) >= 15000000000000000000); var pendingTransactions = function() { if (web3.eth.pendingTransactions === undefined || web3.eth.pendingTransactions === null) { return txpool.status.pending || txpool.status.queued; @@ -21,19 +54,61 @@ setInterval(function() { else { return web3.eth.pendingTransactions.length > 0 || web3.eth.getBlock('pending').transactions.length > 0; } - } + }; - if(!web3.eth.mining && (!minimalAmount || pendingTransactions())) { - if (!minimalAmount) { console.log("=== minimal ether amount not reached yet") } - if (pendingTransactions()) { console.log("=== there are pending transactions") } - console.log("=== start mining"); - miner_var.start(); - } - else if (web3.eth.mining && minimalAmount && !pendingTransactions()) { - if (minimalAmount) { console.log("=== minimal ether amount reached") } - if (!pendingTransactions()) { console.log("=== no pending transactions") } - console.log("=== stop mining"); - miner_var.stop(); - } -}, 1000) + var start_periodic_mining = function (config, miner_obj) { + var last_mined_ms = Date.now(); + var timeout_set = false; + + miner_obj.start(config.threads); + web3.eth.filter("latest").watch(function () { + if ((config.mine_pending_txns && pendingTransactions()) || timeout_set) { + return; + } + + timeout_set = true; + + var now = Date.now(); + var ms_since_block = now - last_mined_ms; + last_mined_ms = now; + + var next_block_in_ms; + + if (ms_since_block > config.interval_ms) { + next_block_in_ms = 0; + } else { + next_block_in_ms = (config.interval_ms - ms_since_block); + } + + miner_obj.stop(); + console.log("== Looking for next block in " + next_block_in_ms + "ms"); + + setTimeout(function () { + console.log("== Looking for next block"); + timeout_set = false; + miner_obj.start(config.threads); + }, next_block_in_ms); + }); + }; + + var start_transaction_mining = function (config, miner_obj) { + web3.eth.filter("pending").watch(function () { + if (miner_obj.hashrate > 0) return; + + console.log("== Pending transactions! Looking for next block..."); + miner_obj.start(config.threads); + }); + + if (config.mine_periodically) return; + + web3.eth.filter("latest").watch(function () { + if (!pendingTransactions()) { + console.log("== No transactions left. Stopping miner..."); + miner_obj.stop(); + } + }); + }; + + main(); +})(); From 5b352c6af1d4cca81a1490d37feb4ab5fb80387f Mon Sep 17 00:00:00 2001 From: Ryan Casey Date: Fri, 21 Aug 2015 12:17:26 -0700 Subject: [PATCH 12/44] Fund coinbase account if it hasn't been funded. --- js/mine.js | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/js/mine.js b/js/mine.js index 27f3460d..643491b7 100644 --- a/js/mine.js +++ b/js/mine.js @@ -20,6 +20,7 @@ defaults = { interval_ms: 15000, + initial_ether: 15000000000000000000, mine_pending_txns: true, mine_periodically: true, mine_normally: false, @@ -40,8 +41,33 @@ } miner_obj.stop(); - if (config.mine_periodically) start_periodic_mining(config, miner_obj); - if (config.mine_pending_txns) start_transaction_mining(config, miner_obj); + fundAccount(config, miner_obj, function () { + if (config.mine_periodically) start_periodic_mining(config, miner_obj); + if (config.mine_pending_txns) start_transaction_mining(config, miner_obj); + }); + }; + + var fundAccount = function (config, miner_obj, cb) { + var accountFunded = function () { + return (eth.getBalance(eth.coinbase) >= config.initial_ether); + } + + if (accountFunded()) { + return cb(); + } + + console.log("== Funding account"); + miner_obj.start(); + + var blockWatcher = web3.eth.filter("latest").watch(function () { + if (accountFunded()) { + console.log("== Account funded"); + + blockWatcher.stop(); + miner_obj.stop(); + cb(); + } + }); }; var pendingTransactions = function() { From 274524e456eb7d22d9c7539394448d87ea848ce8 Mon Sep 17 00:00:00 2001 From: Ryan Casey Date: Fri, 21 Aug 2015 12:34:02 -0700 Subject: [PATCH 13/44] Sometimes it's nice to get beneath the framework and work with web3 directly. --- lib/chain_manager.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/chain_manager.js b/lib/chain_manager.js index d63c8b85..edc48bbd 100644 --- a/lib/chain_manager.js +++ b/lib/chain_manager.js @@ -6,6 +6,7 @@ ChainManager = function() { this.chainManagerConfig = {}; this.currentChain = {}; this.file = ""; + this.web3 = null; } ChainManager.prototype.loadConfigFile = function(filename) { @@ -34,6 +35,7 @@ ChainManager.prototype.init = function(env, config) { } this.currentChain = this.chainManagerConfig[chainId]; + this.web3 = web3; } ChainManager.prototype.addContract = function(contractName, code, args, address) { From 37633d7f5a26ed06f0b40051e158a15f73e4c303 Mon Sep 17 00:00:00 2001 From: Ryan Casey Date: Fri, 21 Aug 2015 13:22:52 -0700 Subject: [PATCH 14/44] Update testing example. --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e2b4c4d..392858a7 100644 --- a/README.md +++ b/README.md @@ -180,7 +180,15 @@ Embark includes a testing lib to fastly run & test your contracts in a EVM. ```Javascript # spec/contracts/simple_storage_spec.js -EmbarkSpec = require('embark-framework').Tests; +Embark = require('embark-framework'); +Embark.init(); +Embark.blockchainConfig.loadConfigFile('config/blockchain.yml'); +Embark.contractsConfig.loadConfigFile('config/contracts.yml'); + +var files = ['app/contracts/simpleStorage.sol']; +Embark.contractsConfig.init(files, 'development'); + +var EmbarkSpec = Embark.tests(files); describe("SimpleStorage", function() { beforeAll(function() { From c30e63832b38f1108dd2f2fbdc70ed4264604217 Mon Sep 17 00:00:00 2001 From: Harlan T Wood Date: Tue, 25 Aug 2015 16:56:00 -0700 Subject: [PATCH 15/44] Alter require to support `npm link` --- bin/embark | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/embark b/bin/embark index 868a4eea..cb15f836 100755 --- a/bin/embark +++ b/bin/embark @@ -6,7 +6,7 @@ var wrench = require('wrench'); var grunt = require('grunt'); require('shelljs/global'); var readYaml = require('read-yaml'); -var Embark = require('embark-framework'); +var Embark = require('..'); var run = function(cmd) { if (exec(cmd).code != 0) { @@ -169,4 +169,3 @@ if (!process.argv.slice(2).length) { } exit(); - From 63b9430cccd8762e68a5791d455d21c0a048324d Mon Sep 17 00:00:00 2001 From: linagee Date: Wed, 26 Aug 2015 08:22:32 -0600 Subject: [PATCH 16/44] Don't loadNpmTasks grunt-cli (not needed) This was causing a "grunt-cli not found" message even when you had the grunt-cli npm module installed. --- Gruntfile.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 5909c4e1..8a6a4512 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -23,7 +23,7 @@ module.exports = (grunt) -> src: ['test/**/*.js'] grunt.loadTasks "tasks" - require('matchdep').filterAll('grunt-*').forEach(grunt.loadNpmTasks) + require('matchdep').filterAll(['grunt-*','!grunt-cli']).forEach(grunt.loadNpmTasks) grunt.registerTask 'default', ['clean'] grunt.registerTask 'build', ['clean', 'coffee'] From 62428c2f9f5cb9aa6fd8b0c7032309ebab0986cd Mon Sep 17 00:00:00 2001 From: linagee Date: Wed, 26 Aug 2015 09:11:23 -0600 Subject: [PATCH 17/44] npm -g install with no sudo I've tested this to allow installation of embark-framework without requiring using sudo. --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 3e2b4c4d..b368870d 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,16 @@ For specs: pyethereum, ethertdd.py $ npm install -g embark-framework grunt-cli ``` +If you get EACCES (access denied) errors, it is not recommended to use sudo, please try this: + +```Bash +$ mkdir ~/npm-global +$ npm config set prefix ~/npm-global +$ echo 'export PATH="$PATH:$HOME/npm-global/bin"' >>~/.bashrc +$ source ~/.bashrc +$ npm install -g embark-framework grunt-cli +``` + See [Complete Installation Instructions](https://github.com/iurimatias/embark-framework/wiki/Installation). Usage - Demo From 9b4c4b946ae681d016272a9aab7bfab55e0edf42 Mon Sep 17 00:00:00 2001 From: linagee Date: Wed, 26 Aug 2015 09:16:01 -0600 Subject: [PATCH 18/44] Simplified text Because less is more. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b368870d..fa1d753b 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ For specs: pyethereum, ethertdd.py $ npm install -g embark-framework grunt-cli ``` -If you get EACCES (access denied) errors, it is not recommended to use sudo, please try this: +If you get EACCES (access denied) errors, don't use sudo, try this: ```Bash $ mkdir ~/npm-global From 4e2256b743e49986c737278ae8739bd075b8ac11 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Thu, 27 Aug 2015 09:25:10 -0400 Subject: [PATCH 19/44] update blockchain spec --- test/blockchain.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/blockchain.js b/test/blockchain.js index 3f3cca23..f6414d00 100644 --- a/test/blockchain.js +++ b/test/blockchain.js @@ -10,7 +10,7 @@ describe('embark.blockchain', function() { var blockchain = new Blockchain(blockchainConfig); it('should return correct cmd', function() { - assert.strictEqual(blockchain.generate_basic_command(), "geth --datadir=\"/tmp/embark\" --logfile=\"/tmp/embark.log\" --port 30303 --rpc --rpcport 8101 --networkid "+blockchainConfig.networkId+" --rpccorsdomain \"*\" --minerthreads \"1\" --mine --genesis=\"config/genesis.json\" --maxpeers 4 --password config/password "); + assert.strictEqual(blockchain.generate_basic_command(), "geth --datadir=\"/tmp/embark\" --logfile=\"/tmp/embark.log\" --port 30303 --rpc --rpcport 8101 --rpcaddr localhost --networkid "+blockchainConfig.networkId+" --rpccorsdomain \"*\" --minerthreads \"1\" --mine --genesis=\"config/genesis.json\" --rpcapi \"eth,web3\" --maxpeers 4 --password config/password "); }); }); From 67861af6a53eed41ffb18924efa8ccd5e974366c Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Thu, 27 Aug 2015 09:36:22 -0400 Subject: [PATCH 20/44] update blockchain config spec --- test/config.blockchain.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/config.blockchain.js b/test/config.blockchain.js index fa86e16e..bf98b4bc 100644 --- a/test/config.blockchain.js +++ b/test/config.blockchain.js @@ -63,6 +63,7 @@ describe('embark.config.blockchain', function() { gasLimit: 123, gasPrice: 100, rpcWhitelist: "*", + whisper: false, minerthreads: 1, genesisBlock: 'config/genesis.json', datadir: '/tmp/embark', @@ -105,6 +106,7 @@ describe('embark.config.blockchain', function() { gasLimit: 500000, gasPrice: 10000000000000, rpcWhitelist: "*", + whisper: false, minerthreads: 1, genesisBlock: undefined, datadir: '/tmp/embark', From 467713fe8701f4a66e3a7534af494b53a82f2625 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sun, 30 Aug 2015 21:35:34 -0400 Subject: [PATCH 21/44] support solc compiler; display syntax errors --- lib/compiler.js | 29 +++++++++++++++++++++++-- lib/config/contracts.js | 3 +-- test/compiler.js | 37 ++++++++++++++++++++++++++++++++ test/support/contracts/error.sol | 14 ++++++++++++ 4 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 test/compiler.js create mode 100644 test/support/contracts/error.sol diff --git a/lib/compiler.js b/lib/compiler.js index e57af716..56b373c4 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1,3 +1,5 @@ +var shelljs = require('shelljs'); +var shelljs_global = require('shelljs/global'); var web3 = require('web3'); Compiler = function(blockchainConfig) { @@ -18,8 +20,31 @@ Compiler.prototype.init = function(env) { console.log("address is : " + primaryAddress); }; -Compiler.prototype.compile = function(source) { - return web3.eth.compile.solidity(source); +Compiler.prototype.compile = function(contractFile) { + var cmd, result, output, json, compiled_object; + + cmd = "solc --input-file " + contractFile + " --combined-json binary,json-abi"; + + result = exec(cmd, {silent: true}); + output = result.output; + + if (result.code === 1) { + throw new Error(result.output); + } + + json = JSON.parse(output).contracts; + compiled_object = {} + + for (var className in json) { + var contract = json[className]; + + compiled_object[className] = {}; + compiled_object[className].code = contract.binary; + compiled_object[className].info = {}; + compiled_object[className].info.abiDefinition = JSON.parse(contract["json-abi"]); + } + + return compiled_object; }; module.exports = Compiler; diff --git a/lib/config/contracts.js b/lib/config/contracts.js index 5a42e00a..ee962442 100644 --- a/lib/config/contracts.js +++ b/lib/config/contracts.js @@ -79,9 +79,8 @@ ContractsConfig.prototype.compileContracts = function(env) { // compile files for (j = 0; j < this.contractFiles.length; j++) { contractFile = this.contractFiles[j]; - source = fs.readFileSync(contractFile).toString() - compiled_contracts = this.compiler.compile(source); + compiled_contracts = this.compiler.compile(contractFile); for (var className in compiled_contracts) { var contract = compiled_contracts[className]; diff --git a/test/compiler.js b/test/compiler.js new file mode 100644 index 00000000..196be791 --- /dev/null +++ b/test/compiler.js @@ -0,0 +1,37 @@ +var Compiler = require('../lib/compiler.js'); +var assert = require('assert'); + +describe('embark.compiler', function() { + + describe('compile a file', function() { + var files = [ + 'test/support/contracts/simple_storage.sol' + ]; + + it("should build a correct compiled object", function() { + var compiler = new Compiler(); + + var compiledFile = compiler.compile(files[0]); + + assert.equal(compiledFile.SimpleStorage.code, '606060405260405160208060f78339016040526060805190602001505b806000600050819055505b5060c28060356000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900480632a1afcd914604b57806360fe47b114606a5780636d4ce63c14607b576049565b005b605460045060b9565b6040518082815260200191505060405180910390f35b6079600480359060200150609a565b005b608460045060a8565b6040518082815260200191505060405180910390f35b806000600050819055505b50565b6000600060005054905060b6565b90565b6000600050548156'); + + assert.equal(JSON.stringify(compiledFile.SimpleStorage.info.abiDefinition), '[{"constant":true,"inputs":[],"name":"storedData","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"x","type":"uint256"}],"name":"set","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"get","outputs":[{"name":"retVal","type":"uint256"}],"type":"function"},{"inputs":[{"name":"initialValue","type":"uint256"}],"type":"constructor"}]'); + }); + + }); + + describe('compile a file with an error', function() { + var files = [ + 'test/support/contracts/error.sol' + ]; + + it("throw an error", function() { + var compiler = new Compiler(); + + assert.throws(function() { compiler.compile(files[0]) }, Error); + }); + + }); + +}); + diff --git a/test/support/contracts/error.sol b/test/support/contracts/error.sol new file mode 100644 index 00000000..c15c5158 --- /dev/null +++ b/test/support/contracts/error.sol @@ -0,0 +1,14 @@ +contract SimpleStorage { + uint public storedData; + + function SimpleStorage(uint initialValue) { + storedData2 = initialValue; + } + + function set(uint x) { + storedData = x; + } + function get() constant returns (uint retVal) { + return storedData; + } +} From 59d42104b06bd208f8afe47eb9529673c0325fe3 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sun, 30 Aug 2015 22:10:45 -0400 Subject: [PATCH 22/44] add supprot for serpent --- lib/compiler.js | 48 +++++++++++++++++++++- test/compiler.js | 31 ++++++++++++++ test/support/contracts/cash.se | 75 ++++++++++++++++++++++++++++++++++ 3 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 test/support/contracts/cash.se diff --git a/lib/compiler.js b/lib/compiler.js index 56b373c4..5913ca63 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -20,7 +20,7 @@ Compiler.prototype.init = function(env) { console.log("address is : " + primaryAddress); }; -Compiler.prototype.compile = function(contractFile) { +Compiler.prototype.compile_solidity = function(contractFile) { var cmd, result, output, json, compiled_object; cmd = "solc --input-file " + contractFile + " --combined-json binary,json-abi"; @@ -45,6 +45,52 @@ Compiler.prototype.compile = function(contractFile) { } return compiled_object; +} + +Compiler.prototype.compile_serpent = function(contractFile) { + var cmd, result, output, json, compiled_object; + + cmd = "serpent compile " + contractFile; + + result = exec(cmd, {silent: true}); + code = result.output; + + if (result.code === 1) { + throw new Error(result.output); + } + + cmd = "serpent mk_full_signature " + contractFile; + result = exec(cmd, {silent: true}); + + if (result.code === 1) { + throw new Error(result.output); + } + + json = JSON.parse(result.output.trim()); + className = contractFile.split('.')[0].split("/").pop(); + + compiled_object = {} + compiled_object[className] = {}; + compiled_object[className].code = code.trim(); + compiled_object[className].info = {}; + compiled_object[className].info.abiDefinition = json; + + return compiled_object; +} + + +Compiler.prototype.compile = function(contractFile) { + var extension = contractFile.split('.')[1]; + + if (extension === 'sol') { + return this.compile_solidity(contractFile); + } + else if (extension === 'se') { + return this.compile_serpent(contractFile); + } + else { + throw new Error("extension not known"); + } }; module.exports = Compiler; diff --git a/test/compiler.js b/test/compiler.js index 196be791..114d7662 100644 --- a/test/compiler.js +++ b/test/compiler.js @@ -33,5 +33,36 @@ describe('embark.compiler', function() { }); + describe('compile a serpent file', function() { + var files = [ + 'test/support/contracts/cash.se' + ]; + + it("should build a correct compiled object", function() { + var compiler = new Compiler(); + + var compiledFile = compiler.compile(files[0]); + + assert.equal(compiledFile.cash.code, '6000603f536a0186a000000000000000006040604059905901600090526000815232816020015280905020556103658061003a60003961039f56600061047f537c010000000000000000000000000000000000000000000000000000000060003504638357984f81141561005f57600435604052604060405990590160009052600081526040518160200152809050205460605260206060f35b63693200ce8114156101465760043560a05260243560c0523260e0526040604059905901600090526000815260e051816020015280905020546101005260c051610100511215156101385760c0516040604059905901600090526000815260e05181602001528090502054036040604059905901600090526000815260e0518160200152809050205560c0516040604059905901600090526000815260a05181602001528090502054016040604059905901600090526000815260a0518160200152809050205560c0516101c05260206101c0f3610145565b60006101e05260206101e0f35b5b6380b97fc081141561024c5760043560a05260243560c05260443561020052326102005114151561017e576000610220526020610220f35b6040604059905901600090526000815261020051816020015280905020546101005260c0516101005112151561023e5760c0516040604059905901600090526000815261020051816020015280905020540360406040599059016000905260008152610200518160200152809050205560c0516040604059905901600090526000815260a05181602001528090502054016040604059905901600090526000815260a0518160200152809050205560c0516102e05260206102e0f361024b565b6000610300526020610300f35b5b634c764abc8114156102b4576004356103205260243561034052610340516040604059905901600090526000815261032051816020015280905020540360406040599059016000905260008152610320518160200152809050205560016103a05260206103a0f35b63a92c9b8381141561031c57600435610320526024356103405261034051604060405990590160009052600081526103205181602001528090502054016040604059905901600090526000815261032051816020015280905020556001610400526020610400f35b631d62e92281141561036357600435604052602435610420526104205160406040599059016000905260008152604051816020015280905020556001610460526020610460f35b505b6000f3'); + + assert.equal(JSON.stringify(compiledFile.cash.info.abiDefinition), '[{\"name\":\"addCash(int256,int256)\",\"type\":\"function\",\"inputs\":[{\"name\":\"ID\",\"type\":\"int256\"},{\"name\":\"amount\",\"type\":\"int256\"}],\"outputs\":[{\"name\":\"out\",\"type\":\"int256\"}]},{\"name\":\"balance(int256)\",\"type\":\"function\",\"inputs\":[{\"name\":\"address\",\"type\":\"int256\"}],\"outputs\":[{\"name\":\"out\",\"type\":\"int256\"}]},{\"name\":\"send(int256,int256)\",\"type\":\"function\",\"inputs\":[{\"name\":\"recver\",\"type\":\"int256\"},{\"name\":\"value\",\"type\":\"int256\"}],\"outputs\":[{\"name\":\"out\",\"type\":\"int256\"}]},{\"name\":\"sendFrom(int256,int256,int256)\",\"type\":\"function\",\"inputs\":[{\"name\":\"recver\",\"type\":\"int256\"},{\"name\":\"value\",\"type\":\"int256\"},{\"name\":\"from\",\"type\":\"int256\"}],\"outputs\":[{\"name\":\"out\",\"type\":\"int256\"}]},{\"name\":\"setCash(int256,int256)\",\"type\":\"function\",\"inputs\":[{\"name\":\"address\",\"type\":\"int256\"},{\"name\":\"balance\",\"type\":\"int256\"}],\"outputs\":[{\"name\":\"out\",\"type\":\"int256\"}]},{\"name\":\"subtractCash(int256,int256)\",\"type\":\"function\",\"inputs\":[{\"name\":\"ID\",\"type\":\"int256\"},{\"name\":\"amount\",\"type\":\"int256\"}],\"outputs\":[{\"name\":\"out\",\"type\":\"int256\"}]}]'); + }); + + }); + + describe('compile a file with an error', function() { + var files = [ + 'test/support/contracts/error.sol' + ]; + + it("throw an error", function() { + var compiler = new Compiler(); + + assert.throws(function() { compiler.compile(files[0]) }, Error); + }); + + }); + + }); diff --git a/test/support/contracts/cash.se b/test/support/contracts/cash.se new file mode 100644 index 00000000..c70f0c57 --- /dev/null +++ b/test/support/contracts/cash.se @@ -0,0 +1,75 @@ +# This software (Augur) allows buying && selling event outcomes in ethereum +# Copyright (C) 2015 Forecast Foundation +# This program is free software; you can redistribute it &&/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is free software: you can redistribute it &&/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# Any questions please contact joey@augur.net + +data cashcoinBalances[] + +def init(): + # test initial funds + self.cashcoinBalances[tx.origin] = 100000*2^64 + +# @return: cash balance of address +def balance(address): + return(self.cashcoinBalances[address]) + +# should send values as fixed point in UI (1 is 2^64, 4 is 4*2^64, .5 is 2^63, etc.) +# so cashcoin fees could just go to root branch, or we could not have fees besides +# gas fee to do a send transaction +# @return: value sent, 0 if fails +def send(recver, value): + sender = tx.origin + senderBalance = self.cashcoinBalances[sender] + if(senderBalance >= value): + self.cashcoinBalances[sender] -= value + self.cashcoinBalances[recver] += value + return(value) + else: + return(0) + +# @return value of cash sent; fail is 0 +def sendFrom(recver, value, from): + if(from!=tx.origin): + return(0) + senderBalance = self.cashcoinBalances[from] + if(senderBalance >= value): + self.cashcoinBalances[from] -= value + self.cashcoinBalances[recver] += value + return(value) + else: + return(0) + +# make sure only coming from specific contracts +def subtractCash(ID, amount): + #if(!self.whitelist.check(msg.sender)): + # return(-1) + self.cashcoinBalances[ID] -= amount + return(1) + +def addCash(ID, amount): + #if(!self.whitelist.check(msg.sender)): + # return(-1) + self.cashcoinBalances[ID] += amount + return(1) + +def setCash(address, balance): + #if !self.whitelist.check(msg.sender): + # return(-1) + self.cashcoinBalances[address] = balance + return(1) From f8ba2acf715a0d2bcf2518d7a0408898b5211bff Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 31 Aug 2015 08:24:09 -0400 Subject: [PATCH 23/44] workaround for abi issues --- lib/compiler.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/compiler.js b/lib/compiler.js index 5913ca63..7a98aac1 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -69,6 +69,14 @@ Compiler.prototype.compile_serpent = function(contractFile) { json = JSON.parse(result.output.trim()); className = contractFile.split('.')[0].split("/").pop(); + for (var i=0; i < json.length; i++) { + var elem = json[i]; + + if (elem.outputs.length > 0) { + elem.constant = true; + } + } + compiled_object = {} compiled_object[className] = {}; compiled_object[className].code = code.trim(); From 66a9c1fad64d20be5df2322bcfbcc695eb46522b Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 31 Aug 2015 08:33:15 -0400 Subject: [PATCH 24/44] update README --- README.md | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 392858a7..2deb4281 100644 --- a/README.md +++ b/README.md @@ -7,15 +7,17 @@ Embark is a framework that allows you to easily develop and deploy DApps. With Embark you can: * Automatically deploy contracts and make them available in your JS code. Embark watches for changes, and if you update a contract, Embark will automatically redeploy the contracts (if needed) and the dapp. +* Use any build pipeline or tool you wish, including grunt and meteor. * Do Test Driven Development with Contracts using Javascript. * Easily deploy to & use decentralized systems such as IPFS. +* Keep track of deployed contracts, deploy only when truly needed. * Quickly create advanced DApps using multiple contracts. See the [Wiki](https://github.com/iurimatias/embark-framework/wiki) for more details. Installation ====== -Requirements: geth (1.0.0), solc (0.9.23), node (0.12.2) and npm +Requirements: geth (1.0.0), solc (0.1.0) or serpent (develop), node (0.12.2) and npm For specs: pyethereum, ethertdd.py @@ -62,7 +64,7 @@ DApp Structure ```Bash app/ - |___ contracts/ #solidity contracts + |___ contracts/ #solidity or serpent contracts |___ html/ |___ css/ |___ js/ @@ -74,7 +76,7 @@ DApp Structure |___ contracts/ #contracts tests ``` -Solidity files in the contracts directory will automatically be deployed with embark run. Changes in any files will automatically be reflected in app, changes to contracts will result in a redeployment and update of their JS Bindings +Solidity/Serpent files in the contracts directory will automatically be deployed with embark run. Changes in any files will automatically be reflected in app, changes to contracts will result in a redeployment and update of their JS Bindings Using Contracts ====== @@ -171,6 +173,26 @@ Contracts addresses can be defined, If an address is defined the contract wouldn ... ``` +You can also define contract interfaces (Stubs) and actions to do on deployment + +```Yaml + development: + DataSource: + args: + MyDataSource: + args: + instanceOf: DataSource + Manager: + stubs: + - DataSource + args: + - $MyDataSource + onDeploy: + - Manager.updateStorage($MyDataSource) + - MyDataSource.set(5) + ... +``` + Tests ====== From b3b1b13795a8deaf7eee08f40e2ea4d27696d418 Mon Sep 17 00:00:00 2001 From: Chris Hitchcott Date: Mon, 31 Aug 2015 00:48:38 +0800 Subject: [PATCH 25/44] implement `getStartBlockchainCommand` to return geth CLI string --- lib/blockchain.js | 5 +++++ lib/index.js | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/lib/blockchain.js b/lib/blockchain.js index 45c8bd9e..9ab37a5c 100644 --- a/lib/blockchain.js +++ b/lib/blockchain.js @@ -126,4 +126,9 @@ Blockchain.prototype.execGeth = function(args) { exec(cmd); } +Blockchain.prototype.getStartChainCommand = function(use_tmp) { + var address = this.get_address(); + return this.run_command(address, use_tmp); +} + module.exports = Blockchain diff --git a/lib/index.js b/lib/index.js index e81dcc4b..07797fb2 100644 --- a/lib/index.js +++ b/lib/index.js @@ -35,6 +35,11 @@ Embark = { chain.startChain(use_tmp); }, + getStartBlockchainCommand: function(env, use_tmp) { + var chain = new Blockchain(this.blockchainConfig.config(env)); + return chain.getStartChainCommand(use_tmp); + }, + deployContracts: function(env, contractFiles, destFile, chainFile) { this.contractsConfig.init(contractFiles, env); From 44583f525f47eaeb7f6d6275c790a61eebb556d3 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 31 Aug 2015 20:19:07 -0400 Subject: [PATCH 26/44] adjust readme --- README.md | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index ec1d837e..ae29a399 100644 --- a/README.md +++ b/README.md @@ -25,16 +25,6 @@ For specs: pyethereum, ethertdd.py $ npm install -g embark-framework grunt-cli ``` -If you get EACCES (access denied) errors, don't use sudo, try this: - -```Bash -$ mkdir ~/npm-global -$ npm config set prefix ~/npm-global -$ echo 'export PATH="$PATH:$HOME/npm-global/bin"' >>~/.bashrc -$ source ~/.bashrc -$ npm install -g embark-framework grunt-cli -``` - See [Complete Installation Instructions](https://github.com/iurimatias/embark-framework/wiki/Installation). Usage - Demo @@ -296,4 +286,19 @@ Because embark is internally using grunt tasks, debugging is not straightforward - This gives you nothing with embark. If you look at `deploy` command in [`./bin/embark`](https://github.com/iurimatias/embark-framework/blob/develop/bin/embark#L32-L35) you will notice that it internally runs grunt task `grunt deploy_contracts:[env]` - with this knowledge we can prepare proper command to start debugging - `node-debug -p 7000 grunt -- deploy_contracts:development` -- [here](https://github.com/iurimatias/embark-framework/blob/develop/tasks/tasks.coffee) is list of all debuggable grunt tasks +- + + [here](https://github.com/iurimatias/embark-framework/blob/develop/tasks/tasks.coffee) is list of all debuggable grunt tasks + +EACCESS Error +====== +If you get EACCES (access denied) errors, don't use sudo, try this: + +```Bash +$ mkdir ~/npm-global +$ npm config set prefix ~/npm-global +$ echo 'export PATH="$PATH:$HOME/npm-global/bin"' >>~/.bashrc +$ source ~/.bashrc +$ npm install -g embark-framework grunt-cli +``` + From e1ae6dae0ceb4609bad246f34c434966c41a0aa9 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 31 Aug 2015 20:53:17 -0400 Subject: [PATCH 27/44] implement deploy field --- README.md | 1 - lib/config/contracts.js | 5 +++++ lib/deploy.js | 5 +++++ test/deploy.js | 3 ++- test/support/instances.yml | 1 + 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ae29a399..7acffc93 100644 --- a/README.md +++ b/README.md @@ -261,7 +261,6 @@ The environment is a specific blockchain configuration that can be managed at co See [Configuration](https://github.com/iurimatias/embark-framework/wiki/Configuration). - Deploying only contracts ====== Although embark run will automatically deploy contracts, you can choose to only deploy the contracts to a specific environment diff --git a/lib/config/contracts.js b/lib/config/contracts.js index ee962442..0e74e1d4 100644 --- a/lib/config/contracts.js +++ b/lib/config/contracts.js @@ -132,6 +132,11 @@ ContractsConfig.prototype.compileContracts = function(env) { contract.types.push('static'); } + contract.deploy = contractConfig.deploy; + if (contractConfig.deploy === undefined) { + contract.deploy = true; + } + if (this.all_contracts.indexOf(className) < 0) { this.all_contracts.push(className); } diff --git a/lib/deploy.js b/lib/deploy.js index d00b0c7b..e65a3625 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -58,6 +58,11 @@ Deploy.prototype.deploy_contracts = function(env) { className = all_contracts[k]; contract = this.contractDB[className]; + if (contract.deploy === false) { + console.log("skipping " + className); + continue; + } + var realArgs = []; for (var l = 0; l < contract.args.length; l++) { arg = contract.args[l]; diff --git a/test/deploy.js b/test/deploy.js index 7e7fd6b2..e5c1fc46 100644 --- a/test/deploy.js +++ b/test/deploy.js @@ -110,12 +110,13 @@ describe('embark.deploy', function() { deploy.deploy_contracts("development"); it("should deploy contracts", function() { - var all_contracts = ['SimpleStorage', 'BarStorage', 'FooStorage']; + var all_contracts = ['BarStorage', 'FooStorage']; for(var i=0; i < all_contracts.length; i++) { var className = all_contracts[i]; assert.equal(deploy.deployedContracts.hasOwnProperty(className), true); } + assert.notEqual(deploy.deployedContracts.hasOwnProperty('SimpleStorage'), true); }); }); diff --git a/test/support/instances.yml b/test/support/instances.yml index 04e15644..04172a48 100644 --- a/test/support/instances.yml +++ b/test/support/instances.yml @@ -1,5 +1,6 @@ development: SimpleStorage: + deploy: false args: - 100 BarStorage: From 05e35616702c4e39e6d334097df4c24a703b2a78 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 31 Aug 2015 20:59:16 -0400 Subject: [PATCH 28/44] update compiler spec --- test/compiler.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/compiler.js b/test/compiler.js index 114d7662..9e3761df 100644 --- a/test/compiler.js +++ b/test/compiler.js @@ -45,7 +45,8 @@ describe('embark.compiler', function() { assert.equal(compiledFile.cash.code, '6000603f536a0186a000000000000000006040604059905901600090526000815232816020015280905020556103658061003a60003961039f56600061047f537c010000000000000000000000000000000000000000000000000000000060003504638357984f81141561005f57600435604052604060405990590160009052600081526040518160200152809050205460605260206060f35b63693200ce8114156101465760043560a05260243560c0523260e0526040604059905901600090526000815260e051816020015280905020546101005260c051610100511215156101385760c0516040604059905901600090526000815260e05181602001528090502054036040604059905901600090526000815260e0518160200152809050205560c0516040604059905901600090526000815260a05181602001528090502054016040604059905901600090526000815260a0518160200152809050205560c0516101c05260206101c0f3610145565b60006101e05260206101e0f35b5b6380b97fc081141561024c5760043560a05260243560c05260443561020052326102005114151561017e576000610220526020610220f35b6040604059905901600090526000815261020051816020015280905020546101005260c0516101005112151561023e5760c0516040604059905901600090526000815261020051816020015280905020540360406040599059016000905260008152610200518160200152809050205560c0516040604059905901600090526000815260a05181602001528090502054016040604059905901600090526000815260a0518160200152809050205560c0516102e05260206102e0f361024b565b6000610300526020610300f35b5b634c764abc8114156102b4576004356103205260243561034052610340516040604059905901600090526000815261032051816020015280905020540360406040599059016000905260008152610320518160200152809050205560016103a05260206103a0f35b63a92c9b8381141561031c57600435610320526024356103405261034051604060405990590160009052600081526103205181602001528090502054016040604059905901600090526000815261032051816020015280905020556001610400526020610400f35b631d62e92281141561036357600435604052602435610420526104205160406040599059016000905260008152604051816020015280905020556001610460526020610460f35b505b6000f3'); - assert.equal(JSON.stringify(compiledFile.cash.info.abiDefinition), '[{\"name\":\"addCash(int256,int256)\",\"type\":\"function\",\"inputs\":[{\"name\":\"ID\",\"type\":\"int256\"},{\"name\":\"amount\",\"type\":\"int256\"}],\"outputs\":[{\"name\":\"out\",\"type\":\"int256\"}]},{\"name\":\"balance(int256)\",\"type\":\"function\",\"inputs\":[{\"name\":\"address\",\"type\":\"int256\"}],\"outputs\":[{\"name\":\"out\",\"type\":\"int256\"}]},{\"name\":\"send(int256,int256)\",\"type\":\"function\",\"inputs\":[{\"name\":\"recver\",\"type\":\"int256\"},{\"name\":\"value\",\"type\":\"int256\"}],\"outputs\":[{\"name\":\"out\",\"type\":\"int256\"}]},{\"name\":\"sendFrom(int256,int256,int256)\",\"type\":\"function\",\"inputs\":[{\"name\":\"recver\",\"type\":\"int256\"},{\"name\":\"value\",\"type\":\"int256\"},{\"name\":\"from\",\"type\":\"int256\"}],\"outputs\":[{\"name\":\"out\",\"type\":\"int256\"}]},{\"name\":\"setCash(int256,int256)\",\"type\":\"function\",\"inputs\":[{\"name\":\"address\",\"type\":\"int256\"},{\"name\":\"balance\",\"type\":\"int256\"}],\"outputs\":[{\"name\":\"out\",\"type\":\"int256\"}]},{\"name\":\"subtractCash(int256,int256)\",\"type\":\"function\",\"inputs\":[{\"name\":\"ID\",\"type\":\"int256\"},{\"name\":\"amount\",\"type\":\"int256\"}],\"outputs\":[{\"name\":\"out\",\"type\":\"int256\"}]}]'); + assert.equal(JSON.stringify(compiledFile.cash.info.abiDefinition), '[{\"name\":\"addCash(int256,int256)\",\"type\":\"function\",\"inputs\":[{\"name\":\"ID\",\"type\":\"int256\"},{\"name\":\"amount\",\"type\":\"int256\"}],\"outputs\":[{\"name\":\"out\",\"type\":\"int256\"}],\"constant\":true},{\"name\":\"balance(int256)\",\"type\":\"function\",\"inputs\":[{\"name\":\"address\",\"type\":\"int256\"}],\"outputs\":[{\"name\":\"out\",\"type\":\"int256\"}],\"constant\":true},{\"name\":\"send(int256,int256)\",\"type\":\"function\",\"inputs\":[{\"name\":\"recver\",\"type\":\"int256\"},{\"name\":\"value\",\"type\":\"int256\"}],\"outputs\":[{\"name\":\"out\",\"type\":\"int256\"}],\"constant\":true},{\"name\":\"sendFrom(int256,int256,int256)\",\"type\":\"function\",\"inputs\":[{\"name\":\"recver\",\"type\":\"int256\"},{\"name\":\"value\",\"type\":\"int256\"},{\"name\":\"from\",\"type\":\"int256\"}],\"outputs\":[{\"name\":\"out\",\"type\":\"int256\"}],\"constant\":true},{\"name\":\"setCash(int256,int256)\",\"type\":\"function\",\"inputs\":[{\"name\":\"address\",\"type\":\"int256\"},{\"name\":\"balance\",\"type\":\"int256\"}],\"outputs\":[{\"name\":\"out\",\"type\":\"int256\"}],\"constant\":true},{\"name\":\"subtractCash(int256,int256)\",\"type\":\"function\",\"inputs\":[{\"name\":\"ID\",\"type\":\"int256\"},{\"name\":\"amount\",\"type\":\"int256\"}],\"outputs\":[{\"name\":\"out\",\"type\":\"int256\"}],\"constant\":true}]'); + }); }); From 67ff8033973c70e08dd3ebabbdd8c973e27a4049 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 31 Aug 2015 21:02:21 -0400 Subject: [PATCH 29/44] add deploy example to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7acffc93..0a8304a7 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,7 @@ You can now deploy many instances of the same contract. e.g # config/contracts.yml development: Currency: + deploy: false args: - 100 Usd: From 3d2a14e28b6fbffb8df46930cb17224463d58b08 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 31 Aug 2015 21:14:12 -0400 Subject: [PATCH 30/44] check if contract exists --- lib/deploy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/deploy.js b/lib/deploy.js index e65a3625..e1c84709 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -82,7 +82,7 @@ Deploy.prototype.deploy_contracts = function(env) { else { var chainContract = this.chainManager.getContract(className, contract.compiled.code, realArgs); - if (chainContract != undefined) { + if (chainContract != undefined && web3.eth.getCode(chainContract.address) !== "0x") { console.log("contract " + className + " is unchanged and already deployed at " + chainContract.address); this.deployedContracts[className] = chainContract.address; this.execute_cmds(contract.onDeploy); From 66d6f08c0f5b294c532116e6b5e3a46511c97248 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 31 Aug 2015 21:25:50 -0400 Subject: [PATCH 31/44] by default don't mine periodicaly --- js/mine.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/mine.js b/js/mine.js index 643491b7..324acd5e 100644 --- a/js/mine.js +++ b/js/mine.js @@ -22,7 +22,7 @@ interval_ms: 15000, initial_ether: 15000000000000000000, mine_pending_txns: true, - mine_periodically: true, + mine_periodically: false, mine_normally: false, threads: 1 } From b80407af8784bb543dc341e028e48a33fbc27f55 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 31 Aug 2015 21:39:47 -0400 Subject: [PATCH 32/44] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0a8304a7..d9b4946f 100644 --- a/README.md +++ b/README.md @@ -285,10 +285,10 @@ Because embark is internally using grunt tasks, debugging is not straightforward - normally you would write something like `node-debug -p 7000 embark -- deploy` - This gives you nothing with embark. If you look at `deploy` command in [`./bin/embark`](https://github.com/iurimatias/embark-framework/blob/develop/bin/embark#L32-L35) you will notice that it internally runs grunt task `grunt deploy_contracts:[env]` - with this knowledge we can prepare proper command to start debugging -- `node-debug -p 7000 grunt -- deploy_contracts:development` -- +- ```node-debug -p 7000 grunt -- deploy_contracts:development``` - [here](https://github.com/iurimatias/embark-framework/blob/develop/tasks/tasks.coffee) is list of all debuggable grunt tasks + +[here](https://github.com/iurimatias/embark-framework/blob/develop/tasks/tasks.coffee) is list of all debuggable grunt tasks EACCESS Error ====== From 5a3a2c595145ffba5faadd22bbb3ef6a51dda3d4 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 31 Aug 2015 21:58:39 -0400 Subject: [PATCH 33/44] add serpent to readme examples --- boilerplate/Gruntfile.coffee | 1 + boilerplate/embark.yml | 2 +- demo_meteor/embark.yml | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/boilerplate/Gruntfile.coffee b/boilerplate/Gruntfile.coffee index 92d7f086..150ff372 100644 --- a/boilerplate/Gruntfile.coffee +++ b/boilerplate/Gruntfile.coffee @@ -33,6 +33,7 @@ module.exports = (grunt) -> contracts: src: [ "app/contracts/**/*.sol" + "app/contracts/**/*.se" ] coffee: diff --git a/boilerplate/embark.yml b/boilerplate/embark.yml index 5d19d917..b47e72d2 100644 --- a/boilerplate/embark.yml +++ b/boilerplate/embark.yml @@ -1,5 +1,5 @@ type: "grunt" #other options: meteor, manual -#contracts: ["app/contracts/**/*.sol"] +#contracts: ["app/contracts/**/*.sol", "app/contracts/**/*.se"] #output: "src/embark.js" #blockchainConfig: "config/blockchain.yml" #contractsConfig: "config/contracts.yml" diff --git a/demo_meteor/embark.yml b/demo_meteor/embark.yml index d39816df..329544dd 100644 --- a/demo_meteor/embark.yml +++ b/demo_meteor/embark.yml @@ -1,5 +1,5 @@ type: "meteor" -contracts: ["contracts/**/*.sol"] +contracts: ["contracts/**/*.sol", "contracts/**/*.se"] output: "client/embark.js" blockchainConfig: "config/blockchain.yml" contractsConfig: "config/contracts.yml" From 734db0136b139031e369584f6132f60f6f8b83ff Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 31 Aug 2015 22:00:07 -0400 Subject: [PATCH 34/44] clarify meteor use in readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index d9b4946f..0cebed47 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,8 @@ This will automatically deploy the contracts, update their JS bindings and deplo Note that if you update your code it will automatically be re-deployed, contracts included. There is no need to restart embark, refreshing the page on the browser will do. +note: for a demo using meteor do ```embark meteor_demo``` followed by ```embark deploy``` then ```meteor``` + Creating a new DApp ====== From ece92d0eea7cfd47bd623b27b01e9305e8135ac7 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 31 Aug 2015 22:03:02 -0400 Subject: [PATCH 35/44] add structuring application section to readme --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 0cebed47..d0741c35 100644 --- a/README.md +++ b/README.md @@ -274,6 +274,20 @@ $ embark deploy privatenet embark deploy will deploy all contracts at app/contracts and return the resulting addresses +Structuring Application +====== + +Embark is quite flexible and you can configure you're own directory structure using ```embark.yml``` + +```Yaml +# embark.yml + type: "manual" #other options: meteor, grunt + contracts: ["app/contracts/**/*.sol", "app/contracts/**/*.se"] # contracts files + output: "src/embark.js" # resulting javascript interface + blockchainConfig: "config/blockchain.yml" # blockchain config + contractsConfig: "config/contracts.yml" # contracts config +``` + LiveReload Plugin ====== From ce4e157e11658402fb94ca738238467e88d3e044 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 31 Aug 2015 22:06:30 -0400 Subject: [PATCH 36/44] add IPFS section to readme --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index d0741c35..b5dd3bda 100644 --- a/README.md +++ b/README.md @@ -288,6 +288,12 @@ Embark is quite flexible and you can configure you're own directory structure us contractsConfig: "config/contracts.yml" # contracts config ``` +Deploying to IPFS +====== + +To deploy a dapp to IPFS, all you need to do is run a local IPFS node and then run ```embark ipfs```. +If you want to deploy to the live net then after configuring you account on ```config/blockchain.yml``` on the ```production``` environment then you can deploy to that chain by specifying the environment ```embark ipfs production```. + LiveReload Plugin ====== From d468e43f6f756db630a38b78c8b74f325fb6d6e0 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 31 Aug 2015 22:10:50 -0400 Subject: [PATCH 37/44] update to 0.9.0 --- bin/embark | 2 +- boilerplate/package.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/embark b/bin/embark index 7f20c529..1ee8d2bc 100755 --- a/bin/embark +++ b/bin/embark @@ -32,7 +32,7 @@ var deploy = function(env, embarkConfig) { } program - .version('0.8.6') + .version('0.9.0') program.command('new [name]').description('New application').action(function(name) { if (name === undefined) { diff --git a/boilerplate/package.json b/boilerplate/package.json index b845b07c..560172b8 100644 --- a/boilerplate/package.json +++ b/boilerplate/package.json @@ -10,8 +10,8 @@ "license": "ISC", "homepage": "", "devDependencies": { - "embark-framework": "^0.8.6", - "grunt-embark": "^0.3.0", + "embark-framework": "^0.9.0", + "grunt-embark": "^0.4.0", "grunt-contrib-clean": "^0.6.0", "grunt-contrib-coffee": "^0.13.0", "grunt-contrib-concat": "^0.5.1", diff --git a/package.json b/package.json index ae3ed391..235a4cad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "embark-framework", - "version": "0.8.6", + "version": "0.9.0", "description": "", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" From d51dbaf4aeaba7a6d35b221b35ad6d6e402a3a73 Mon Sep 17 00:00:00 2001 From: Joris Bontje Date: Wed, 2 Sep 2015 10:13:56 +0200 Subject: [PATCH 38/44] stop blockWatcher filter with correct method name. fixes #74 --- js/mine.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/js/mine.js b/js/mine.js index 324acd5e..c685ae50 100644 --- a/js/mine.js +++ b/js/mine.js @@ -4,7 +4,7 @@ (function() { var main = function () { /* TODO: Find a way to load mining config from YML. - + if (!loadScript("config.js")) { console.log("== config.js not found"); } @@ -63,7 +63,7 @@ if (accountFunded()) { console.log("== Account funded"); - blockWatcher.stop(); + blockWatcher.stopWatching(); miner_obj.stop(); cb(); } @@ -124,7 +124,7 @@ console.log("== Pending transactions! Looking for next block..."); miner_obj.start(config.threads); }); - + if (config.mine_periodically) return; web3.eth.filter("latest").watch(function () { @@ -137,4 +137,3 @@ main(); })(); - From 95a1c5a550760f60b3af7472aac10893127d2e8b Mon Sep 17 00:00:00 2001 From: Chris Hitchcott Date: Thu, 3 Sep 2015 18:36:25 +0800 Subject: [PATCH 39/44] make `copyMinerJavascriptToTemp` step public --- bin/embark | 3 +-- lib/index.js | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/embark b/bin/embark index 1ee8d2bc..e7506768 100755 --- a/bin/embark +++ b/bin/embark @@ -132,8 +132,7 @@ program.command('blockchain [env]').description('run blockchain').action(functio Embark.blockchainConfig.loadConfigFile(embarkConfig.blockchainConfig) Embark.contractsConfig.loadConfigFile(embarkConfig.contractsConfig) - //TODO: better with --exec, but need to fix console bug first - wrench.copyDirSyncRecursive(__dirname + "/../js", "/tmp/js", {forceDelete: true}); + Embark.copyMinerJavascriptToTemp(); Embark.startBlockchain(env, true); } diff --git a/lib/index.js b/lib/index.js index 07797fb2..fcc82d3b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -35,6 +35,11 @@ Embark = { chain.startChain(use_tmp); }, + copyMinerJavascriptToTemp: function(){ + //TODO: better with --exec, but need to fix console bug first + wrench.copyDirSyncRecursive(__dirname + "/../js", "/tmp/js", {forceDelete: true}); + }, + getStartBlockchainCommand: function(env, use_tmp) { var chain = new Blockchain(this.blockchainConfig.config(env)); return chain.getStartChainCommand(use_tmp); From 98054a2cbb6bf3be19e0f2722b8d247b5c206110 Mon Sep 17 00:00:00 2001 From: Gerbrand van DIeijen Date: Fri, 4 Sep 2015 10:55:19 +0200 Subject: [PATCH 40/44] Allowing to define chains file per environment/chain --- bin/embark | 5 +---- lib/config/blockchain.js | 1 + test/config.blockchain.js | 6 +++++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bin/embark b/bin/embark index 1ee8d2bc..0442cdf8 100755 --- a/bin/embark +++ b/bin/embark @@ -17,15 +17,12 @@ var run = function(cmd) { var deploy = function(env, embarkConfig) { var contractFiles = grunt.file.expand(embarkConfig.contracts); var destFile = embarkConfig.output; - var chainFile = embarkConfig.chains; Embark.init(); Embark.blockchainConfig.loadConfigFile(embarkConfig.blockchainConfig); Embark.contractsConfig.loadConfigFile(embarkConfig.contractsConfig); - if (chainFile === undefined) { - chainFile = './chains.json'; - } + var chainFile = Embark.blockchainConfig.blockchainConfig[env].chains || embarkConfig.chains || './chains.json'; abi = Embark.deployContracts(env, contractFiles, destFile, chainFile); grunt.file.write(destFile, abi); diff --git a/lib/config/blockchain.js b/lib/config/blockchain.js index 368fa493..15323a9a 100644 --- a/lib/config/blockchain.js +++ b/lib/config/blockchain.js @@ -40,6 +40,7 @@ BlockchainConfig.prototype.config = function(env) { minerthreads: config.minerthreads, genesisBlock: config.genesis_block, datadir: config.datadir, + chains: config.chains, networkId: networkId, maxPeers: 4, port: config.port || "30303", diff --git a/test/config.blockchain.js b/test/config.blockchain.js index bf98b4bc..d9db6129 100644 --- a/test/config.blockchain.js +++ b/test/config.blockchain.js @@ -43,6 +43,7 @@ describe('embark.config.blockchain', function() { minerthreads: 1, genesis_block: 'config/genesis.json', datadir: '/tmp/embark', + chains: 'chains_development.json', mine_when_needed: true, gas_limit: 123, gas_price: 100, @@ -67,6 +68,7 @@ describe('embark.config.blockchain', function() { minerthreads: 1, genesisBlock: 'config/genesis.json', datadir: '/tmp/embark', + chains: 'chains_development.json', networkId: 0, maxPeers: 4, port: "30303", @@ -88,12 +90,13 @@ describe('embark.config.blockchain', function() { network_id: 0, minerthreads: 1, datadir: '/tmp/embark', + chains: undefined, mine_when_needed: true, console: false, account: { init: true, password: 'config/password' - } + }, }, staging: {} }; @@ -110,6 +113,7 @@ describe('embark.config.blockchain', function() { minerthreads: 1, genesisBlock: undefined, datadir: '/tmp/embark', + chains: undefined, networkId: 0, maxPeers: 4, port: "30303", From a3464a4d8802d38efd8f0aa62e36524422efd699 Mon Sep 17 00:00:00 2001 From: Gerbrand van DIeijen Date: Fri, 4 Sep 2015 11:18:54 +0200 Subject: [PATCH 41/44] Added minor reference to chains specific chains file --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b5dd3bda..4930ed01 100644 --- a/README.md +++ b/README.md @@ -201,7 +201,7 @@ Tests You can run specs with ```embark spec```, it will run any files ending *_spec.js under ```spec/```. -Embark includes a testing lib to fastly run & test your contracts in a EVM. +Embark includes a testing lib to fastly run & test your contracts in a EVM. ```Javascript # spec/contracts/simple_storage_spec.js @@ -255,6 +255,7 @@ The environment is a specific blockchain configuration that can be managed at co rpc_port: 8101 rpc_whitelist: "*" datadir: default + chains: chains_staging.json network_id: 0 console: true account: @@ -323,4 +324,3 @@ $ echo 'export PATH="$PATH:$HOME/npm-global/bin"' >>~/.bashrc $ source ~/.bashrc $ npm install -g embark-framework grunt-cli ``` - From 4b1e7109a48a50a8882ad787f6e11e3d60186778 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sat, 5 Sep 2015 07:39:22 -0400 Subject: [PATCH 42/44] add default config for development chain --- boilerplate/config/blockchain.yml | 1 + boilerplate/config/chains/development.json | 1 + demo/config/blockchain.yml | 1 + demo/config/chains/development.json | 1 + 4 files changed, 4 insertions(+) create mode 100644 boilerplate/config/chains/development.json create mode 100644 demo/config/chains/development.json diff --git a/boilerplate/config/blockchain.yml b/boilerplate/config/blockchain.yml index 0eafb67b..49fb0add 100644 --- a/boilerplate/config/blockchain.yml +++ b/boilerplate/config/blockchain.yml @@ -5,6 +5,7 @@ development: minerthreads: 1 genesis_block: config/genesis/dev_genesis.json datadir: /tmp/embark + chains: config/chains/development.json mine_when_needed: true max_peers: 0 gas_limit: 500000 diff --git a/boilerplate/config/chains/development.json b/boilerplate/config/chains/development.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/boilerplate/config/chains/development.json @@ -0,0 +1 @@ +{} diff --git a/demo/config/blockchain.yml b/demo/config/blockchain.yml index 0072c4cb..5c17deba 100644 --- a/demo/config/blockchain.yml +++ b/demo/config/blockchain.yml @@ -5,6 +5,7 @@ development: minerthreads: 1 genesis_block: config/genesis/dev_genesis.json datadir: /tmp/embark + chains: config/chains/development.json mine_when_needed: true gas_limit: 500000 gas_price: 10000000000000 diff --git a/demo/config/chains/development.json b/demo/config/chains/development.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/demo/config/chains/development.json @@ -0,0 +1 @@ +{} From 74dbe2dbbe6a825a0ffe3e8c99e7b899f003c5d9 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sat, 5 Sep 2015 07:39:32 -0400 Subject: [PATCH 43/44] add gitignore to boilerplate --- boilerplate/.gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 boilerplate/.gitignore diff --git a/boilerplate/.gitignore b/boilerplate/.gitignore new file mode 100644 index 00000000..5620484f --- /dev/null +++ b/boilerplate/.gitignore @@ -0,0 +1,2 @@ +node_modules/ +chains/development.json From fc66ea9eded7c0fa41276cbf8550e3bb4f46231b Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sat, 5 Sep 2015 07:43:13 -0400 Subject: [PATCH 44/44] update to 0.9.1 --- bin/embark | 2 +- boilerplate/package.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/embark b/bin/embark index 7706bac6..f9141ca0 100755 --- a/bin/embark +++ b/bin/embark @@ -29,7 +29,7 @@ var deploy = function(env, embarkConfig) { } program - .version('0.9.0') + .version('0.9.1') program.command('new [name]').description('New application').action(function(name) { if (name === undefined) { diff --git a/boilerplate/package.json b/boilerplate/package.json index 560172b8..c7235070 100644 --- a/boilerplate/package.json +++ b/boilerplate/package.json @@ -10,8 +10,8 @@ "license": "ISC", "homepage": "", "devDependencies": { - "embark-framework": "^0.9.0", - "grunt-embark": "^0.4.0", + "embark-framework": "^0.9.1", + "grunt-embark": "^0.4.1", "grunt-contrib-clean": "^0.6.0", "grunt-contrib-coffee": "^0.13.0", "grunt-contrib-concat": "^0.5.1", diff --git a/package.json b/package.json index 235a4cad..2f8517ca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "embark-framework", - "version": "0.9.0", + "version": "0.9.1", "description": "", "scripts": { "test": "echo \"Error: no test specified\" && exit 1"