Embark 3.0
Embark by Status 3.0
Embark is now part of Status and we are happy to announce Embark 3.0 by Status!
New website and Documentation
Embark has a new website and up to date documentation which can be found at https://embark.status.im/docs/
More Smart Contract Languages
Besides Solidity, Embark now also supports Vyper out of the box, as well as Bamboo through an embark plugin
You can use these languages side by side, and take advantage of Embark's features such as contract testing just like you would with Solidity.
DApp Imports
From the dapp side, contracts and libs like EmbarkJS can be implicitly imported, for e.g to import a contract:
import SimpleStorage from 'Embark/contracts/SimpleStorage'EmbarkJS:
import EmbarkJS from 'Embark/EmbarkJS'Or a initialized web3 instances (with the config of config/contracts.json)
import web3 from 'Embark/web3'The typical ES6 imports will also simply work. You can even import directly css files inside js files:
import React from 'react';
import { Tabs, Tab } from 'react-bootstrap';
import './dapp.css';Friendlier torwards contracts-only projects
Although Embark is focused on DApps, it can perfectly be used for projects targeting only smart contracts and no other components.
There is a now a template to create a simple project with all the components disabled except smart contracts:
embark new AppName --simple
You can also fine tune this in embark.json by specifying the config of each component or setting it to false if you don't want it.
...
"config": {
"contracts": "contracts.json",
"blockchain": false,
"storage": false,
"communication": false,
"webserver": false
},
...Embark Graph
The command embark graph will generate a ER graph of the dapp contracts. This takes into account not just the inheritance but also the relationships specified in the configuration.
Config contracts from URIs
Embark now supports referencing directly URIs including http, git, github, or directly files contained in other directories than the ones specified in embark.json
Embark is smart enough to take care of the dependencies of the resources and present them in a consistent manner to the compiler, it just works!
{
"development": {
"contracts": {
"ERC725": {
"file": "git://github.com/status/contracts/contracts/identity/ERC725.sol#develop"
},
"ERC725": {
"file": "github.com/status/contracts/contracts/identity/ERC725.sol"
},
"Ownable": {
"file": "https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/ownership/Ownable.sol"
},
"SimpleStorage": {
"file": "./some_folder/simple_storage.sol"
}
}
}
}Importing contracts from URIs directly in Solidity
You can also import the same URIs directly in solidity which is quite useful for interfaces, e.g:
import "git://github.com/status/contracts/contracts/identity/ERC725.sol#develop";
import "github.com/status/contracts/contracts/identity/ERC725.sol";
import "https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/ownership/Ownable.sol"
contract MyContract is Ownable {
...
}Contracts from npm packages
You can now install npm packages that contain contracts (e.g npm install --save openzeppelin-solidity) and refer them to them in the contracts.json file:
{
"development": {
"contracts": {
"ERC20": {
file: "zeppelin-solidity/contracts/token/ERC20/ERC20.sol"
}
}
}
}or even import them directly in solidity without the need for the config:
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
contract MyContract is Ownable {
...
}Embark Demo App
The demo app has been updated to reflect the new structure. It also now uses ReactJS which provides a good example on how to use React with Embark.
Web3.js 1.0 by default
Embark now uses web3.js 1.0 in all layers, including in the console and in contracts testing.
More contract deploy configs
A new config called afterDeploy is available and it can be used to specify actions to run after all contracts have been deployed.
It's possible to also specify the specific account to deploy from using the directive from or fromIndex
Versions Configuration
The versions config has been moved to embark.json, the download mechanism has also been fastly improved under the hood:
...
"versions": {
"web3": "1.0.0-beta",
"solc": "0.4.23",
"ipfs-api": "17.2.4"
},
...
Test Improvements
In the tests you can now specify a mnemonic:
config({
mnemonic: "labor ability deny divide mountain buddy home client type shallow outer pen"
})It's also possible to specify a node, in case you don't want to run in the internal vm:
config({
node: "http://localhost:8545"
})Swarm support
Swarm is now completely integrated on-par with IPFS. You can use interact with Swarm on the dapp side, as well as upload your dapp to Swarm.Swarm
New Plugin APIs
plugin apis:
- new events: log, contractsState, status, servicesState
- new commands: console:command
- registerUploadCommand
- addCodeToEmbarkJS
- addProviderInit
- registerImportFile
- documentation has been reviewed and updated. available at docs
- registerBeforeDeploy
- improve plugin API to register console cmds
- possible to extend EmbarkJS by using EmbarkJS.Messages.registerProvider
- possible to extend EmbarkJS by using EmbarkJS.Storage.registerProvider
Misc Bugfixes and Improvements
- new command
embark resetwhich resets embark's state including clearing the cache - new options in blockchain.json: targetGasLimit, wsRpc, wsHost, wsPort, simulatorMnemonic, simulatorBlocktime
- new cmd line option for embark run and
embark build --logLevel - new cmd line option for embark run and
embark build --logfile filename - embark blockchain will now use geth's --dev option in the development environment by default instead of the old mining script. this can be configured with isDev option on blockchain.json
- detect and warn about cyclic dependencies
- embark will warn about typos in console commands and crucially also in things like contract names in the configuration etc..
- embark will detect the terminal dimensions and if it's too small it will recommend you to use the
--nodashboardoption - the webserver can be started and stopped with
webserver startandwebserver stop - fix to pipeline watcher, in which sometimes changes would not be detected
- fix bug which would cause contracts to always redeploy if a gas value was manually set
- fix & improve
onDeployconfig - fix bug deploying contract interfaces
- fixed console bug which was getting "invalid JSON RPC response" when connecting to certain clients
- fixed bug in which the ipfs service checkin was looking at localhost instead of the configuration specified in storage.json
- greatly improve web3 object provider initialization
- warn user when the IPFS node goes offline or comes back online
- add other alias for quit cmd
- fix issue with onDeploy on the tests
- add config for websockets
- support starting simulator & initializing accounts with mnemonics
- more params supported in simulator (port, host, accounts num, default baalance, gas limit)
- support specifying desired blocktime for simulator
- don't re-run onDeploy if nothing changed
- add default values for geth light and fast params (fixing 331)
- fix contract directory bug so any directory in embark.json can be used not just app/contracts
- new cmd to display version
- automaticaly configure gas needed for txs in tests so dev doesn't need to specify
- improve gas estimation by using web3.js 1.0 instead of relying on values given by solc
- better error message when geth is not installed or is unable to connect to a node
- better error messages for json config syntax errors
- detect nodejs version and warn user if version is too old instead of just exiting with a syntax error
- don't crash if embark.json is missing, instead warn user he is probably not in the dapp directory
- use defaults when blockchain.json is empty, useful for projects migrating
- run AfterDeploy cmds separately so it's easy to pinpoint when there is an error
- still run using defaults if config files like contracts.json, storage.json, webserver.json , etc.. are not present
- throw an error if trying to use embarkjs without a provider set
- display error message on the dashboard contract section when a contract fails to deploy or compile
- display proper error message when a library meant to be linked is not found
- warn user when contact is assumed to be an interface
- show error explaining what happened if dapp upload to IPFS fails
- show warning message when user specified non-existent asset on embark.json
Chatroom
To discuss about Embark or Dapp development, please join us at the gitter channel