What is Embark? dapp development using Ethereum

BlockChain Expert 07/November/2017
Embark is a framework used for developing and deploying DApps (Decentralized Apps) using one or more decentralized technologies. The tools and functionalities provided by the Embark make the DApp development process easy and productive. It reduces the interaction between the front end of application and smart contract so that the application can run faster on the network.  The technology uses IPFS protocol to store and manage files across the decentralized network. ‘Whisper’ and ‘Orbit’ communication platforms streamline the communication process in Embark. The platform performs automatic deployment of smart contract and ensures the redeployment if the contract has undergone any changes.

Embark currently integrates with Ethereum, decentralized storages like IPFS, and decentralized communication platforms like Whisper and Orbit. Using embark, it is possible to manage different chains like testnet, private net, livenet etc. And the smart contracts in solidity and serpent can be built and it is deployable with embark.  The dashboard of Embark will provide the tracking information like the current state of the contracts, the environment it is using and what Embark is doing currently etc. 

How to Install embark?
 - geth (1.5.8 or higher)
 - node (6.9.1 or higher)

Open terminal and run the below-given codes

npm -g install embark

To run it on a simulator instead of a real Ethereum node, run the below-given code
npm -g install ethereumjs-testrpc

Creating a DApp with Embark

Generally, a typical DApp in embark consists of 2 sections. 

1. Smart contracts
This section will contain the business logic of the DApp. It is written in either solidity or serpent

2. User Interface
The user interface through which the user interacts with the app

To create a DApp in embark simply run this code

	embark new <DApp name>

This code will initialize a predefined template and creates a directory structure

Directory Structure
The default directory structure created by the above code.

| |___ contracts/ //All smart contract files are placedhere
| |___ css/ //css files of the web page is placedhere
| |___ js/  //js files of the web page is placed here
| |___ index.html //this is the html file of the web interface 
|    |___ development/
|    |___ testnet/
|    |___ blockchain.json //rpc and blockchain configuration files
|    |___ contracts.json  //ethereum contracts configuration files
|    |___ storage.json  //ipfs configuration files
|    |___ communication.json //whisper/orbit configuration files
|    |___ webserver.json  //dev webserver configuration files
|    |___ contact_spec.js //contracts tests

How to to run an embark DApp?
There are two options available to run a DApp.

1. Using a real Ethereum node.

The code will run the app in an Ethereum network.

		embark blockchain

[keep in mind that at least 2GB of free RAM is required for smooth execution of above operation]

2.  Using an Ethereum rpc simulator

This method is useful in the development phase.The code will run the app in a test net.
embark simulator
After executing either of the above steps, now open a new terminal and run,

embark run

The code will deploy the smart contract files in app/contracts directory and it also turns the terminal into the embark dashboard. See the figure.


The dashboard makes it easy to track and manage the contracts. All the contracts in the App will appear in the contract section along with the address and current status. If any changes are made in any file, the embark will automatically redeploy the contracts and update the JS bindings. Thus it is reflected in our DApp almost instantly. The user can also interact with the DApp from the console. The web interface of the same is available at http://localhost:8000. And all above functionalities can be performed from the web interface also.