First of all, I would like to thank organizers of the Decentralized Innovation Startups Hackathon 2019. I’ve been attending the meetups since last year and I really enjoyed and learned a lot. I’m one in their vision to utilize blockchain in solving people’s problems and improve the quality of life in the future. Also a big thank you to Mike Abundo, Caspar Ostendorp and Amadeo Brands for helping me improve my idea!❤️

Warming up

I was about to bail out on this hackathon. Just like the previous DISH, I went alone again. I was just about learning more about blockchain especially IOST. Ever since the IOST meet up last January, I became interested in it because unlike Ethereum, it really made Dapp development less of a headache. Furthermore, the transaction fees are not that expensive. Since my main stack is MERN, I find it easy to integrate with my current workflow. The learning curve is really fast considering that I need to develop the front end, back end, blockchain end and, the business model in 32 hours (I was also able to take naps in between, lol).

Based on my previous experience, my strategies for this hackathon are the following:
– Focus on the blockchain implementation: Since this is a blockchain hackathon, nailing this end is really important. I failed to do it the last time so this is really my top priority.
– Come up with a solid concept: I used to have a different working idea before coming to Acceler8. For some reason, I remembered Mike Abundo’s idea of having an incentivized model for education during the Humanitarian Applications of blockchain meetup and used it as the foundation of my project.
– Utilize installation times: While setting up and installing dependencies, I used this time to outline how my idea works and how can it be sustainable. Building a solution in the education sector requires a lot of factors to consider that no technology can fix.
– Come up with a quick back end and front end: Since I’ve been using the MERN stack at work, my strategy was to develop the backend as I learn how IOST works. I will then come up with a quick react application that illustrates my prototype.

I came in late (sorry 😔) so I had a hard time finding a spot to work. Compared to the last year’s hackathon, there were more teams this year. It’s nice to see that more people are harnessing blockchain to build solutions.

Setting up IOST

I’ll assume you know the basics of IOST, if you’re new to this you can check out the concepts here. You can come back once you get an idea of how it works since it’s different from the other blockchain platforms.

Most of the time, I relied on the documentation provided by the team. First, I tried to build the node locally in MacOS Sierra. However, I can’t seem to build the node or install iWallet in the local server. Without it, I can’t use and publish my smart contract and manage the accounts in my node. With the limited time that I have, the docker method was the way to go.

Run your IOST node through this command (Install docker first!)
Running IOST node

After running the node, I also opened another terminal to access the container.

Working directory after accessing

You can see the working directory with iServer, iTest, and iWallet. You can now run iWallet by using ./iwallet since you are running the file from the directory.

After that, I created an admin account that I found somewhere in the docs (I really don’t know if it’s built in but from all the first accounts that I made this seemed to be preloaded with resources).

After creating this account we will use it to allow the creation of other accounts or publish our smart contract. From this, I made this other account and preloaded it with resources. IOST uses iGAS and iRAM to interact with the blockchain. For more information about their economic model, you check it out here.

For now, I made a dummy account just to make my life easier:

It sends you a JSON file of your account and a message for successful account creation

Writing my smart contract

You’ll be surprised at how easy it is to build a smart contract in IOST. To give you an example, here’s what I did during the hackathon:

Compared to solidity, smart contract development here is easier. Deploying the contract was a little challenging though. In order to compile my smart contract, I have to either copy my Contract.js file inside the container (provided that Node.js is installed) and compile or manually create the ABI file. I tried to study the ABI file from the example in the documentation and generate my own. Here’s what I did:

Notice that I have to specify the type of each argument and indicated the limit of the resources to be used. Without explicitly declaring it, it will assume that your limit to be zero. I realized this during the last 4 hours of the hackathon as my rewarding functions were not working. You’ll be needing these two files to publish your smart contract in IOST. Use this command to publish:
Contract.js and Contract.js.abi must be in the same folder

You should be getting a contract id to call your smart contract functions.

Integrating the blockchain with my Front end and Back end

Working screenshot during the hackathon. I tried making sense of RPC calls first because I was struggling with the SDK. But, I worked it out eventually the next day. (Oh, and I was caught by Mark Vernon playing Words for Friends during my break time. He thought I wasn’t doing anything. LOL)

I’ll be using React for my front end and Express for my backend so basically, I used only JS (including the smart contract) for this project. With that, you can wrap the RPC call or use the IOST JS SDK on the back end and make a simple React app that fetches data from the back end server. That’s it!

My problem though was whenever I call the signer account, the key appeared to be empty so there was an error in signing my transactions. This only happens using the SDK. I was about to make my own but I’m running out of time so I just showed that the smart contract works using the command line. 😂 I also checked it with the python SDK yet I still encountered the same problem.

Final Thoughts

The tech space evolves fast so we must also quickly adapt to these changes. Hackathons are a great way of validating what you learn and show proof of concept to potential clients, employers, and investors (aside from winning the top prize, lol).

Here are my learning points:

  • You can if you believe. You might go through a lot of failures but the important thing is that you learn. I may have not won the top prize but I got to know myself better and got points on how to improve in the future.
  • IOST is promising with a fast learning curve (I got to build a prototype in 32 hours!). It stays true to its promise being developer friendly which shows a bright future for Dapp development. I became a convert and would like to help develop this technology further!
  • There’s more to blockchain than being a platform for digital assets.When people hear the word blockchain, the number one thing that comes into their minds is money. I’m used to having this mindset too. However, my conversations with Caspar in developing my idea during the hackathon opened my mind to design solutions driven by value and benefit in ways other than money. With this in mind, we can develop more innovative solutions that would help make this world a better place to live.

Congratulations again to everyone who joined! 🙂 It was good to meet like-minded people. I hope we can work together to advance the current technologies. ✨

The author has shared the article to BlockDevs Asia, original content can be found here.

Vote for BlockDevs Asia: