Skip to main content

In this series, we have followed fictional character Alice as she builds out a donation system with Ethereum. So far, she has built and tested a smart contract and would now like to deploy it (before starting work on the frontend GUI for her app). After some research on the web, she decides to try out three different approaches with Mist, Truffle and pure JS. To deploy a contract, we need two key pieces of data - the contract ABI (Application Binary Interface) and compiled bytecode.


In our examples, we have used the high level language Solidity because it has excellent Javascript support. To execute this code on the blockchain, we need to compile it to bytecode. The Ethereum Virtual Machine (EVM) runs bytecode instructions on a virtual machine - allowing the same code to run on multiple platforms. Function names and input parameters are hashed during compilation so we also need to provide additional information in the form of an ABI so that other accounts use our contract.


The Application Binary Interface provides the set of functions and arguments required to interact with a deployed contract as a JSON object. The function definitions in the ABI are hashed when making calls to a deployed contract so it can call methods and retrieve data.

There are many ways to deploy contract code. We can use:


Mist is a popular Ethereum wallet application that runs on Mac, Windows and Linux. It provides a number of tools for interacting with the blockchain including a Dapp browser and Remix IDE - a GUI for writing and deploying contracts. We can simply past contract code into the Remix IDE and click a button to deploy. This tool is also available on the web (you don’t have to download Mist and run a full node to access it).

Remix IDE screenshot

Just Javascript

Using the bytecode and ABI we generated with Remix IDE we can use web3 library to deploy a contract.

If you are browsing via Mist or Chrome with MetaMask plugin enabled, clicking this button will deploy the example contract code (you'll need to wait a minute until it's mined for a response)



Truffle has a slightly more advanced mechanism for deployment. With the previous two methods, we are unable to update our contract if we found a bug. To work around this we can make use of a second contract to route requests to the latest deployed version of our contract code. Note that if a contract contains data (like ours), this would not be migrated and we would need to refactor the code to separate the data we want to keep from the methods that act on that data. Truffle uses the following contract code when issuing command truffle migrate

Relaying without Truffle

We could also use a new feature in the Homestead release of Ethereum called DELEGATECALL. If a method called on a contract does not exist a default unnamed function is called. We can take advantage of this to forward requests and calls to the actual address of our contract, as in this example.

For more information on this topic, to ask questions, or to find out how we might be able to help you.

Please feel free to email:



Want to join our team?

Copyright © City Web Consultants Ltd. 2017. All Rights Reserved
Company number: 27234161

Want to start something?

Fantastic! We'd love to hear from you, whethere it's a pitch, an idea or just saying hello!

Feel free to get in touch.


Drop us an email?


Or give us a call?

+44 (0) 191 691 1296


Playing hard to get? We'll contact you