Blockchain – Embark Framework
September 13, 2018
Author: Michael Gord
This tutorial will walk through how to use Embark, which is a framework to help developers easily build and deploy serverless decentralized applications. A Decentralized Application (Dapp) is a serverless application that uses decentralized technologies, such as blockchain and smart contract technology, and has no single point of failure. Embark is currently integrated with the Ethereum EVM blockchain, IPFS decentralized storage and decentralized communication platforms called Whisper and Orbit.
You can use any traditional web development language with Embark including Angular, React, Meteor, etc. You are also able to use any build pipeline you want, including grunt or gulp.
To begin you need to install the Embark package manager with NPM.
$ npm -g install embark
If you would like to deploy your smart contract to the Ethereum test network rather than a real ethereum node use this command.
$ npm -g install ethereumjs-testrpc
You can create a sample working DApp with one command with many dependencies downloaded automatically such as web3, cryptojs, bignumber, lodash, grunt, mocha, yargs, etc. When you create a new embark app it should complete by returning “init complete” and by confirming that the embark app is ready.
$ embark new demo
You can now change directory into the embark_demo and connect your demo to an ethereum node with this command. After you run the command embark should automatically run geth, initialize a genesis block, return the address of the genesis block, give you an IPC and https endpoints, and start to download the DAG. Downloading the DAG will take a couple minutes.
$ embark blockchain
Once the DAG is fully generated the blockchain will begin to mine and a message will be returned to confirm that your account has been funded.
Next we can run our app locally by running this command in a new terminal window from the embark demo dapp file directory. This will run our embark dapp in the same way as a traditional application running on localhost and we should be able to view our dapp locally. When we do, a window shows up to show the contracts that are deployed and a log of events.
$ embark run
In the next Embark tutorial we will walk through how to handle smart contracts using Solidity and Embark. To get a feel for how smart contracts work check out our Introduction to Solidity Smart Contracts tutorial and our How to Setup a Wallet Smart Contract using Solidity tutorial.
MLG Blockchain is a blockchain development and consulting firm based in Toronto that is focused on building next generation applications using blockchain and smart contract technology. View all our blockchain development tutorials at www.mlgblockchain.com/learn.html.