Decentralised Finance & Apps — A Primer

Timi Ajiboye
Helicarrier
11 min readMay 19, 2020

--

A month ago, I wrote an article about a dApp game that someone anonymous built on top of NGNT. A good amount of people responded to me (on Twitter) that it all sounds very interesting on the surface, but they don’t really understand what a dApp (decentralised application) is and how to interact with one.

This post is supposed to help with that, somewhat. It should at least serve as a good “starting point” for anyone interested in getting a sense of what this is all about with as little technical jargon as possible.

Note: This article only talks about DeFi & dApps in the context of Ethereum and its ecosystem. While there are other such ecosystems, Ethereum is by far the biggest and it’s the only one I have any meaningful experience with.

Decentralisation

From Cointelegraph:

Decentralisation is the process of distributing and dispersing power away from a central authority. Most financial and governmental systems, which are currently in existence, are centralised, meaning that there is a single highest authority in charge of managing them, such as a central bank or state apparatus.

In the context of finance, decentralisation is the process of distributing access to create and partake in financial activity.

This is done using underlying blockchain technology. Explaining how blockchain works in detail is beyond the scope of this article. I’ll touch on certain aspects of it, but not in any particularly in-depth manner.

The important thing to note is that it is the technology that makes it possible to create financial instruments/activity that:

  • don’t have a single point of failure.
  • “everyone” can directly access without needing to go through the aforementioned central authority.

What is Ethereum?

From Ethereum.org:

Ethereum is a global, open-source platform for decentralised applications.

What do you mean by “platform”?

To understand “Ethereum-as-a-platform”, it might be helpful to think about another, vastly more popular, software platform: iOS.

iOS can be described simply as an operating system for iPhones. However, taking a look at the different kinds of entities that interact with it (and how they interact with it) should elucidate how it functions as a platform.

  • Software developers can build applications for the iOS operating system. Without developers building these applications, the iPhone would be much less useful than it is today.
  • Users buy iPhones to do all kinds of things. Users are also a source of revenue for the software developers that build the apps they use.

Analogously, with Ethereum:

  • Software developers can build decentralised applications for the Ethereum platform.
  • Users anywhere in the world (with internet access) may interact with these applications.

One fundamental difference between the iOS & Ethereum platforms is the nature of who controls them and how that control manifests.

Apple completely controls iOS. Apple decides who can build applications for their platform. They can remove any developer’s app whenever they choose to.

No one controls the Ethereum platform and what can be built on it.

How is this different from the regular web/internet?

On the surface, it can easily seem like dApps aren’t that different from the web applications we are used to. The Internet is indeed a platform in a somewhat similar way to Ethereum:

  • Software developers can build applications on The Internet. Medium.com is such an application.
  • Users anywhere in the world (with internet access) may interact with these applications.

The Internet also has characteristics that make it decentralized, at least in principle (if not in practice).

Anybody can build any kind of application to be used via The Internet.

If you’re interested in going through the stress, you can host a web application on physical hardware in your room and people anywhere in the world will be able to use it via their browser, in the same way they use every other web application.

To add a bit more confusion, dApps are also often used in the same way, via a browser (or a mobile application).

It might be useful to read this article I wrote about how the web works. Especially the sections that explain what a server and a client is. It’ll make the next few things easier to understand.

What then is the important distinction?

We may begin to understand the differences between these two things (normal Internet applications & dApps) by looking at how they work.

With a normal Internet application, a huge part of the code that determines how it works lives on servers somewhere (it could be in your home or in one of Amazon’s Data Centres).

The application publisher can change this code at any time to do whatever they’d like it to do. You see this happening all the time: Medium, for example, has undergone a lot of changes to how it works since launch in 2012.

Furthermore, for the most part, at least, no one except the publisher can see how the application truly works. Of course, there are ways to snoop around and gain some insight into what code is running on Medium’s servers, but the web (at least on the server-side) is not designed to be open in that way.

For example, your favourite mobile payment service (Wallets, CashApp etc) tells you that if you deposit money into their service, you’ll be able to access this money any time you want.

While that promise has held true thus far for the examples above, it’s important to note that there’s nothing inherent in the code running on their servers that prevent them from running away with your money. What prevents that from happening is a mixture of laws, the sincerity of the people who run those services, etc. — all of which are things that are dependent on human beings.

