Author: Jonathan Lu (ArcBlock Senior Software Engineer)

When we started working on the ArcBlock platform, one of our main goals was to deliver a service that could help developers build decentralized applications easier and faster. Today, traditional web developers are already enjoying the luxury of well-defined web development tech stack, and we want to bring a similar experience for blockchain-based applications by giving developers and project managers everything they need to build decentralized applications in a similar way to web apps. Sometimes we compare it to something like Ruby on Rails, but for blockchain. With this goal in mind, we created the ArcBlock SDK that supports multiple languages like JavaScript, Python and Elixir, as well as tools innovative, easy to use tools like ArcBlock's CLI and Blocklet.Starters.

blocklets

In August, our intern Yongxin Xu wrote a series of excellent blog posts about her journey from being a beginner level blockchain developer to finishing a vending machine DApp with our products in just under 4 weeks. This inspired us to try eating our own dog food (Microsoft terminology) - not only to get our hands dirty solving real world problems, but also to test the usability and capability of the things we have built.

Based on that, we decided to participate in the recent Wanxiang Blockchain Hackcathon and to create and build a DApp idea within 36 hours.

Charging Block DApp

charging block dapp

The hackathon has a challenge called "Blockchain and the Automotive Industry", so we decided to focus on a problem that most people who own electric vehicles have encountered - charging your battery when no there are no available charging stations in your area.

From our observation, although the number of public charging facilities are increasing in the recent years, the coverage is still not satisfactory to all the users. People still run into the situation where they can't find a available charger in their range. Besides, since the charging stations are not connected and the drivers are not incentivized, the overall usage of the public charging system is not optimized. Some stations are always crowded because people park the car there all the time even though it's fully charged. Another issue is that the charging fee in those charging stations is usually a lot higher than home chargers because of the difference in commercial and home electricity rate.

So we came up with a DApp called Charging Block. The basic idea is to build an community of electric car drivers who are willing to share their charging pales. By launching a blockchain with a native token called Charging Block Token(CBT), people can join the community and share their resources and get paid. CBTs can be used to pay charging fees, encourage people to share(bonus tokens for the top charger providers), and penalize those who waste the public resource(idle fee for the drivers occupying the charger after fully charged). Moreover, people might use CBT to crowdfund a charging station in their neighborhood and get return on the investment. All of the transactions will be handled instantly and undeniably on the chain.

We think this is an interesting DApp idea, and started to work on a proof of concept demo during the hackathon. For the hackathon, our DApp demo will consist of 3 parts: the blockchain, the car app and the charging pale app as demonstrated in the video below.

For those out there who want to follow along through the code, here are a couple of items to help you get started and to help you see how easy ArcBlock makes it easy to get started.

We initialized a new blockchain with Forge CLI by running the following:

forge chain:create charging-chain

With a few steps in the terminal, we can customize the chain name and token name of the new chain. Then we can start the chain by

forge start charging-chain

That's it, the chain is up and running now. And now we can kickstart the new DApp with the dapp starter blocklet:

forge blocklet:use forge-react-starter

It's important to note for any developers following along. From this point, you have already started your own blockchain and one of our Blocklet.starters in less than 2-minutes. These steps typically are complicated and require a lot of extra tooling, but ArcBlock's platform makes it super easy to start your DApp. Now, you can find the rest of the demo code here.

The Result

By the end of the 36 hours hackathon, we finished building this demo and presented to the judges. And we were lucky enough to win the 3rd prize in the challenge.

winner

What we learnt from this experience is that, 1) we are on the right direction to make the framework more developer friendly, and the products we built are actually capable to achieve what we expected, and 2) there're still space for improvement on many small details that can enhance the developer experience, and we will continue to work on them.