
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
embark-framework-nosim
Advanced tools
THis is a version of Embark framework without simulator to reduce dependencies when the testing is performed on private chain. This Readme applies to Embark 1.0.0 Beta which is currently under development. For the old version please check the old [readme
THis is a version of Embark framework without simulator to reduce dependencies when the testing is performed on private chain. This Readme applies to Embark 1.0.0 Beta which is currently under development. For the old version please check the old readme
Embark is a framework that allows you to easily develop and deploy DApps.
With Embark you can:
See the Wiki for more details.
Requirements: geth (1.1.3 or higher), node (0.12.2) and npm Optional: serpent (develop) if using contracts with Serpent
$ npm -g install embark-framework-nosim
See Complete Installation Instructions.
You can easily create a sample working DApp with the following:
$ embark demo
$ cd embark_demo
You can run a REAL ethereum node for development purposes:
$ 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.
note: for a demo using meteor do embark meteor_demo followed by embark deploy then meteor
$ embark new AppName
$ cd AppName
app/
|___ contracts/ #solidity or serpent contracts
|___ html/
|___ css/
|___ js/
config/
|___ blockchain.yml #environments configuration
|___ contracts.yml #contracts configuration
|___ server.yml #server configuration
spec/
|___ contracts/ #contracts tests
Solidity/Serpent 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
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 public storedData;
function SimpleStorage(uint initialValue) {
storedData = initialValue;
}
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();
SimpleStorage.storedData();
You can specify for each contract and environment its gas costs and arguments:
# config/contracts.yml
development:
SimpleStorage:
gas_limit: 500000
gas_price: 10000000000000
args:
- 100
...
If you are using multiple contracts, you can pass a reference to another contract as $ContractName, Embark will automatically replace this with the correct address for the contract.
# config/contracts.yml
development:
SimpleStorage:
args:
- 100
- $MyStorage
MyStorage:
args:
- "initial string"
MyMainContract:
args:
- $SimpleStorage
...
You can now deploy many instances of the same contract. e.g
# config/contracts.yml
development:
Currency:
deploy: false
args:
- 100
Usd:
instanceOf: Currency
args:
- "initial string"
MyCoin:
instanceOf: Currency
args:
- $SimpleStorage
...
Contracts addresses can be defined, If an address is defined the contract wouldn't be deployed but its defined address will be used instead.
development:
UserStorage:
address: 0x123456
UserManagement:
args:
- $UserStorage
...
You can also define contract interfaces (Stubs) and actions to do on deployment
development:
DataSource:
args:
MyDataSource:
args:
instanceOf: DataSource
Manager:
stubs:
- DataSource
args:
- $MyDataSource
onDeploy:
- Manager.updateStorage($MyDataSource)
- MyDataSource.set(5)
...
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.
# 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(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();
});
});
});
})
Embark uses Mocha by default, but you can use any testing framework you want.
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
chains: chains_staging.json
network_id: 0
console: true
geth_extra_opts: --vmdebug
account:
init: false
address: 0x123
See Configuration.
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
Embark is quite flexible and you can configure you're own directory structure using embark.yml
# embark.yml
type: "manual" #other options: meteor, grunt
contracts: ["app/contracts/**/*.sol", "app/contracts/**/*.se"] # contracts files
output: "src/embark.js" # resulting javascript interface
blockchainConfig: "config/blockchain.yml" # blockchain config
contractsConfig: "config/contracts.yml" # contracts config
To deploy a dapp to IPFS, all you need to do is run a local IPFS node and then run embark ipfs.
If you want to deploy to the live net then after configuring you account on config/blockchain.yml on the production environment then you can deploy to that chain by specifying the environment embark ipfs production.
Embark works quite well with the LiveReload Plugin
Because embark is internally using grunt tasks, debugging is not straightforward. Example
embark deploynode-debug -p 7000 embark -- deploydeploy command in ./bin/embark you will notice that it internally runs grunt task grunt deploy_contracts:[env]node-debug -p 7000 grunt -- deploy_contracts:developmenthere is list of all debuggable grunt tasks
If you get EACCES (access denied) errors, don't use sudo, try this:
$ mkdir ~/npm-global
$ npm config set prefix ~/npm-global
$ echo 'export PATH="$PATH:$HOME/npm-global/bin"' >>~/.bashrc
$ source ~/.bashrc
$ npm install -g embark-framework grunt-cli
FAQs
THis is a version of Embark framework without simulator to reduce dependencies when the testing is performed on private chain. This Readme applies to Embark 1.0.0 Beta which is currently under development. For the old version please check the old [readme
We found that embark-framework-nosim demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.