How to develop a DApp with ArcBlock SDK within 36 hours

in #sct5 years ago

On September 15th, the 5th engineer of the ArcBlock block found out that the DApp developed by the 2019 Shanghai Blockchain International Week hackathon stood out in 27 entries and won the third prize. The decentralized application, called Charging Block, creates a peer-to-peer shared charging network for electric vehicle owners, which aims to encourage more charging facilities to build and share, solve mileage anxiety, and get incentives from owners and owners. A few days ago, Jonathan Lu, an ArcBlock engineer on behalf of the team, gave a review of the entire development process and results.
Jonathan Lu (ArcBlock block cornerstone Senior Software Engineer)
157259791967368.jpg

In the development of the ArcBlock platform, we believe that one of our important missions is to provide developers with convenient and fast development of DApp (decentralized applications) [1] services. Nowadays, traditional web developers already enjoy the convenience of a mature development technology stack, and we hope to bring a similar development experience to the blockchain application development field, providing developers and product managers with the tools needed to develop DApps. all. We sometimes think of it as Ruby on Rails for blockchain. To this end, we developed the ArcBlock SDK (supporting multiple languages ​​such as JavaScript, Python, Elixir, etc.), the ArcBlock CLI tool, and Blocklet.Starters [2].

157259794767645.jpg

In August, our intern, Nana, wrote a great series of blogs sharing her learning process from an entry-level blockchain developer [3] to a self-service vending machine DApp. This series of blogs inspired us to "eat our own dog food" - not only to try to solve real-world problems with our products, but also to test the capabilities and usability of our products.

So, our team signed up for the recent Universal Blockchain hackathon [4], try to develop a DApp with the ArcBlock SDK within 36 hours.

Charging Block DApp

157259799474075.jpg

The theme of this hackathon is "blockchain and automotive industry", so we have chosen a common electric car owner to encounter the problem as the theme of DApp, that is, "there is no charging available when there is no electricity." Pile "The problem.
157259802869426.jpg

According to our observations, although the infrastructure for electric vehicle charging has been increasing in recent years, the coverage rate still cannot meet the needs of all users. The owner will still encounter a situation where there is no charging pile nearby. At the same time, because the charging stations are not connected to each other, the owner community does not have an incentive mechanism, resulting in an overall optimization of the use efficiency of the charging pile. Some charging stations are overloaded and some are unattended, and the owner will also use the charging station as a parking lot, which still occupies the position after being fully charged. In addition, because the charging rates for commercial and household electricity are different, the charging station charges are usually much higher than the cost of charging at home.

157259805531565.jpg

So we designed a DApp called Charging Block. The basic idea of ​​this DApp is to build a community of electric vehicle owners sharing charging piles. By publishing the blockchain-based Charging Block Token (CBT), people can join the community, share their resources, and get rewards. CBT passes can be used to pay for charging, reward members who share resources (for example, users who share the most charging piles can get extra rewards), and “punish” members who waste public resources (owners who are fully charged and occupy positions will be fined) )Wait. Further, community members can also use CBT to crowdfund the charging stations in their communities and get a share of the subsequent revenue from the charging station operations. All of these transactions are recorded through the blockchain and are effective immediately and cannot be tampered with.

We thought this was an interesting idea and decided to try to develop a demo during the hackathon. The demo will consist of three parts: a blockchain, an in-vehicle application, and a charging stub application. Here is the demo of Charging Block:

Here are the basic steps we took to develop this demo, and you can see how simple this process is.

First we use Forge CLI [5] to initialize a new chain:

forge chain: create charging-chain

After a few steps in the command line, we customize some parameters such as the name of the chain and the name of the pass, then Let's start this chain:

forge start charging-chain At

this point, a new chain is created and started running. Then we use dapp starter blocklet[6] to initialize a DApp:

forge blocklet:use forge-react-starter

At this point, our DApp is already initialized, and the tools and dependencies required for development are installed. This entire step is completed in two minutes. Based on this, we developed the interface according to the requirements of the demo, and called the JavaScript SDK to implement transaction-related logic. Here is the code for the demo: https://github.com/wangshijun/charging-block

Sort:  

Congratulations @arslanbajwa! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You received more than 250 upvotes. Your next target is to reach 500 upvotes.

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.23
TRX 0.12
JST 0.029
BTC 67195.72
ETH 3491.41
USDT 1.00
SBD 3.14