Having successfully created my own voting app using testrpc it was time to venture out onto the real blockchain.

However, I am using the Ropsten test network instead of the main Etherum network, the main reason for this is because on Ropsten all the Ether used is fake and has no value.

After waiting two days for Ropsten sync and acquiring some Ether I was ready to deploy my contract, I used the same contract from my testrpc voting app but this time I was using truffle to deploy the contract so that I could create the web app to go with the voting system.

Let’s take a look at what happened:

So the first step was to deploy my contract, I used truffle and this showed up in the geth client:

As you can see the first item is the contract being created and then the transaction is the contract being initialised. Since the blockchain is public and open, we can have a look at the details of the contract creation on ropsten.etherscan.io:

This also shows the interesting part of Ethereum, gas. Deploying this contract used 300564 gas and the rate was 100 Gwei per unit of gas, therefore the total amount of Ether used to deploy the contract was 0.0300564 ETH, since this was on Ropsten the Ether was fake, however, if this was on the main Ethereum network at the time of writing it would have cost £6.60 to deploy this contract.

Now it was time to vote! Following the tutorial I talked about in my previous post, I created a web app which would display the votes and allow you to place a vote.


This webapp used javascript to cast votes and add them to the blockchain, since this is a function of the contract it costs Ether to cast a vote, therefore the webapp is designed to use the default account for that computer (found by typing ‘web3.eth.accounts[0]’ into geth), from here the transaction would be created and added to the blockchain:

Again, we can look at this on ropsten.etherscan.io to see a bit more about our transaction:

In this case, we can see that this transaction used 43006 gas, therefore it cost 0.00516072 ETH to cast our vote, or £1.13 at the time of writing if we were on the main Ethereum network.