Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
6f808cf
ability to create multiple contracts with a single password for testi…
VoR0220 Sep 15, 2015
bc96708
correcting some changes I made in error
VoR0220 Sep 15, 2015
ef97e48
correcting some changes I made in error
VoR0220 Sep 15, 2015
92ca694
fix embarassing typo
iurimatias Sep 15, 2015
8539ff2
update to 0.9.3
iurimatias Sep 15, 2015
1a4bcd1
support solc version 1.0
VoR0220 Sep 16, 2015
7620f16
show grunt stacktrace
FredericHeem Sep 24, 2015
3c17582
throw error when block cannot be found
FredericHeem Sep 25, 2015
8f96834
add geth_extra_opts options, can be used to set --vmdebug to geth
FredericHeem Sep 25, 2015
6b7b88d
don-'t call web3.eth.getBlock twice
FredericHeem Sep 25, 2015
1a147ab
Merge branch 'develop' of https://github.com/iurimatias/embark-framew…
VoR0220 Sep 26, 2015
f818faf
only mine if config.mine is true
aakilfernandes Sep 25, 2015
2526ba4
use account if expliciitly set in config
aakilfernandes Sep 25, 2015
03c7f25
config.address -> config.account.address
aakilfernandes Sep 25, 2015
e084b53
Merge branch 'master' of https://github.com/VoR0220/embark-framework
VoR0220 Oct 1, 2015
b3cec82
added ability to boot nodes via a list
VoR0220 Oct 1, 2015
161514d
Merge pull request #94 from SafeMarket/accountfix
iurimatias Oct 2, 2015
0c233d9
Merge pull request #89 from FinclusionSystems/develop
iurimatias Oct 2, 2015
e78554b
Merge pull request #93 from SafeMarket/minefix
iurimatias Oct 2, 2015
6fcc9c7
Merge pull request #95 from VoR0220/develop
iurimatias Oct 2, 2015
02a52f7
change enodes config to boot
iurimatias Oct 2, 2015
32ac41a
compile using js solc
iurimatias Oct 2, 2015
95823a8
make deployment async
iurimatias Oct 8, 2015
c550b68
add flag to include provider in abi; update spec
iurimatias Oct 9, 2015
b4d659a
move spec code to lib
iurimatias Oct 9, 2015
fb2fbca
remove hashmerge dependency
iurimatias Oct 9, 2015
0e867c2
remove jasmine dependency
iurimatias Oct 9, 2015
2be2a80
remove method missing dependency
iurimatias Oct 9, 2015
a7da9bc
remove sync-me dependency
iurimatias Oct 9, 2015
38445c9
fix deployment
iurimatias Oct 9, 2015
5628089
fix deployment in binary
iurimatias Oct 9, 2015
da9c705
add embark simulator cmd
iurimatias Oct 12, 2015
d33d986
update specs
iurimatias Oct 12, 2015
d45f76b
read embark config file to get contract files for testing
iurimatias Oct 12, 2015
82b9af2
get test config files from embark config
iurimatias Oct 12, 2015
a9fbce7
use embark 1.0.0
iurimatias Oct 12, 2015
ea3f3ee
update readme
iurimatias Oct 12, 2015
75da137
update to 1.0.0-beta.1
iurimatias Oct 12, 2015
f6f0545
Update README.md
iurimatias Oct 12, 2015
5cf4529
update to 1.0.0
iurimatias Oct 12, 2015
40add07
Merge branch 'develop' of github.com:iurimatias/embark-framework into…
iurimatias Oct 12, 2015
f42652f
Update README.md
iurimatias Oct 12, 2015
8b44f4f
update to 1.0.1
iurimatias Oct 12, 2015
c176c55
Merge branch 'develop' of github.com:iurimatias/embark-framework into…
iurimatias Oct 12, 2015
283b26f
exit embark deploy after contracts are deployed
iurimatias Oct 13, 2015
4cd0669
update to 1.0.2
iurimatias Oct 13, 2015
d07ddaf
Update README.md
iurimatias Oct 13, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 38 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
This Readme applies to Embark 1.0.0 Beta which is currently under development. For the old version please check the old [readme](https://github.com/iurimatias/embark-framework/blob/0.9.3/README.md)

What is embark
======

Expand All @@ -11,18 +13,18 @@ With Embark you can:
* 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.
* Manage different chains (e.g testnet, private net, livenet)
* 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.1.0) or serpent (develop), node (0.12.2) and npm

For specs: pyethereum, ethertdd.py
Requirements: geth (1.1.3 or higher), node (0.12.2) and npm
Optional: serpent (develop) if using contracts with Serpent

```Bash
$ npm install -g embark-framework grunt-cli
$ npm -g install embark-framework
```

