The history of deploying smart contracts on Ethereum mainnet 10 times

makoto_inoue
BlockParty
Published in
6 min readDec 4, 2017

I have used BlockParty to reduce no shows on real events for 10 times and I would like to look back how it went by numbers.

The followings are the topics I am going to cover.

- Attendance rate
- Payout
- Reducing running cost
- How much does it cost to attend via BlockParty?
- How much does it cost to run BlockParty?

Attendance rate

You pay small deposit when you register. You lose your deposit if you do not turn up. You will get your deposit back + we split the deposit of whom did not turn up. You go to party and may end up getting more money.

That’s the promise of BlockParty on the website. Does this simple rule changes the behaviour of event participants?

Most free meetups usually apply 50% rule where only half the people attend. Even though we had some high no show rate at Edcon and Devcon3 (guessing due to participants being on unfamiliar location) the average attendance rate is 91% which I am very proud of.

Payout

As an event organizer, usually it’s quite upsetting when people don’t turn up to your events. On the contrary, we started saying “Unfortunately everybody turned up”. No matter how small the payout is, it’s actually quite fun to see whether you get (even small amount) a bit of extra Ether. So how much was payout?

ETH 0.4 at EdCon looks super expensive but don’t forget that Ether was very low at that time. If you convert the ETH value to USD of that time, payout is in the range of $1.5~$5 when there are no shows.

Reducing Running cost

The biggest difference of using smart contract (as compared to normal web site) is that every transaction costs some usage fee called “gas” which is paid to blockchain minors. Let’s see how much it cost for all transactions for each event.

As you can see, it was relatively expensive prior to Byzantine hard fork (a software upgrade which happened on 16th October) costed nearly $50 at some point, but went down drastically after the hard fork and kept going down. What happened?

Solution 1: Hard fork

The total gas one may consume is calculated by gasPrice * gasUsed As a user, you can set gasPrice by yourself (higher the faster the transaction is confirmed) while each functionality (eg: creating a contract, register, withdraw) has different gasUsed .

Prior to the hard fork, if your transaction fail, you could lose all the gas so you did not want to put so much. However, setting down too low also cause failure due to running out of gas.

This is no longer the case after the hard fork. The below screen shots are comparing two failing transactions , the left is before and the right is after the hard fork.

As you can see, the left one consumed the entire gas limit, resulting the failed transaction of $9.59 (with 20 gwei) whereas the right one costing $0.05(with 5 gwei).

Solution 2: Having fewer transactions.

One of the biggest problem of using BlockParty is that the event organiser has to manually sign in each participant. This may not only cost for event organisers to pay transaction for marking the attendance on blockchain, but also potentially an error prone task especially when they are busy dealing with many participants. This is not so much of the problem for my CodeUp event because we rarely exceed more than 15 people but could potentially be a problem if we try to handle hundreds of participants at London Ethereum meetup , one of the largest meetups we started piloting recently.

To solve this problem, I introduced so called “confirmation code” which we give away when participants attend so that they can mark themselves as attended later. I used the public address of http://ether.cards as a confirmation code so that users can still use the card as gift for someone else.

The downside of this approach is that people have to interact with the contract three times ( register, attend, and withdraw). The more you have to interact with contract, the more error one may make which was not great, so I stopped using this method.

After reverting back to the original method, the error rate went down to only a few transactions per event.

Solution 3: Setting gasLimit manually.

Even though you no longer have to worry about gasLimit too much, you still have to decide how much gasPrice to set.

Metamask usually sets gasPrice to 10~20 gwei and each user have to manually adjust the price if they don’t want to pay higher gasPrice.

It turned out that, as a Dapp creator, you can set these gasPrice on JavaScript to override the default set by Metamask (Thanks to @petrooo for the tip).

This very simple commit drastically changed the average gasPrice from 5.62 gwei down to 1.77 gwei

So how much does it cost to attend via BlockParty?

Good question! So far, I haven’t charged any fee (whether I can/should charge based on open sourced smart contract is another discussion topic) so the following data is purely for transaction gas cost.

It used to cost almost $2.5 at some point but the last event was around $0.2 mostly due to the decreased default gasPrice .

As I repeatedly mentioned, the big reason behind the cost reduction is due to Byzantium hardfork, but also thanks to a few changes I made based on the feedback I received from the participants. I would especially like thank people who participated on the Ethereum London October meetup, where some participants may have cost quite a lot of money.

I would like to call them “The brave 15”.

How much does it cost to run BlockParty?

So far, one of the biggest feature requests is to allow anyone be able to host their own event using BlockParty. There are still missing features I need to build (which is a discussion topic for another blog post), but I also would like to show how much I am paying right now.

The biggest admin cost is to deploy a new smart contract for each event.

I could reduce the deployment cost by having one contract which allows to handle multiple event but this will require more sophisticated architecture which allows you to upgrade smart contract. I am aware that there are some possible ways but that will also have downside of making smart contract more complex and may cause more bugs so I am still waiting for the technique to mature.

Instead, I manage to reduce the deployment cost by simply lowering gasPrice to 0.1 gwei .

Summary

In this blog post, I looked back the attendance rate, payout, and the cost of running BlockParty 10 times over one year. The rise of Ether price and slow network speed prior to Byzantine hard fork was a challenge as a smart contract developer but these forced me to look deep into my own Dapp logic to improve the efficiency.

--

--