Skip to content

Commit e175cd6

Browse files
committed
Merge tag '2.4.0'
2.4.0
2 parents 1681ba9 + 71121cd commit e175cd6

File tree

145 files changed

+13389
-12837
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+13389
-12837
lines changed

.codeclimate.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@ engines:
88
enabled: false
99
global-require:
1010
enabled: false
11+
guard-for-in:
12+
enabled: false
1113
ratings:
1214
paths:
1315
- "lib/**/*"
1416
exclude_paths:
15-
- "tests/"
17+
- "test/"
1618
- "old_test/"
1719
- "boilerplate/"
1820
- "demo/"
1921
- "js/"
22+
- "test_app/"
23+
- "docs/"

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,10 @@ demo/dist/
55
demo/.embark/development/
66
demo/config/production/password
77
boilerplate/dist/
8+
docs/_build
9+
docs/utils/__pycache_
10+
test_app/dist/
11+
test_app/.embark/development/
12+
test_app/config/production/password
13+
test_app/node_modules/
14+
test_app/chains.json

README.md

Lines changed: 85 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
[![Join the chat at https://gitter.im/iurimatias/embark-framework](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/iurimatias/embark-framework?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
32
[![Build
43
Status](https://travis-ci.org/iurimatias/embark-framework.svg?branch=develop)](https://travis-ci.org/iurimatias/embark-framework)
@@ -7,16 +6,33 @@ Status](https://travis-ci.org/iurimatias/embark-framework.svg?branch=develop)](h
76
What is Embark
87
======
98

10-
Embark is a framework that allows you to easily develop and deploy DApps.
9+
Embark is a framework that allows you to easily develop and deploy Decentralized Applications (DApps).
10+
11+
A Decentralized Application is serverless html5 application that uses one or more decentralized technologies.
12+
13+
Embark currently integrates with EVM blockchains (Ethereum), Decentralized Storages (IPFS), and Decentralizaed communication platforms (Whisper and Orbit). Swarm is supported for deployment.
1114

1215
With Embark you can:
16+
17+
**Blockchain (Ethereum)**
1318
* 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.
14-
* Use any build pipeline or tool you wish, including grunt and meteor. (for 1.x, plugins coming soon for 2.x series)
19+
* Contracts are available in JS with Promises.
1520
* Do Test Driven Development with Contracts using Javascript.
16-
* Easily deploy to & use decentralized systems such as IPFS.
1721
* Keep track of deployed contracts, deploy only when truly needed.
1822
* Manage different chains (e.g testnet, private net, livenet)
19-
* Quickly create advanced DApps using multiple contracts that can interact with decentralized infrastructure for storage and comunication.
23+
* Easily manage complex systems of interdependent contracts.
24+
25+
**Decentralized Storage (IPFS)**
26+
* Easily Store & Retrieve Data on the DApp through EmbarkJS. Includin uploading and retrieving files.
27+
* Deploy the full application to IPFS or Swarm.
28+
29+
30+
**Decentralized Communication (Whisper, Orbit)**
31+
* Easily send/receive messages through channels in P2P through Whisper or Orbit.
32+
33+
**Web Technologies**
34+
* Integrate with any web technology including React, Foundation, etc..
35+
* Use any build pipeline or tool you wish, including grunt, gulp and webpack.
2036

2137
Table of Contents
2238
======
@@ -28,18 +44,18 @@ Table of Contents
2844
* [Using and Configuring Contracts](#dapp-structure)
2945
* [EmbarkJS](#embarkjs)
3046
* [EmbarkJS - Storage (IPFS)](#embarkjs---storage)
31-
* [EmbarkJS - Communication (Whisper)](#embarkjs---communication)
47+
* [EmbarkJS - Communication (Whisper/Orbit)](#embarkjs---communication)
3248
* [Testing Contracts](#tests)
3349
* [Working with different chains](#working-with-different-chains)
3450
* [Custom Application Structure](#structuring-application)
3551
* [Deploying to IPFS](#deploying-to-ipfs)
36-
* [LiveReload Plugin](#livereload-plugin)
52+
* [Extending Functionality with Plugins](#plugins)
3753
* [Donations](#donations)
3854

3955
Installation
4056
======
41-
Requirements: geth (1.4.4 or higher), node (5.0.0) and npm
42-
Optional: serpent (develop) if using contracts with Serpent, testrpc or ethersim if using the simulator or the test functionality.
57+
Requirements: geth (1.5.8 or higher), node (6.9.1 or higher is recommended) and npm
58+
Optional: testrpc (3.0 or higher) if using the simulator or the test functionality.
4359
Further: depending on the dapp stack you choose: [IPFS](https://ipfs.io/)
4460

4561
```Bash
@@ -58,6 +74,9 @@ Embark's npm package has changed from ```embark-framework``` to ```embark```, th
5874

5975
Usage - Demo
6076
======
77+
78+
![Embark Demo screenshot](http://i.imgur.com/a9ddSjn.png)
79+
6180
You can easily create a sample working DApp with the following:
6281

6382
```Bash
@@ -136,7 +155,7 @@ Solidity/Serpent files in the contracts directory will automatically be deployed
136155
Libraries and languages available
137156
======
138157

139-
Embark can build and deploy contracts coded in Solidity or Serpent. It will make them available on the client side using EmbarkJS and Web3.js.
158+
Embark can build and deploy contracts coded in Solidity. It will make them available on the client side using EmbarkJS and Web3.js.
140159

141160
Further documentation for these can be found below:
142161

@@ -149,6 +168,7 @@ Embark will automatically take care of deployment for you and set all needed JS
149168

150169
```Javascript
151170
# app/contracts/simple_storage.sol
171+
pragma solidity ^0.4.7;
152172
contract SimpleStorage {
153173
uint public storedData;
154174

@@ -169,8 +189,8 @@ Will automatically be available in Javascript as:
169189
```Javascript
170190
# app/js/index.js
171191
SimpleStorage.set(100);
172-
SimpleStorage.get();
173-
SimpleStorage.storedData();
192+
SimpleStorage.get().then(function(value) { console.log(value.toNumber()) });
193+
SimpleStorage.storedData().then(function(value) { console.log(value.toNumber()) });
174194
```
175195

176196
You can specify for each contract and environment its gas costs and arguments:
@@ -291,6 +311,12 @@ methods in EmbarkJS contracts will be converted to promises.
291311
myContract.get().then(function(value) { console.log("value is " + value.toNumber) });
292312
```
293313

314+
events:
315+
316+
```Javascript
317+
myContract.eventName({from: web3.eth.accounts}, 'latest').then(function(event) { console.log(event) });
318+
```
319+
294320
**deployment**
295321

296322
Client side deployment will be automatically available in Embark for existing contracts:
@@ -346,33 +372,51 @@ The current available storage is IPFS. it can be initialized as
346372
EmbarkJS.Storage.getUrl(hash);
347373
```
348374

375+
note: if not using localhost, the cors needs to be set as ```ipfs --json API.HTTPHeaders.Access-Control-Allow-Origin '["your-host-name-port"]```
376+
349377
EmbarkJS - Communication
350378
======
351379

352380
**initialization**
353381

354-
The current available communication is Whisper.
382+
For Whisper:
383+
384+
```Javascript
385+
EmbarkJS.Messages.setProvider('whisper')
386+
```
387+
388+
For Orbit:
389+
390+
You'll need to use IPFS from master and run it as: ```ipfs daemon --enable-pubsub-experiment```
391+
392+
then set the provider:
393+
394+
```Javascript
395+
EmbarkJS.Messages.setProvider('orbit', {server: 'localhost', port: 5001})
396+
```
355397

356398
**listening to messages**
357399

358400
```Javascript
359-
EmbarkJS.Messages.listenTo({topic: ["achannel", "anotherchannel"]}).then(function(message) { console.log("received: " + message); })
401+
EmbarkJS.Messages.listenTo({topic: ["topic1", "topic2"]}).then(function(message) { console.log("received: " + message); })
360402
```
361403

362404
**sending messages**
363405

364406
you can send plain text
365407

366408
```Javascript
367-
EmbarkJS.Messages.sendMessage({topic: "achannel", data: 'hello world'})
409+
EmbarkJS.Messages.sendMessage({topic: "sometopic", data: 'hello world'})
368410
```
369411

370412
or an object
371413

372414
```Javascript
373-
EmbarkJS.Messages.sendMessage({topic: "achannel", data: {msg: 'hello world'}})
415+
EmbarkJS.Messages.sendMessage({topic: "sometopic", data: {msg: 'hello world'}})
374416
```
375417

418+
note: array of topics are considered an AND. In Whisper you can use another array for OR combinations of several topics e.g ```["topic1", ["topic2", "topic3"]]``` => ```topic1 AND (topic2 OR topic 3)```
419+
376420
Tests
377421
======
378422

@@ -424,9 +468,9 @@ Working with different chains
424468
You can specify which environment to deploy to:
425469

426470

427-
```$ embark blockchain production```
471+
```$ embark blockchain livenet```
428472

429-
```$ embark run production```
473+
```$ embark run livenet```
430474

431475
The environment is a specific blockchain configuration that can be managed at config/blockchain.json
432476

@@ -439,7 +483,7 @@ The environment is a specific blockchain configuration that can be managed at co
439483
"rpcPort": 8545,
440484
"rpcCorsDomain": "http://localhost:8000",
441485
"account": {
442-
"password": "config/production/password"
486+
"password": "config/livenet/password"
443487
}
444488
},
445489
...
@@ -448,32 +492,47 @@ The environment is a specific blockchain configuration that can be managed at co
448492
Structuring Application
449493
======
450494

451-
Embark is quite flexible and you can configure you're own directory structure using ```embark.json```
495+
Embark is quite flexible and you can configure your own directory structure using ```embark.json```
452496

453497
```Json
454498
# embark.json
455499
{
456500
"contracts": ["app/contracts/**"],
457501
"app": {
458502
"css/app.css": ["app/css/**"],
503+
"images/": ["app/images/**"],
459504
"js/app.js": ["embark.js", "app/js/**"],
460505
"index.html": "app/index.html"
461506
},
462507
"buildDir": "dist/",
463-
"config": "config/"
508+
"config": "config/",
509+
"plugins": {}
464510
}
465511
```
466512

467-
Deploying to IPFS
513+
Deploying to IPFS and Swarm
468514
======
469515

470-
To deploy a dapp to IPFS, all you need to do is run a local IPFS node and then run ```embark ipfs```.
471-
If you want to deploy to the livenet then after configuring you account on ```config/blockchain.json``` on the ```production``` environment then you can deploy to that chain by specifying the environment ```embark ipfs production```.
516+
To deploy a dapp to IPFS, all you need to do is run a local IPFS node and then run ```embark upload ipfs```.
517+
If you want to deploy to the livenet then after configuring you account on ```config/blockchain.json``` on the ```livenet``` environment then you can deploy to that chain by specifying the environment ```embark ipfs livenet```.
472518

473-
LiveReload Plugin
519+
To deploy a dapp to SWARM, all you need to do is run a local SWARM node and then run ```embark upload swarm```.
520+
521+
Plugins
474522
======
475523

476-
Embark works quite well with the LiveReload Plugin
524+
It's possible to extend Embarks functionality with plugins. For example the following is possible:
525+
526+
* plugin to add support for es6, jsx, coffescript, etc (``embark.registerPipeline``)
527+
* plugin to add standard contracts or a contract framework (``embark.registerContractConfiguration`` and ``embark.addContractFile``)
528+
* plugin to make some contracts available in all environments for use by other contracts or the dapp itself e.g a Token, a DAO, ENS, etc.. (``embark.registerContractConfiguration`` and ``embark.addContractFile``)
529+
* plugin to add a libraries such as react or boostrap (``embark.addFileToPipeline``)
530+
* plugin to specify a particular web3 initialization for special provider uses (``embark.registerClientWeb3Provider``)
531+
* plugin to create a different contract wrapper (``embark.registerContractsGeneration``)
532+
* plugin to add new console commands (``embark.registerConsoleCommand``)
533+
* plugin to add support for another contract language such as viper, LLL, etc (``embark.registerCompiler``)
534+
535+
For more information on how to develop your own plugin please see the [plugin documentation](http://embark.readthedocs.io/en/latest/plugins.html)
477536

478537
Donations
479538
======

boilerplate/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
node_modules/
33
dist/
44
config/production/password
5+
config/livenet/password

boilerplate/config/blockchain.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
{
22
"development": {
3+
"enabled": true,
34
"networkType": "custom",
45
"genesisBlock": "config/development/genesis.json",
56
"datadir": ".embark/development/datadir",
67
"mineWhenNeeded": true,
78
"nodiscover": true,
9+
"maxpeers": 0,
810
"rpcHost": "localhost",
911
"rpcPort": 8545,
1012
"rpcCorsDomain": "http://localhost:8000",
@@ -13,25 +15,34 @@
1315
}
1416
},
1517
"testnet": {
18+
"enabled": true,
1619
"networkType": "testnet",
20+
"light": true,
1721
"rpcHost": "localhost",
18-
"rpcPort": 8545
22+
"rpcPort": 8545,
23+
"rpcCorsDomain": "http://localhost:8000",
24+
"account": {
25+
"password": "config/testnet/password"
26+
}
1927
},
2028
"livenet": {
29+
"enabled": true,
2130
"networkType": "livenet",
31+
"light": true,
2232
"rpcHost": "localhost",
2333
"rpcPort": 8545,
2434
"rpcCorsDomain": "http://localhost:8000",
2535
"account": {
26-
"password": "config/production/password"
36+
"password": "config/livenet/password"
2737
}
2838
},
2939
"privatenet": {
40+
"enabled": true,
3041
"networkType": "custom",
3142
"rpcHost": "localhost",
3243
"rpcPort": 8545,
3344
"datadir": "yourdatadir",
3445
"networkId": "123",
35-
"nodes": []
46+
"bootnodes": ""
3647
}
3748
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"default": {
3+
"enabled": true,
4+
"provider": "whisper",
5+
"available_providers": ["whisper", "orbit"]
6+
}
7+
}

boilerplate/config/production/password

Lines changed: 0 additions & 1 deletion
This file was deleted.

boilerplate/config/storage.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"default": {
3+
"enabled": true,
4+
"ipfs_bin": "ipfs",
5+
"provider": "ipfs",
6+
"available_providers": ["ipfs"],
7+
"host": "localhost",
8+
"port": 5001
9+
},
10+
"development": {
11+
"enabled": true,
12+
"provider": "ipfs",
13+
"host": "localhost",
14+
"port": 5001
15+
}
16+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test_password

boilerplate/config/webserver.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"enabled": true,
3+
"host": "localhost",
4+
"port": 8000
5+
}

0 commit comments

Comments
 (0)