Inspiration

Many small shop and street vendor in Indonesia sell what we called Voucher Data. It is a voucher for digital product like airtime or game item. It is unique, it can be bought but it can not be sold back to money. It still possible to be sold back to money in black market but the price will drop > 30%. This happen because voucher provider still dominated by big company, telco and they take big cut to redeem the voucher.

To solve above problem we make a token with some features called Voucher IDR (VIDR).

But, just a product is not enough, we must have the product used by the vendor and end user. We must have the market to adopt it. We need support. Support for blockchain development can be by donation, grant or ICO (initial coin offering). The latter got bad name, because price performance not meet expectation.

To solve above problem we make a dapp called Kings of Harmony (KOH). Inspired by King of Ether, we make a scheme to give support for development. Supporter will receive token with limited risk and fixed price performance.

What it does

Voucher IDR (VIDR) is a voucher for digital product in Indonesia. It is HRC20 token based on stablecoin RUPE in harmony blockchain. It have some additional functions:

  • Generate voucher. Anyone can generate/mined voucher as long he have RUPE and ONE for gas fee. Street vendor and small shop now have another voucher as alternative.
  • Redeem voucher. Now any merchant or startup can accept voucher payment easily and redeem it back to stablecoin RUPE. The difference in price is very small (3% vs >30%) in RUPE (exclude gas fee).
  • Sponsored payment. A transaction in blockchain is complicated for end user. User must have native coin to pay for gas. Inspired by EIP 865, we make this function that can be called without gas. User just need to sign, and sent the signature to merchant. Merchant will pay for gas.

Price difference in RUPE to generate and redeem voucher will be sent to Kings of Harmony Pool. Sponsored payment also generate fee in RUPE that sent to pool.

Kings of Harmony Share (KOH) is a scheme to help VIDR development and market adoption. It is a smart contract or pool that accept fee in RUPE from VIDR. It also a HRC20 token. KOH token represent percentage to assets locked in pool.

Beside standart HRC20 token functions there are three additional functions:

  • Update price. KOH price is in ONE and calculated by: total assets ONE & RUPE locked in pool divide by total supply of KOH Its mean: if ONE & RUPE locked in pool increase, the price of token KOH will increase. ONE locked will increase if there is event buy token. RUPE locked will increase if VIDR smart contract sent fee. This function always called after buy/sell token, and can be called directly anytime.
  • Buy token. A percentage in pool can be bough by anyone, anytime, in any amount, but in 130% current price. Which 15% will be for development, 115% to be locked. It is inspired by king of ether, which the next king must pay for previous king. By have 115% ONE locked, its mean 15% will be used to increase value for token. Benefited previous token holder or kings!
  • Sell token. KOH token holder can leave the project anytime. He can sell his token and receive back ONE in 100% current price + bonus stablecoin RUPE, part of VIDR fee. Remember current price always higher than previous price, the return greater for long term holder.

How I built it

I write the smart contract following openzeppelin standart, truffle, and harmony sdk example. Deploy it on testnet and later in mainnet. To interact with mainnet, i made a dapp in reactjs that connected directly to harmony blockchain (no backend). The dapp can be used to generate/redeem voucher and join/leave kings of harmony scheme. The dapp deployed to netlify at https://kohdashboard.netlify.app.

A second webapp has been built to demonstrate payment without gas. It is a demo of voucher payment. User must pay by voucher VIDR to buy but no need to have ONE for gas. It is built on reactjs & harmonyjs and deployed to netlify at https://kohclientdemo.netlify.app. To support gasless payment a rest api has been built and deployed to heroku at https://arcane-plateau-67130.herokuapp.com/check.

Challenges I ran into

Gas. Gas used to run methods in smart contract should be calculated easily. EstimatedGas function sometimes return value that make transaction success but not change blockchain state. For now, i set value for gas to fixed big value.

If some error happen in smart contract, there isnt any error message, so its difficult to debug.

There is no decentralized exchange deployed, so i can not convert RUPE to ONE. For now, asset locked in pool are ONE and RUPE. Ideally there is only ONE.

Accomplishments that I'm proud of

This idea is how cross border investment can be modeled. How crypto communities (ONE holder) invest on product backed by stable coin (RUPE). Its can be called community owned stable coin, because the fee to make payment, mine & burn used to pay back to community on chain.

There are many components to built: 2 smart contract in solidity, 2 dapp to interact with smart contract (Voucher Generator & Kings of Harmony), a rest api + a front end (Voucher Payment Demo) to demonstrate gasless payment. Luckily i can built them on time.

A Gasless smart contract function. This function needed extra security. A function cannot be replayed, and must ensure the signature valid. This is complicated but it can be done!

What I learned

  • Harmony JS, javascript library to interact with smart contract in harmony blockchain.
  • Harmony ecosystem, wallet, etc.
  • Gasless Function based on EIP 865.
  • Openzeppelin Standart Contract

What's next for King's Coin

This submit, is a proof of concept. A product to help small business and startup in Indonesia to receive voucher payment. Our startup planned to built some app to support its growth:

  • If uniswap-like deployed in harmony, the pool should be accept single asset.
  • Create client SDK for VIDR, so any startup in Indonesia can have his own voucher payment gateway.
  • Have any voucher seller in Indonesia to know and sell voucher using this dapp.
  • Have many online seller/startup/small business to integrate VIDR.
  • Improve voucher payment demo to full user wallet & have many user to install them.

Built With

Share this project:

Updates