The implication of this is that you have to trust the publisher of the application. You have to trust that it’ll do what they say it will. This trust is particularly pertinent with applications that deal with money.

With dApps, there is no need to trust human beings. The code is all we need to trust.

How does Ethereum achieve “trustlessness”?

Like I mentioned earlier, Ethereum is built with blockchain technology. Think of the blockchain as a ledger of transactions that every willing participant has a copy of.

This leads to very interesting and useful attributes:

  • Transaction information isn’t stored on one source, it is stored in a distributed manner. Everybody with internet access can obtain a copy of this ledger, thereby increasing its decentralisation.
  • It is immutable. No one can change the records. To do this, you’ll have to change everybody’s copy and in reality, that’s much harder than it sounds.
  • It is open. At least with Ethereum’s implementation of the blockchain. Anybody willing to put in the effort can see every single transaction that has ever happened.

The term transaction might be a bit confusing, especially in the context of what we talked about in the last section. It may make things easier to understand if we look plainly at what a transaction is.

In the world of digital money, a transaction is simply a record of incoming & outgoing value — it is just data.

Ethereum goes further in that it lets you store more than transaction data on its ledger. With this implementation of the blockchain, you can store executable code too.

In the case of a normal web application you “host” the code that defines how it works directly on servers that you control entirely. With Ethereum, you can store code that enables whatever functionality you want on its blockchain.

What this means is that the code that’s hosted on Ethereum will have the same attributes I listed above:

  • Code/implementation information isn’t stored on one source, it is stored in a distributed manner.
  • It is immutable. No one can change the code once it has already been deployed.
  • It is open. Anybody willing to put the effort can validate code on the Ethereum blockchain. They can validate every single piece of code that has been deployed.

These are all in contrast with the applications we’re used to because, with this, you don’t have to trust what anybody says. With some (admittedly non-trivial) technical skill & effort, anybody can validate functionality that’s built-in this way by going to read the code.

The industry term for code written for deployment on the Ethereum ledger is Smart Contract.

Honestly, (in hindsight) I think Smart Contract is not the best name to describe this but I can see how the term manifested:

  • Such code cannot be modified and as such will always do exactly what was written. It is essentially binding. One can easily see how the word “Contract” came to describe this type of code.
  • I’m guessing that the preceding “Smart” is an attempt to distinguish this from regular contracts that do not live in the digital world.

I digress.

Smart Contracts are the backbone of decentralised applications. Here’s a good example of a useful simple smart contract:

Say I really want to save x amount of money. I don’t want to have access to any money I put in a “pot” until it all sums up to x. As a developer, I can attempt to write a normal web application that takes my money and won’t let me access it until I get to my savings goal.

However, there’s probably no real way to prevent me (or even a very skilled hacker) from accessing the money before reaching x with regular web development.

The only way to truly do this is to write a Smart Contract and deploy it to Ethereum (or a similar platform).

A well written Smart Contract that is supposed to prevent you from accessing funds you send to it till it gets to x amount will do exactly that. There’s no way to bypass the code that was written. It is a kind of digital law.

This behaviour opens up a lot of interesting use cases but we’ll talk about those a bit later.

What is a dApp?

Anybody with a computer that has an internet connection can immediately interact with ANY Smart Contract’s functionality by writing code. However, most people aren’t software developers and do not have the technical skill to interact with a Smart Contract without a relatively easy-to-use interface.

A dApp is a combination of the familiar web application interface and (one or many) Smart Contracts. This combination makes Smart Contract functionality more accessible.

A simple example of this is the dApp I talked about at the beginning of this article: WinNGNT. It’s a game that lets players win NGNT. And it’s comprised of the following parts:

  • A Smart Contract deployed to Ethereum. The code there can be read/verified by anyone.
  • The web application that lives at ngnt.win. The web application has text, images and buttons to make interacting with the underlying smart contracts easier than it would be without it.

One unique thing about dApps is that anybody that knows how can build one on top of any Smart Contract that has ever been deployed to Ethereum.

Say you don’t like how the WinNGNT web app looks or works. You can build your own version.

Or maybe you want to combine a few Smart Contracts deployed by different people all over the world to build a really cool dApp that lets users save money and earn interest in a decentralised way. In fact, there is such a dApp. It’s called Dharma.

