Releases: embarklabs/embark
Embark 2.3.0 - Plugins, Plugins, Plugins and more!
To Update to 2.2.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.2.4:
npm install -g [email protected]
afterwards make sure embark version
returns 2.3.0
. You may want to add "plugins": {}
to embark.json
In this release
Plugin support for extending functionality
Embarks functionality can now be extended through the use of plugins. You can develop your own or use existing plugins to add new functionality. Examples of possible functionality plugins can provide include:
- support for ES6, JSX, Coffeescript, Sass, etc..
- support for new compilers including Viper and LLL.
- support for contract frameworks or standard contracts (for e.g a plugin for Dappsys)
- support for different web3 libraries or providers (e.g Infura)
- plugins that implement new decentralized services, new console commands, contract wrappers, etc..
among many other possible functionality. For more information on how to develop your own plugins please see the plugin documentation. If you want to develop your own plugin and need help don't hesitate to join us at embarks gitter channel
To use a plugin
For example, to use a plugin that adds ES6 and JSX support:
- Add the npm package to package.json e.g npm install embark-babel --save
- Then add the package to plugins: in embark.json e.g "plugins": { "embark-babel": {} }
Then restart embark, and now you can use ES6 javascript code and JSX templates for your react application.
Update to Embark Demo
The embark demo
command was at the time Embark was first released a milestone in the DApp development world, at a time in which there doubts if Ethereum was even possible, here it was a super simple and quick way to get a dapp up and running using a real blockchain.
It was long overdue for a re-paint and Embark new functionality was also missing from it. So It has now been updated to include Embarks support for Decentralized Storage and Decentralized Communication layers. In the sample you can save and load data from IPFS, upload and retrives files, as well as send messages in a P2P manner through Whisper.
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.
Test Environment
The test enviroment has been updated, some previous issues have been fixed, and it also supports the new plugin functionality. If you use the test functionality it's recommended that you update to node 6.9.1 and testrpc 3.0.3. Ethersim is not longer supported as explained here
Misc Bugfixes and Improvements
- Improved automatic gas calculation when deploying a contract.
- In embark.json specifying a directory now copies each of the files to that directory. e.g
"images/": ["app/images/**"],
- Made EmbarkJS.Messages.sendMessage an async call for whisper (previously it was sync and it would hang until the message was sent)
- Added `stop()
method to stop listening to a channel. e.g
var listener = EmbarkJS.Messages.listenTo({topic: ["topic1"]});``you can now do``listener.stop()`` - Improved output messages for certain embark commands
- Clarified which environment to specify when deploying to live net (i.e it's livenet not production)
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
Embark 2.2.0 - IPFS Orbit
To Update to 2.2.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.1.4:
npm install -g [email protected]
afterwards make sure embark version
returns 2.2.0
In this release
Support for Orbit (IPFS pub/sub)
Previously only Whisper was supported in EmbarkJS which you could initialize with EmbarkJS.Messages.setProvider('whisper')
.
Now Orbit is also supported, Orbit is a protocol on top of IPFS for distributed real time communications that you can use in your Dapps, see bellow the talk in Devcon2:
To use it all you need to do is to set Orbit as the provider:
EmbarkJS.Messages.setProvider('orbit', {server: 'localhost', port: 5001})
(note: You'll need to use IPFS from master and run it as: ipfs daemon --enable-pubsub-experiment
)
Afterwards your communication code that worked with Whisper "just works" (tm) with Orbit as expected!
listening to messages
EmbarkJS.Messages.listenTo({topic: ["topic1", "topic2"]}).then(function(message) { console.log("received: " + message); })
sending messages
you can send plain text
EmbarkJS.Messages.sendMessage({topic: "sometopic", data: 'hello world'})
or an object
EmbarkJS.Messages.sendMessage({topic: "sometopic", data: {msg: 'hello world'}})
New command line options
the following options are not supported for embark run
:
- -p, --port [port] => port to run the dev webserver (default: 8000)
- -b, --host [host] => host to run the dev webserver (default: localhost)
- --noserver => disable the development webserver
- --nodashboard => simple mode, disables the dashboard
- --no-color => no colors in case it's needed for compatibility purposes
IPFS and SWARM deployment
The previous command to deploy to ipfs changed to embark deploy ipfs
. Now you can also do embark deploy swarm
to deploy your Dapp to Swarm.
Misc Bugfixes and Improvements
- support for solc 0.4.7
- support for web3.js 0.18.0
- fix for events in embarkjs (were only being triggered once)
- better automatic gas adjustment for deploying contracts
- support specifying web server port with -p or --port
- display errors in logs and status instead of crashing
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
Embark 2.1.0
To Update to 2.1.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.0.1:
npm install -g [email protected]
afterwards make sure embark version
returns 2.1.0
In this release
Solc 0.4.0
Embark now uses Solc 0.4. To update your solidity contracts to solc 0.4:
- Add a version pragma to each file
pragma solidity ^0.4.2
- Change modifiers from
_
to_;
- Add the
payable
modifier to functions that want to receive ether (constructor & fallback included)
Deployment and Gas estimation
Embark 2.1 improves the deployment system and the automatic gas estimation when using auto
. Previously there was a bug with certain contract configurations.
Dashboard improvements
- Errors with a deployed contract are not displayed in the contract state
- The current embark version is displayed on the available services
- Embark now displays the name of ethereum node it's currently connected to in available services.
Misc Bugfixes and Improvements
- Fixed a bug where contracts with errors were being incorrectly cached & retrieved from chains.json
- Fixed per-contract gasPrice override in the contracts.json config
- Fixed Embark contract.deploy() function so it treats no arguments as an empty list of arguments. (i.e contract.deploy() will do the same as contract.deploy([])
- Fix "deploy": false option, which was not working in certain edge cases
- Display gas used for deployment in the logs
- Add more helpful message when a deployment error is caused by a constructor error
Chatroom
To discuss about Embark or Dapp development, please join us at the gitter channel
Donations
If you like Embark please consider donating to 0x8811FdF0F988f0CD1B7E9DE252ABfA5b18c1cDb1
Embark 2.0
To Update to 2.0.1
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.
npm uninstall -g embark-framework
followed by
npm install -g embark
afterwards make sure embark version
returns 2.0.0
Embark 2.0
Embark 2.0 was developed from the ground-up, some functionality is similar, but generally projects will need to be migrated to be compatible. There is also introduction of new tools and better integrations with other platforms.
Dashboard
Embark 2 comes with a terminal dashboard.
The dashboard will tell you the state of your contracts, the enviroment you are using, and what embark is doing at the moment.
available services
Available Services will display the services available to your dapp in green, if one of these is down then it will be displayed in red.
logs and console
There is a console at the bottom which can be used to interact with contracts or with embark itself. type help
to see a list of available commands, more commands will be added with each version of Embark.
Contract & Blockchain Configuration
The configuration files have changed from the yaml format to the json format.
There is a default
environment whose configuration applies to all environments and a configuration specific to an environment will override (merge) it. So when running in development, Embark will take the configuration of both default and development to configure the contracts.
There is the option to specify the gas
directive as auto
and embark will take care of the limit automatically, this value can be changed to a specific gas value.
More information on the what it's possible to with contracts.json, including interdependent contracts, instances, etc.. can be found on the readme
# config/contracts.json
{
"default": {
"MyContract": {
"args": [
"defaultAll"
]
}
},
"development": {
"gas": "auto",
"contracts": {
"MyContract": {
"args": [
"developmentOnly"
]
}
}
}
}
EmbarkJS
EmbarkJS is a javascript library meant to abstract and facilitate the development of DApps.
promises
methods in EmbarkJS contracts will be converted to promises.
var myContract = new EmbarkJS.Contract({abi: abiObject, address: "0x123"});
myContract.get().then(function(value) { console.log("value is " + value.toNumber) });
deployment
Client side deployment will be automatically available in Embark for existing contracts:
SimpleStorage.deploy().then(function(anotherSimpleStorage) {});
or it can be manually defined as
var myContract = new EmbarkJS.Contract({abi: abiObject, code: code});
myContract.deploy().then(function(anotherMyContractObject) {});
EmbarkJS - Storage
initialization
The current available storage is IPFS. it can be initialized as
EmbarkJS.Storage.setProvider('ipfs',{server: 'localhost', port: '5001'})
Saving Text
EmbarkJS.Storage.saveText("hello world").then(function(hash) {});
Retrieving Data/Text
EmbarkJS.Storage.get(hash).then(function(content) {});
Uploading a file
<input type="file">
var input = $("input[type=file"]);
EmbarkJS.Storage.uploadFile(input).then(function(hash) {});
Generate URL to file
EmbarkJS.Storage.getUrl(hash);
EmbarkJS - Communication
initialization
The current available communication is Whisper.
listening to messages
EmbarkJS.Messages.listenTo({topic: ["achannel", "anotherchannel"]}).then(function(message) { console.log("received: " + message); })
sending messages
you can send plain text
EmbarkJS.Messages.sendMessage({topic: "achannel", data: 'hello world'})
or an object
EmbarkJS.Messages.sendMessage({topic: "achannel", data: {msg: 'hello world'}})
Tests
The tests changed, you can now specify your own contract config including arbitrary arguments and the same bells and whistles contracts.json
allows, including references, instances, etc..
You can run specs with embark test
, it will run any test files under test/
.
# test/simple_storage_spec.js
var assert = require('assert');
var Embark = require('embark-framework');
var EmbarkSpec = Embark.initTests();
var web3 = EmbarkSpec.web3;
describe("SimpleStorage", function() {
before(function(done) {
var contractsConfig = {
"SimpleStorage": {
args: [100]
}
};
EmbarkSpec.deployAll(contractsConfig, 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.
Pipeline
Embark now comes with its own pipeline by default, however plugins for grunt and meteor will soon follow for developers who prefer those workflows.
# embark.json
{
"contracts": ["app/contracts/**"],
"app": {
"css/app.css": ["app/css/**"],
"js/app.js": ["embark.js", "app/js/**"],
"index.html": "app/index.html"
},
"buildDir": "dist/",
"config": "config/"
}
Next Steps
Embark 2.1.0 will soon follow including solc 0.4.0. The following versions of Embark will focus on continuing the roadmap headlined at Devcon plus some new features to be announced.
Donations
If you like Embark please consider donating to 0x8811FdF0F988f0CD1B7E9DE252ABfA5b18c1cDb1
Embark 1.2.0
New to Embark?
If you are new to Embark, see the Readme.
To Update to 1.2.0
npm update -g embark-framework
If updating an existing project, run embark demo
to see the differences, a lot has changed.
In this release
Misc Improvements
- support for Mist and Metamask
- support to deploy a single contract in the test suite (example in embark demo)
Embark 1.1.0
New to Embark?
If you are new to Embark, see the Readme.
To Update to 1.1.0
npm update -g embark-framework
If updating an existing project, run embark demo
to see the differences, a lot has changed.
In this release
Compatibility Updates
support for:
- geth 1.4.4
- node 5.0.0
- web3 0.16.0
- solc 0.3.2-1
Testing Framework
Embark now uses a more recent version of EtherSim for its testing. You can expect the same functionality available in ethersim such as account creation, setting balances and "time travel" to test time sensitive functionality.
# test/simple_storage_spec.js
var assert = require('assert');
var Embark = require('embark-framework');
var EmbarkSpec = Embark.initTests();
var web3 = EmbarkSpec.web3;
describe("SimpleStorage", function() {
before(function(done) {
EmbarkSpec.sim.createAccounts(10, function() {
EmbarkSpec.sim.setBalance(web3.eth.accounts[0], 1000000000000000000000, function() {
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 Demo update
The classic SimpleStorage demo included in embark demo
has been given a facelift, some code fixes, and some guidelines to help newcomers.
Less Dependencies
Ethersim is now an optional dependency, you will be requested to install it if using embark simulator
or embark spec
. This makes the installation process much much faster and should help some people who couldn't or didn't want to install Ethersim and its dependencies.
The grunt-embark plugin has been moved back into the main embark repo. This separation caused update issues in many cases and turned out to be unnecessary. It's still possible to use embark without Grunt and it's compatible with Meteor, Gulp or whatever pipeline you prefer.
Misc Improvements
- fixed issue in the mining script
- added option "testnet" to blockchain.yml
Thanks
Special thanks to Aakil Fernandes, Area and RJ Catalano for contributions to this release.
Embark 1.0.2
New to Embark?
If you are new to Embark, see the Readme.
To Update to 1.0.0
npm update -g embark-framework
If updating an existing project, change the version in package.json as well and 'grunt-embark' to '0.5.1', followed by npm install.
run embark demo
to see the differences.
In this release
New Testing Framework
Embark now uses EtherSim for its testing. It's still in early stages and there are a lot of limitations, but expect steady good improvements over the next releases.
# 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();
});
});
});
})
notes:
- the test folder is now
test/
instead ofspec/
- by default embark now uses mochajs instead of jasmine. however, just like before, you can use any testing framework you wish.
- you can run the specs with
embark spec
ormocha test/ --no-timeouts
Simulator
It's now also possible to run:
embark simulator
As an alternative to embark blockchain
for development purposes.
Have in mind that, this is still in early stages so some bugs are expected. At the moment it's great for quickly developing and testing out simple contracts though.
Bundled Solidity compiler
Thanks to @d11e9 solc package Embark now compiles solidity contracts internally without need for external dependencies.
Less Dependencies
Embark no longer requires cpp-ethereum, python and EtherTDD.py. This makes the installation process much much faster and easier.
Misc Improvements
- support boostraping enodes in chain config
- chain files can be defined per environment/chain
- display grunt stacktrace
Thanks
Special thanks to FredericHeem, Aakil Fernandes, Gerbrand van Dieijen, VoR220, Harlan T Wood, Joris Bontje, Ryan Casey and Martin Becze for contributions to this release.
Embark 0.9.1
New to Embark?
If you are new to Embark, see the Readme.
To Update to 0.9.0
npm update -g embark-framework
To use serpent contracts, you need to add app/contracts/*.se
to Gruntfile.coffee
or embark.yml
. run embark demo
to see the differences.
In this release
Serpent support
You can now develop contracts using serpent with Embark. First you will need to install serpent, and then tell Embark to look for the serpent files in the directory of your choice (i.e add app/contracts/*.se
to Gruntfile.coffee
or embark.yml
)
The JS binding for the contract will be generated just like with Solidity Contacts.
# app/contracts/subcurrency.se
def init():
self.storage[msg.sender] = 1000000
def balance_query(k):
return(self.storage[addr])
def send(to, value):
fromvalue = self.storage[msg.sender]
if fromvalue >= value:
self.storage[from] = fromvalue - value
self.storage[to] += value
Will automatically be available in Javascript as:
subcurrency.balance_query(web3.eth.accounts[0]);
subcurrency.send("0x123", 1000);
Misc improvements
- Add
deploy:
field
e.g
development:
DataSource:
deploy: false # don't deploy this contract
args:
MyDataSource:
args:
instanceOf: DataSource
- Contracts syntax errors will now display on the console
- Fixed a bug where a previously deployed contract wouldn't redeploy if the data directory was deleted.
- other misc technical improvements and changes
Thanks
Special thanks to Chris Hitchcott, Gerbrand van Dieijen, Harlan T Wood, Joris Bontje, linagee, Péter Szilágyi and Ryan Casey for contributions to this release.
Embark 0.8.4
New to Embark?
If you are new to Embark, see the Quick Guide or consult the wiki for a more complete documentation.
To Update to 0.8.4
npm update -g embark-framework
you'll need to add the "chains.json". run embark demo
to see the differences.
In this release
This release of Embark allows you to develop, deploy and update advanced contract systems. It is much more advanced on how it manages and keeps track of deployed contracts. You can expect contract deployment to be now idempotent.
Actions after deployment
After a contract is deployed you can now specify actions to be done, for e.g to update an existing storage contract owner to the one you just released.
As example, the onDeploy
field executes updateStorage
with the new address of the MyDataSource contract.
development:
DataSource:
args:
MyDataSource:
args:
instanceOf: DataSource
Manager:
stubs:
- DataSource
args:
- $MyDataSource
onDeploy:
- Manager.updateStorage($MyDataSource)
- MyDataSource.set(5)
staging:
production:
Stubs
If you contract interacts with another contract, you usually need to include a stub. You can specify this by adding the stub property. for example, the crowdsale example in ethereum.org would look like this
development:
token:
args:
- 1000
Crowdsale:
stubs:
- token
args:
- "0x123"
- "100000000000000000000"
- 30
- "20000000000000000"
- $token
staging:
Chain Manager & Persistent contracts
Embark now always keeps track of deployed contracts in each chain.
This means that you don't need to worry about contracts being unnecessarily redeployed, embark will only redeploy if absolutely necessary.
You can even refactor (up to a point) and so long core functionality remains unchanged the contract wouldn't redeploy. for e.g adding a new line, white space, or refactoring a local variable wouldn't cause embark to redeploy the contract, but renaming an external variable, adding/editing/removing methods will.
Another practical application of this is that contracts can be persistent. For instance, you can have a storage contract, that is never deployed, and a manager contract that gets often redeployed. This is quite powerful when used in conjunction with 'onDeploy'.
Misc improvements
Embark will now:
- warn if gas costs are too low
- warn if the contract deployment wasn't completely successful
- retry on deployment fail
misc improvements were done on the example gruntfile. (remember you can use embark with anything, including meteor, not just grunt!)
Thanks
Special thanks to Tim Watts and Nikolai Mushegian for contributions to this release.
Embark 0.7.1
New to Embark?
If you are new to Embark, see the Quick Guide or consult the wiki for a more complete documentation.
To Update to 0.7.1
npm update -g embark-framework
you'll need to add the "genesis_block" parameter to blockchain.yml. run embark demo
to see the differences.
In this release
- support for geth 1.0.0
- support to set genesis block
- support to configure max peers
- fixed issue with contract deployment
Thanks
Special thanks to Joris Bontje and linagee