[ PizzaCoin the Series #1 ] How Did We Develop Ethereum-based Voting System for Pizza Hackathon?
Recently, I got an opportunity to be one of staff members who organized the event called Pizza Hackathon. Pizza Hackathon was the 1st blockchain hackathon event in Thailand which was held on 25-26 August 2018. The objective of this event was to educate blockchain technologies as well as building up thai blockchain developers. The event consisted of education and project hacking sessions in which all participating developers had freedom to develop any project based on any blockchain technologies. There was eventually the project competition among teams of developers at the end of the event. The video below presents the event wrap-up.
Credit: Cryptomind and Bitcoin Addict
What is PizzaCoin?
To find the winning team, we developed a voting system named PizzaCoin. PizzaCoin is a voting system based on Ethereum blockchain’s smart contract compatible with ERC-20 token standard. Each event participant (i.e., all participating developers and all event staffs) would be registered to PizzaCoin contract. The contract allowed a group of developers create and join a team. Meanwhile, any authorized staff was able to perform operations such as revoking some developer from a team, revoking a whole team, changing contract states, etc. All participants would receive equal voting tokens. With PizzaCoin contract, a participating developer was able to give his/her votes to any favourite projects developed by other different teams whereas the staff had freedom to vote to any teams. Each voter could spend voting tokens according to his/her own balance. Specifically, all voting results would be transacted and recorded on the blockchain. As a result, the winning team, who got maximum voting tokens, was judged transparently by the developed PizzaCoin contract automatically without any possible interference even by any event staff.
What are the contents of this article series?
My friends and I intended to reveal all stuff we have made to the public. We, therefore, published all the source code used at the event as open source projects. You can check them out at our GitHub account. For PizzaCoin contract, we published the source code right here.
One of the biggest challenges when developing Ethereum smart contract is to find a solution to handling ‘Out-of-Gas’ error during deploying the contract onto the blockchain network, due to some block gas limits on Ethereum blockchain. The prototype of our PizzaCoin contract also confronted with these limitations since our contract requires several functional subsystems such as staff management, team and player management, and voting management subsystems. To avoid block gas limit problems, PizzaCoin contract was designed and developed using several advanced concepts and techniques. This makes the contract’s source code not easy to understand.
That is why I decided to write this series of articles to explain the technical details on how PizzaCoin contract was developed. As a prerequisite, a reader is expected to have knowledge of Ethereum blockchain and Solidity language at least intermediate level in order to understand the contents of the forthcoming articles. Here are good resources for learning Ethereum and Solidity: Solidity in Depth and Learn to Code Ethereum DApps By Building Your Own Game.
PizzaCoin the series consists of 6 articles as follows.
Part 1: How Did We Develop Ethereum-based Voting System for Pizza Hackathon?
Part 2: Workflow Design for PizzaCoin Voting System
Part 3: Detailed Implementation of Staff and Player Contracts
Part 4: Detailed Implementation of Team Contract
Part 5: Deploying Children Contracts with Contract Factories
Part 6: Integrating PizzaCoin Contract with Dependencies
In the next article, you will learn the workflow design for PizzaCoin voting system. See you in the next article.