Embark 2.4.0 - Continuing the voyage towards real Decentralised Applications
To Update to 2.4.0
important
Embark's npm package has changed from embark-framework to embark, this sometimes can create conflicts. To update, first uninstall embark-framework 1 to avoid any conflicts with npm uninstall -g embark-framework followed by npm install -g embark
to update from 2.3.3:
npm install -g [email protected]
afterwards make sure embark version returns 2.4.0.
In this release
A lot of work went under the hood in this release. Embark now starts 7 times faster, and the number of dependencies have been cut in half. It installs faster, starts faster, it's more stable and more modular than ever before.
Config for each of the decentralised technologies available in Embark
Although Embark was always a full DApp Framework and not just a simple Ethereum framework, there was few options when in came to fully configuring the other components of the Decentralised stack. This releases adds support to choose which components you need for your DAPP exactly and configure them depending on your needs. It's now possible to even disable the Blockchain part completely for cases where all you need is Whisper and IPFS for instance.
2.4.0 introduces two new important config files: config/storage.json, config/communication.json
communication.json
{
"default": {
"enabled": true,
"provider": "whisper",
"available_providers": ["whisper", "orbit"]
}
}
Choosing a provider will automatically add the correct EmbarkJS.Messages.setProvider into the generated DApp code. The list of available_providers will determine what's available in the DApp, if you don't need Orbit for your DApp for example, then removing it from the list will greatly reduce the final size of the generated JS size since its library wouldn't' be included.
As usual, "default" applies to all environments but you can override settings on a per environment basis.
storage.json
{
"default": {
"enabled": true,
"ipfs_bin": "ipfs",
"provider": "ipfs",
"available_providers": ["ipfs"],
"host": "localhost",
"port": 5001
}
}
Choosing a provider will automatically add the correct EmbarkJS.Storage.setProvider into the generated DApp code. You can also configure the host and port for IPFS. Note that Swarm will be added to the available_providers in future releases of Embark.
Disabling the blockchain component
You can now disable the blockchain/contracts component if you so wish by adding the field "enabled": false inside an environment config in the config/blockchain.json file.
Plugin API changes
Breaking change The compiler API now takes a callback instead of a return, e.g:
embark.registerCompiler(".sol", function(contractFiles, cb) {
cb(null, compiled_object);
}
new
Embark's event bus is now available in the plugin API, this is useful to do plugins that react to changes such as when contracts are deployed:
- available events:
contractsDeployed- triggered when contracts have been deployedfile-add,file-change,file-remove,file-event- triggered on
a file change, args is (filetype, path)abi,abi-vanila,abi-contracts-vanila- triggered when contracts
have been deployed and returns the generated JS codeoutputDone- triggered when dapp is (re)generatedfirstDeploymentDone- triggered when the dapp is deployed and generated
for the first time
module.exports = function(embark) {
embark.events.on("contractsDeployed", function() {
embark.logger.info("plugin says: your contracts have been deployed");
});
embark.events.on("file-changed", function(filetype, path) {
if (type === 'contract') {
embark.logger.info("plugin says: you just changed the contract at " + path);
}
});
});New Blockchain options
The following fields are now available at config/blockchain.json to enhance embark blockchain:
- "light": true - to enable the light client
- "fast": true - to enable the --fast option in geth
- "bootnodes": "" - to bootstrap your private network
- "geth_bin": "" - to specify which geth binary to use
- "rpcApi" - to override the available rpcApis
- "vmdebug" - to enable --vmdebug
With the availability of the light client option and further default configs on the initial blockchain.json file it even easier to deploy to the testnet and livenet
Misc Bugfixes and Improvements
- Support configuring the dev webserver in
config/webserver.json - Fix contract tracking by taking into account the Swarm hash inserted in the bytecode by solc
- The embark demo sample app has been updated with a better look and better tolerance for when some stack elements are not available such as Whisper or IPFS.
- Updated readme & docs to clarify how events are used, IPFS cors requirements, and plugin API changes
- Add compatibility with latest geth to embarkjs
- Wait for transaction to be mined in embarkjs method calls before returning value
- Support specifying gas cost when deploying a contract client side with embarkjs
- Fix crash when attempting to connect to whisper and it's not available in embarkjs
- Show solc errors in the log instead of exiting the console
- If no commands are passed in the command line, default to show the help
- Display IPFS version on the dashboard
- Fix IPFS & Swarm deployment so it works in all environments not just development
- Support receiving a custom embark.json file in the tests
- Create a datadir per environment so different private chains are supported
- Support for -p (port) -h (host) and -a (number of accounts) when running embark simulator
- Creating a new dapp with
embark new MyAppwill now automatically insert the app name into the package.json name field
Documentation
The new documentation for embark is being worked on and available at https://embark.readthedocs.io/en/latest/. If you wish to help out don't hesitate to do a PR or contact me at our gitter channel.
Thank you
A big thanks to all that contributed to this release including Andy Nogueira, Daniel Benton, Luke Childs and Akhil Srinivasan
Chatroom
To discuss about Embark or Dapp development, please join us at the gitter channel
Donations
If you like Embark please consider donating to 0xFA239D14c7117C3D2370B2a4c4238534391fadd9