Dharma (among other things) lets users (technically anybody with an internet connection) save cryptocurrency and earn interest on their savings. It combines its web (and mobile app) interfaces with some Smart Contracts. For example, Dharma uses Compound.

According to their website:

Compound is an algorithmic, autonomous interest rate protocol built for developers, to unlock a universe of open financial applications.

What this technical jargon simply means is that it’s a bunch of smart contracts that lets people lend & borrow digital currencies. Dharma uses Compound to generate interest for their users by lending their money to pretty much anybody in the world, in a secure way that doesn’t require them to trust the borrowers or even the creators of Compound. The only thing that needs to be trusted is the code within Compound’s smart contracts.

Another good example of this is Uniswap. Uniswap is what’s called a decentralised exchange. It lets users swap cryptocurrencies without needing to trust each other or even the makers of Uniswap. This is in contrast with the kind of currency exchanges we are accustomed to, where you have to trust the operators of the exchange and in some cases, the counterparty.

There are many examples of dApps and underlying smart contracts that enable pretty fascinating decentralised, “trustless” functionality.

Decentralised Finance (DeFi)

This entire ecosystem of Smart Contract protocols and dApps that provide decentralised financial services (savings, insurance, loans, trading etc.) is referred to as DeFi.

Prior to the introduction of some of the underlying technology that enables this (cryptocurrencies & the blockchain), access to financial services has been centralised and restricted by geographical location. Now it is (at least technically) possible for someone in Nigeria to participate in global financial activity.

This goal of opening up the African continent to this global value transfer (and growth) is the motivation behind both BuyCoins & NGNT.

DeFi is still relatively early stages. According to DeFi Pulse, there’s approximately $900m worth of value locked in various decentralised finance vehicles.

The current state of the DeFi User Experience

Admittedly, using dApps (for DeFi purposes or otherwise) is still a bit weird, to put it mildly. This is mostly because you have to use decentralised digital currency (also known as cryptocurrency). DeFi and its underlying technology (the blockchain) can only interface with currencies that are built in the same way.

With fiat, regular money (think Naira or USD), the process of say locking your money in a savings application is relatively straightforward. This is because, with banks & such apps, you’re not in control/possession of your money. You have to give money to those entities and trust that they’ll do what they say with it.

Yes, there’s the law but you have to trust that too. However, there have been many instances throughout the course of history in which those who control money & the laws governing it have done things that do not benefit the supposed owners of that money.

The only way to truly control your fiat money is to have it in physical cash. Cash doesn’t lend itself to a great user experience if you’re trying to participate in financial activity. At some point or the other, you have to cede control of your money to a human-controlled entity and you have to trust that entity.

Digital cash — money that you can choose to control completely while using it to participate in a digital global financial economy is the promise that cryptocurrency makes (and largely fulfils).

Due to the technical details of implementing “digital cash”, there are often trade-offs between offering a simple, familiar user experience and decentralisation. This is why, as of today, using dApps involve using a good amount of new tools (non-custodial wallets, dApp browsers etc).

Furthermore, the world still largely operates on fiat money. Most people today understand and denominate monetary value in one fiat currency or the other.

This adds some level of complexity because, proponents of this open global economy, like myself, have to provide easy to use tools (with varying degrees of centralisation) to convert fiat money into cryptocurrency (e.g BuyCoins & NGNT) so that more people can participate.

It is reasonable to expect that with time, some of these user experience kinks will disappear as the technology improves and adoption grows.

More Resources

There’s so much about this topic I didn’t mention. There are also many many instances where I forgo nuance for simplicity. All of this is intentional. Like I said at the beginning: the aim of this article is to serve as a starting point — to explain in relatively high level what this entire space is about.

If you’re curious, be it as a user, software developer or both. The best place to start learning more about Ethereum is Ethereum.org. It has simple guides that do a good job of urging you to get started with using this technology (which in my opinion, is the best way to learn).

If you want to read more about decentralisation with regards to money, why it’s important and the most used cryptocurrency in the world today (Bitcoin), I and seven other amazing people in the industry wrote The Little Bitcoin Book. It does a good job of explaining these things with as little technical jargon as possible.

--

--

Timi Ajiboye
Helicarrier

I make stuff, mostly things that work on computers. Building Gandalf.