What’s Coming in the New Dether App: Part 1—The Zoning System

In a series of articles prior to our next release, we will detail aspects of the new Dether app, including our implementation of the Harberger Tax for zoning purposes, decentralized certification, and what will change in the Dether wallet.

Apr 6, 2019 · 6 min read

With development of the new Dether app currently underway, we wanted to highlight upcoming features and changes in a series of development articles; our first article will focus on the zoning system.

From the beginning, one of the major aspects of our project has been creating zoning system. Why? The need for a zoning system is twofold:

  1. In a cash-resistant market such as crypto, where it’s difficult to move from crypto to cash or from cash to crypto, both crypto buyers and sellers need an attractive way to foster crypto access. Assuring zone-exclusivity to a crypto seller provides minimum service assurance, while needing to stake DTH in order to “have skin in the game” can reassure buyers that a seller is someone who truly intends to sell crypto.
  2. In order to follow the regulations in each country where Dether is open, we need a reliable on-chain way to verify a potential seller’s location, which can be done with the zoning system.

This is what makes us unique in the face our competitors in the existing cash-in cash-out system and why we think we will attract the most reliable sellers.

In October 2018, we released the first beta version of the Dether app, which was a way to get feedback during our R&D phase and start obtaining our first users. This system didn’t use a zoning system for tellers and shop, but a simple lat-lng system, associated with a country code, all registered in a smart contract

Using the current solution, the user declares a lat lng and a country (using country code of 2 characters). By using country mapping to verify if Dether is open in the country, we can then accept their registration on-chain.

Originally we used an ‘onlyOwner’ function to allow the app to be open in some countries:

The function to open a country for trade

We also had a way to check if this country was open when someone wanted to register his or her own point of sale:

To check if the declared country is open

But unfortunately, it’s impossible to check if the lat-lng is included in the declared country. This is problematic because the smart contract could be used in an alternative way.

We had to be able to represent zones (country, city, district etc.) on-chain, so that we could then verify other, smaller areas. This system should allow us to be able to force different rules depending on where the user wants to register and to grant specific rights to the owner of the area.

With this system, different rules are possible, such as allowing open and close zones, limitation of trade volume in a particular zone, etc.

After studying a variety of different solutions, we decided that geohash would be the best solution for our needs.

Geohash is a means of encoding a geographic location into a short string of letters and digits. Invented by Gustavo Niemeyer, it’s a public domain geocoding system subdividing space into buckets of grid space.

The entirety of the Earth can be represented by geohash, starting from 1 character, to an extreme zoom-level:

Each additional character you add defines a zone inside the larger one:

Level 2 of zoom on the root geohash U, which is principally located in Europe:

We realized that a geohash of size 4 could be used to represent a country on the Ethereum blockchain. It’s big enough to define a country territory, and small enough to be registrable on Ethereum.

Here’s a zoom of Belgium with geohash of size 4:

A country like Belgium can be represented by a list of 80 strings of 4 characters.

Instead of storing 4 characters for each geohash, as they share the same geaohash3 root, we can store geohash3 root once, and the last character of each geohash4:

The geohash representation of Belgium in json format before adding it in a smart contract

With some optimisation in the storage in the smart contract we ended up being able to store the entire world for a total cost of 264279513 gas.

With a gas price at 5gwei, it only costs 1,32139 ETH to map the entire world this way.

Using this system for the users’ zones

We choose to use geohash of size 6 to define users zones:

San Fransisco in geohash 6
An look at how San Francisco’s zone will be represented in our next release

We choose a geohash size of 6 because it represents a zone where anyone in a city could reach a point within a 10-minute walk. It’s big enough for a zone owner to have enough customers, while being a short enough distance to walk to as a sell point:

5 → 4.89km × 4.89km → too big

6 → 1.22km × 0.61km → around a 10-minute walk

7 → 153m × 153m → too small (zone too large)

With the geohash location data, it’s easy for a seller to share the first four characters of his or her country code to verify it on-chain.

The GeoRegistry.sol smart contract (where the country zone will be registered) will be as open as possible. Other users will be able to add other smaller areas (like cities, topographical areas, etc.) to the query to see if smaller areas are included in these same root zone.

You can even take a look at our ZoneFactory.sol contract, where the users’ zones are created.

Zone owners will be able to rent their zone for other shops willing to advertise their location, and the the zone owner will define his or her own price for a shop to appear in his or her own zone.

As we are at the beginning of the cash-to-crypto revolution, our foremost priority today is to add liquidity to the market. That is why this system combining zone exclusivity and additional income related to renting for the shops ensures a certain attractiveness for the entities ready to commit to providing cash-in cash-out service. Making the market more liquid can only benefit the whole community.

It’s important to keep in mind that zones will be subjected to a very particular system of ownership. We hope to attract bidders who want engage in activities that add value to the protocol.

The zones will therefore be constantly auctioned in DTH and will go to the one that is ready to stake the most, thanks to a system similar to the Harberger tax, which will be the next installment in this series!

Dether Talk

Buy and Sell Crypto, wherever you are in the world