Why is etherlime needed?

etherlime is an ethereum development and deployment framework based on ethers.js

Margaret Dobreva
LimeChain
4 min readJun 22, 2018

--

etherelime update: 1st of August 2018

The update includes:

  • etherlime compile — integrated compilation process allowing you to compile your solidity smart contracts. You can now easily enabled/disable optimiser through specifying how many runs of optimisation to perform.
  • etherlime test — integrated unit testing process allowing you to unit test your smart contract. Does not require you to use web3. Also allows you to use the accounts from etherlime ganache and allows to use the etherlime deployment API

At the current state of ethereum smart contract development there are very few alternatives to truffle as a framework. Despite truffle being a good tool, the more you use it the more you find the little hiccups and hurdles that frustrate or stop you from being efficient.

Most of them are due to the underlying web3.js that sometimes, mainly due to legacy reasons, tends to be unstable. Much like ethers.js has grown to be the major alternative to web3.js, etherlime strives to be what truffle is to ethers.js — framework for development and deployment based on this library.

The first obstacle we are about to tackle is deployment of smart contracts and allowing the developers to write their own deployment scripts that are not constrained to just the deployment transactions, but also allow them to use the newly deployed contracts right away as part of the initialisation sequence (this is the main point where truffle struggles as an efficient deployment tool). Inevitably we are going to move to compilation and unit testing too, but we like to move step by step and deliver constant frequent improvements.

Milestones:

  1. Being able to deploy compiled contracts (compiled in the truffle format) on local and infura nodes ←We are here
  2. [Not Ready]Being able to compile contracts to the desired formats for deployment
  3. [Not Ready]Being able to run unit tests on the compiled contracts

Installing

Deploying

etherlime exposes the following deployers:

  • InfuraPrivateKeyDeployer(privateKey, network, apiKey, defaultOverrides) - given private key to the deployment wallet, the network (as found in ethers.providers.networks), your infura API key and default deployment settings for gasPrice and gasLimit it exposes you a deployer object.
  • JSONRPCDeployer(privateKey, nodeUrl, defaultOverrides) - given private key to the deployment wallet, the url to the node you are trying to connect (local or remote) and default deployment settings for gasPrice and gasLimit it exposes you a deployer object.

All deployers share the same base functionality:

Deployer functionality

The main functionality the deployer exposes is (obviously) the ability to deploy compiled contract.

This is achieved through the deploy(contract) function. As mentioned before, the contract is descriptor object that needs to have atleast the following three fields:

  • contractName - the name of the contract
  • abi - the abi interface of the contract
  • bytecode - the compiled bytecode

All of these you can get by compiling with Truffle. We will soon expose you a way to do this through etherlime.

Deployed Contract Wrapper

One of the advancements of the etherlime is the result of the deployment — the DeployedContractWrapper

The DeployedContractWrapper is a powerful object that provides you with ethers.Contract amongst other functionalities. This allows you to start using your deployed contract right away as part of your deployment sequence (f.e. you can call initialization methods)

In addition it exposes you verboseWaitForTransaction(transactionHash, transactionLabel) function. This function can be used to wait for transaction to be mined while giving you verbose output of the state. In addition it allows you to specify a label for the transaction you are waiting for, so that you can get a better understanding of what transaction is being waited for. This comes in handy when deployment scripts start to grow.

Working with previously deployed contracts

Sometimes you want to work with already deployed contract. The deployer object allows you to wrap such an deployed contract by it’s address and continue using the power of the wrapper object. The function you can use to achieve this is wrapDeployedContract(contract, contractAddress).

Compiling

Not ready. TBD

Testing

Not ready. TBD

License

Completely MIT Licensed. Including ALL dependencies.

--

--

Margaret Dobreva
LimeChain

Head of Marketing at @LimeChainHQ |Explorer for life & Horse-rider since 4 | Passionate about blockchain & all things digital