Framework for serverless Decentralized Applications using Ethereum, IPFS and other platforms https://framework.embarklabs.io/
Go to file
Iuri Matias 79db42544a update demo 2015-06-19 10:27:19 -04:00
bin update demo 2015-06-19 10:27:19 -04:00
boilerplate update dependencies 2015-06-15 06:07:40 -04:00
demo update demo 2015-06-19 10:27:19 -04:00
js fixed mining condition 2015-06-05 05:52:07 +02:00
lib remove log 2015-06-15 06:12:53 -04:00
tasks update demo 2015-06-15 06:26:38 -04:00
.gitignore add TODO to gitignore 2015-05-24 08:40:08 -04:00
.npmignore add npmignore file 2015-05-24 14:00:18 -04:00
Gruntfile.coffee add gruntfile, initialize module 2015-05-24 08:44:16 -04:00
README.md Merge pull request #2 from gitter-badger/gitter-badge 2015-06-04 07:23:47 -04:00
index.js update demo 2015-06-15 06:26:38 -04:00
package.json update dependencies 2015-06-15 06:07:40 -04:00

README.md

What is embark

Join the chat at https://gitter.im/iurimatias/embark-framework Embark is a framework that allows you to easily develop and deploy DApps. Embark automatically deploys your contracts and makes 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.

Installation

Requirements: geth (0.9.25), solc (0.9.23), node (0.12.2) and npm

$ npm install -g embark-framework grunt-cli

Usage - Demo

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:

$ 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:

$ embark run

This will automatically deploy the contracts, update their JS bindings and deploy your DApp to a local server at http://localhost:8000

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.

Creating a new DApp

$ embark new AppName
$ cd AppName

DApp Structure

  app/
  |___ contracts/ #solidity contracts
  |___ html/
  |___ css/
  |___ js/
  config/
    |___ blockchain.yml #environments configuration
    |___ server.yml     #server configuration

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

Using Contracts

Embark will automatically take care of deployment for you and set all needed JS bindings. For example, the contract below:

# app/contracts/simple_storage.sol
contract SimpleStorage {
  uint storedData;
  function set(uint x) {
    storedData = x;
  }
  function get() constant returns (uint retVal) {
    return storedData;
  }
}

Will automatically be available in Javascript as:

# app/js/index.js
SimpleStorage.set(100);
SimpleStorage.get();

Working with different chains

You can specify which environment to deploy to

$ embark blockchain staging $ embark run staging the environment is a specific blockchain configuration that can be managed at config/blockchain.yml

# config/blockchain.yml
  ...
  staging:
    rpc_host: localhost
    rpc_port: 8101
    rpc_whitelist: "*"
    datadir: default
    network_id: 0
    console: true
    account:
      init: false
      address: 0x123

Deploying only contracts

Although embark run will automatically deploy contracts, you can choose to only deploy the contracts to a specific environment

$ embark deploy privatenet

embark deploy will deploy all contracts at app/contracts and return the resulting addresses

LiveReload Plugin

Embark works quite well with the LiveReload Plugin