See [Complete Installation Instructions](https://github.com/iurimatias/embark-framework/wiki/Installation).
Expand All @@ -35,11 +37,19 @@ You can easily create a sample working DApp with the following:
$ embark demo
$ cd embark_demo
```
To run the ethereum node for development purposes simply run:

To run a ethereum rpc simulator simply run:

```Bash
$ embark simulator
```

Or Alternatively, you can run a REAL ethereum node for development purposes:

```Bash
$ embark blockchain
```

By default embark blockchain will mine a minimum amount of ether and will only mine when new transactions come in. This is quite usefull to keep a low CPU. The option can be configured at config/blockchain.yml

Then, in another command line:
Expand Down Expand Up @@ -199,42 +209,41 @@ You can also define contract interfaces (Stubs) and actions to do on deployment
Tests
======

You can run specs with ```embark spec```, it will run any files ending *_spec.js under ```spec/```.
You can run specs with ```embark spec```, it will run any test files under ```test/```.

Embark includes a testing lib to fastly run & test your contracts in a EVM.

```Javascript
# spec/contracts/simple_storage_spec.js
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() {
// equivalent to initializing SimpleStorage with param 150
SimpleStorage = EmbarkSpec.request("SimpleStorage", [150]);
# test/simple_storage_spec.js
var assert = require('assert');
var Embark = require('embark-framework');
var EmbarkSpec = Embark.initTests();

describe("SimpleStorage", function(done) {
before(function(done) {
EmbarkSpec.deployAll(done);
});

it("should set constructor value", function() {
expect(SimpleStorage.storedData()).toEqual('150');
it("should set constructor value", function(done) {
SimpleStorage.storedData(function(err, result) {
assert.equal(result.toNumber(), 100);
done();
});
});

it("set storage value", function() {
SimpleStorage.set(100);
expect(SimpleStorage.get()).toEqual('100');
it("set storage value", function(done) {
SimpleStorage.set(150, function() {
SimpleStorage.get(function(err, result) {
assert.equal(result.toNumber(), 150);
done();
});
});
});

})
```

Embark uses [Jasmine](https://jasmine.github.io/2.3/introduction.html) by default, but you can use any testing framework you want.

Embark uses [Mocha](http://mochajs.org/) by default, but you can use any testing framework you want.

Working with different chains
======
Expand All @@ -258,6 +267,7 @@ The environment is a specific blockchain configuration that can be managed at co
chains: chains_staging.json
network_id: 0
console: true
geth_extra_opts: --vmdebug
account:
init: false
address: 0x123
Expand Down
26 changes: 17 additions & 9 deletions bin/embark
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var wrench = require('wrench');
var grunt = require('grunt');
require('shelljs/global');
var readYaml = require('read-yaml');
var EtherSim = require('ethersim');
var Embark = require('..');

var run = function(cmd) {
Expand All @@ -14,7 +15,7 @@ var run = function(cmd) {
}
}

var deploy = function(env, embarkConfig) {
var deploy = function(env, embarkConfig, cb) {
var contractFiles = grunt.file.expand(embarkConfig.contracts);
var destFile = embarkConfig.output;

Expand All @@ -24,12 +25,14 @@ var deploy = function(env, embarkConfig) {

var chainFile = Embark.blockchainConfig.blockchainConfig[env].chains || embarkConfig.chains || './chains.json';

abi = Embark.deployContracts(env, contractFiles, destFile, chainFile);
grunt.file.write(destFile, abi);
abi = Embark.deployContracts(env, contractFiles, destFile, chainFile, true, true, function(abi) {
grunt.file.write(destFile, abi);
cb();
});
}

program
.version('0.9.2')
.version('1.0.2');

program.command('new [name]').description('New application').action(function(name) {
if (name === undefined) {
Expand All @@ -53,7 +56,7 @@ program.command('deploy [env]').description('deploy contracts').action(function(
run("grunt deploy_contracts:" + env);
}
else {
deploy(env, embarkConfig);
deploy(env, embarkConfig, function() { exit(); });
}
});

Expand Down Expand Up @@ -105,15 +108,16 @@ program.command('run [env]').description('run dapp').action(function(env_) {
}
});

program.command('spec').description('run specs').action(function() {
program.command('spec').description('run tests').action(function() {
var embarkConfig = readYaml.sync("./embark.yml");

if (embarkConfig.type === "grunt") {
run('jasmine');
run('mocha test/ --no-timeouts');
}
else {
console.log("command not available in meteor or manual mode yet");
console.log("note: you can use embark tests with any framework");
console.log("try running mocha test/");
}
});

Expand Down Expand Up @@ -155,7 +159,7 @@ program.command('demo').description('create a working dapp with a SimpleStorage
wrench.copyDirSyncRecursive(boilerPath, targetDir);
wrench.copyDirSyncRecursive(demoPath + "/app", targetDir + "/app", {forceDelete: true});
wrench.copyDirSyncRecursive(demoPath + "/config", targetDir + "/config", {forceDelete: true});
wrench.copyDirSyncRecursive(demoPath + "/spec", targetDir + "/spec", {forceDelete: true});
wrench.copyDirSyncRecursive(demoPath + "/test", targetDir + "/test", {forceDelete: true});

cd(targetDir);
run('npm install');
Expand All @@ -170,10 +174,14 @@ program.command('meteor_demo').description('create a working meteor dapp with a
console.log('\n\ninit complete');
});

program.command('simulator').description('run a fast ethereum rpc simulator').action(function() {
EtherSim.startServer();
});

program.parse(process.argv)

if (!process.argv.slice(2).length) {
program.outputHelp();
}

exit();
//exit();
2 changes: 1 addition & 1 deletion boilerplate/Gruntfile.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = (grunt) ->

grunt.option 'stack', true
grunt.loadNpmTasks "grunt-embark"
grunt.loadTasks "tasks"

Expand Down Expand Up @@ -111,4 +112,3 @@ module.exports = (grunt) ->

grunt.registerTask "deploy", ["coffee", "deploy_contracts", "concat", "copy", "server", "watch"]
grunt.registerTask "build", ["clean", "deploy_contracts", "coffee", "concat", "uglify", "copy"]

7 changes: 7 additions & 0 deletions boilerplate/config/blockchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ development:
account:
init: true
password: config/password
num: 1
staging:
rpc_host: localhost
rpc_port: 8101
Expand All @@ -22,6 +23,9 @@ staging:
network_id: 0
max_peers: 4
console: true
bootnodes:
boot: false
enodes: [] #insert enode urls here.
account:
init: false
address:
Expand All @@ -33,6 +37,9 @@ production:
network_id: 1
max_peers: 4
console: true
bootnodes:
boot: false
enodes: []
account:
init: false
address:
5 changes: 3 additions & 2 deletions boilerplate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"license": "ISC",
"homepage": "",
"devDependencies": {
"embark-framework": "^0.9.2",
"grunt-embark": "^0.4.3",
"embark-framework": "^1.0.2",
"grunt-embark": "^0.5.1",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-coffee": "^0.13.0",
"grunt-contrib-concat": "^0.5.1",
Expand All @@ -21,6 +21,7 @@
"grunt": "^0.4.5",
"grunt-cli": "^0.1.13",
"matchdep": "^0.3.0",
"mocha": "^2.2.5",
"express": "^4.12.3",
"read-yaml": "^1.0.0",
"compression": "^1.4.3"
Expand Down
9 changes: 0 additions & 9 deletions boilerplate/spec/support/jasmine.json

This file was deleted.

25 changes: 0 additions & 25 deletions demo/spec/contracts/simple_storage_spec.js

This file was deleted.

9 changes: 0 additions & 9 deletions demo/spec/support/jasmine.json

This file was deleted.

26 changes: 26 additions & 0 deletions demo/test/simple_storage_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
var assert = require('assert');
var Embark = require('embark-framework');
var EmbarkSpec = Embark.initTests();

describe("SimpleStorage", function(done) {
before(function(done) {
EmbarkSpec.deployAll(done);
});

it("should set constructor value", function(done) {
SimpleStorage.storedData(function(err, result) {
assert.equal(result.toNumber(), 100);
done();
});
});

it("set storage value", function(done) {
SimpleStorage.set(150, function() {
SimpleStorage.get(function(err, result) {
assert.equal(result.toNumber(), 150);
done();
});
});
});

})
19 changes: 18 additions & 1 deletion lib/blockchain.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ Blockchain.prototype.generate_basic_command = function() {
cmd += "--logfile=\"" + config.datadir + ".log\" ";
}

if (config.geth_extra_opts) {
cmd += config.geth_extra_opts + " ";
}

cmd += "--port " + config.port + " ";
cmd += "--rpc ";
cmd += "--rpcport " + config.rpcPort + " ";
Expand All @@ -27,7 +31,9 @@ Blockchain.prototype.generate_basic_command = function() {
cmd += "--minerthreads \"" + config.minerthreads + "\" ";
}

cmd += "--mine ";
if(config.mine)
cmd += "--mine ";

if (config.genesisBlock !== void 0) {
cmd += "--genesis=\"" + config.genesisBlock + "\" ";
}
Expand Down Expand Up @@ -69,6 +75,13 @@ Blockchain.prototype.run_command = function(address, use_tmp) {
cmd += "--unlock " + address + " ";
}

if (config.bootNodes !== undefined && config.bootNodes.boot == true){
cmd += "--bootnodes ";
for (var i = 0; i < config.bootNodes.enodes.length; i++){
cmd += config.bootNodes.enodes[i] + " ";
}
}

if (config.console_toggle) {
cmd += "console";
}
Expand All @@ -87,6 +100,10 @@ Blockchain.prototype.run_command = function(address, use_tmp) {

Blockchain.prototype.get_address = function() {
var config = this.config;

if(config.account.address)
return config.account.address;

var address = null;

if (config.account.init) {
Expand Down
Loading