On the afternoon of October 2nd, 2019, I was approached by John Carpenter, Co-Founder of the Global Blockchain Summit (GBS), during a Denver Blockchain Week event. He asked me if Xooa, as a sponsor of the GBS, would like to contribute a project to the conference, perhaps building off one of the Xooa-Managed Smart Contracts. It was a last-second request, but I got back to him quickly with an answer. The Xooa team came up with the idea to develop a project based off of the Voting Smart Contract. But there was a lingering question: Will we be able to accommodate this request with just a day’s turnaround as the Summit would be starting within 24 hours? It sounded unrealistic, but I was confident that we could accomplish this task.
Voting on the Blockchain
Voting is one of the best use-cases for blockchain technology as it allows a user to vote in a trusted and immutable manner. All votes are registered in the blockchain ledger providing full auditability.
This project was the perfect scenario to showcase Xooa’s capabilities.
Introduction to Xooa
Xooa is an enterprise blockchain cloud application platform. Xooa is focused on reducing barriers for enterprise blockchain adoption by making blockchain app development easier and faster, and enabling higher quality projects.
Planning the Day
Xooa offers an ideal set of features to make a voting smart contract on the blockchain in record time:
- Blockchain network – Check – Xooa provides a ready-to-use blockchain network. Phew!
- Smart contract – Check – Xooa has a managed smart contract for voting. The team simply had to deploy the app specifying the question for the referendum, the options to vote for, and the start and end time of voting. Another bullet dodged!
- Frontend for users – Well… partial check – Xooa does provide an embed widget that can be used for voting, but a frontend app still needed to be created and hosted somewhere for users to vote on.
- Authentication for users – Pending - This is something that the team had to work on. Xooa does provide an API to enroll the voters, but how would these API tokens be distributed to the participants of the GBS?
The first thought was to provide users with a signup form on the website and create a new identity for each unique email signup.
Thinking of the user experience, this idea was discarded. Instead, we decided to create a unique QR code for each participant that we could print out and distribute to conference attendees. The QR code will allow the user to navigate to the voting webpage and authenticate it as a unique identity too. Thanks to Denso Wave for inventing this effective solution.
Creating Frontend for End-Users
One option was to use the simple REST APIs that Xooa provides to invoke the smart contract and register votes. I could use another endpoint to get the details about the vote, such as options and questions for the referendum. Fetch the data from the APIs and create a form based on that.
Using Xooa Embed Widget
The option chosen was to simply use the embed widget, which Xooa provides, and place it on the voting webpage. Considering its ease of use and the time that was ticking away, this seemed to be the best solution.
We developed the voting webpage by:
- Creating a simple express Node.js app
- Throwing some bootstrap into it
- Adding a logo
- Including the embed widget
- Writing a little code to fetch the API token from the query parameter
- Inserting this code into the embed widget code
And voila! The app was ready. You can find the app at https://github.com/Xooa/voteApp
We containerized the app, created a repository on AWS ECR, deployed on ECS, and linked it with Route53. The app was live at https://gbse2020.xooa.com. Don’t try to open it as this link has been disabled now.
Creating a Batch of Identities
The target was to generate identities for 200 Summit attendees. A simple script was created to call Enroll Voters endpoint 200 times. But, Xooa had throttled the API limit to 50 requests per minute for the shared account. So, the script ran with some delays and stored the identity API tokens in a .csv file.
Creating QR Codes
This is the last piece of the puzzle. We used QR Explore, a simple online tool, to create QR codes in bulk.
The API tokens were appended to the website link, such that the link would look like this: https://gbse2020.xooa.com?token=xxxxx. QR codes were generated for all of these URLs.
Lastly, we printed all QR codes and handed them out at the conference. Attendees would scan the codes using their mobile phone and vote.
To get the tally, we simply had to call the Tally endpoint to see the results of the vote.
Ultimately, this voting platform was successfully launched in time for the GBS and it operated without a hitch. Attendees participated in this vote and simply saw a question with a choice of answers. Meanwhile, a robust blockchain network powered an auditable, immutable ledger that securely recorded every vote in the background.