Under the Hood of the CLN dApp

Leon Prouger
Colu Local Network
Published in
4 min readJun 6, 2018

As we continue working towards the airdrop in our current communities, I wanted to expand a little bit on the Colu communities dApp and how it was built. You can open the dApp at communities.colu.com.

As you know, we are building a vast ecosystem for local communities. This ecosystem has the CLN token, which is used as a reserve currency, and a variety of smart contracts to issue and exchange the community currencies. To put it simply, you take a bunch of CLN tokens and you lock them up in a smart contract, this is what creates a value for a community currency.

The smart contracts, like everything on the Ethereum platform, are all-inclusive, transparent and open source. You can read more about the smart contracts architecture here. The smart contracts are the foundation of our network. But as we seek mass adoption, the only natural next step was to provide a user interface for our smart contracts.

What is a dApp?

So at this point, I’d like to introduce the CLN community dApp. I’m sure most of you are familiar with the concept of decentralised applications, but for those who aren’t, I’ll define a dApp as an application with a backend running over a decentralised protocol. The backend of the CLN dApp is simply our smart contracts. The concept of dApps have been around well before blockchain technology. An example of such a dApp is the Bittorrent client that runs over a peer to peer protocol. Our dApp is running over the Ethereum protocol, and is, of course, using web3 :).

This is currently the MVP version with the limited functionality of reading the smart contracts’ data. You can explore the metadata of the three community currencies that we recently issued and read information such the price of each currency, total supply, circulating supply and more. All of this information comes from our community currency and market making contracts, with no server in the middle. Every community also has associated metadata, stored in IPFS (Interplanetary File System), which is also a decentralised protocol. IPFS is the technology we’re really excited about, and it works quite good with Ethereum.

How is the metadata of the community currency is stored in a decentralized way?

For example let’s look at the TLV Coin. It has the tokenURI property, the URI firstly states that it uses the IPFS protocol, then it contains the IPFS hash. Now you can go to the IPFS gateway and view the data. There could be some latency, but the data that you see came directly from the p2p file exchange protocol. It could have come from our IPFS node but maybe from another IPFS node around the world! Also the hash is immutable, different data will give you a different hash. So even if I want to link the current hash to different data I simply can’t. Just like you can’t switch blocks in the blockchain. So how do you change community metadata when it becomes outdated? There’s the setTokenURI function that the token owner can use. The pros of this approach are that all the changes are transparent on the blockchain, and the data changes are cheap. We even store the community icons in the IPFS!

The next steps for the dApp will naturally be allowing the exchange between CLN & community currencies, and then the ability for anybody to issue CC’s! Also, as more parts of our business will migrate to the blockchain (like our payment system), we’ll see them being reflected in the dApp. The dApp is going to be the ‘community explorer’ of our ecosystem.

Don’t say I didn’t tell you, because you can already issue community currencies using our smart contracts directly (we even have a wiki guide about it). Anyone can use them on the same terms just as we do, the hierarchy is really flat. You can build your own dApp based on them, or take ours, which is of course open source, and tweak it as you like (show me what you’ve got!). Ah, the power of decentralisation.

From Horses to Vehicles

This quote is taken from Andreas Antonopoulos’ book “Internet of Money”, it talks about the slow transition from the current technologies to the decentralised future. First, it talks to a centralised server that does some basic things like delivering the frontend bundle, sending mails and managing subscriptions. The centralised server also acts as a proxy to our IPFS node. As much as we love IPFS, it’s still in alpha, so it lacks some important features like permissions. We decided that exposing our bare IPFS node to the internet is unsafe, so we put a proxy in between. But you can always check that the data from our proxy and the IPFS network is the same! Over time we plan to give more control to users over their private financial information and personal details and we believe that IPFS will be a major building block for achieving that goal.

That’s all for now, if have a request or an idea for the dApp join our Telegram channel and let us know!

--

--