Why TruStory chose to build on Cosmos SDK and an overview of its architecture

Image for post
Image for post

Why Cosmos SDK?

TruStory started out with the goal of building a decentralized app that had the look and feel of a normal app that people are used to. We didn’t want our users to wait for confirmations every time they performed an action, or have to deal with pending transactions. The app also called for a lot of fine-grained transactions based on events fired at specific times. So immediately, building on Ethereum mainnet was out of the picture. We needed something that was more responsive and robust. So we figured an Ethereum-based sidechain might work.

We built an early prototype on Loom SDK, but the framework wasn’t mature enough for our needs at that time. We did, however, take a liking to Tendermint, the BFT-consensus middleware that powers Loom. It allows for fast finality (~5 seconds), which is critical to the user experience of a social app with frequent interaction. …

Blockchains are great, but sometimes you need off-chain storage

Image for post
Image for post
Credit: yucelyilmaz — Getty Images

If you’re coming from frameworks like Rails or Django, you’re using to having an ORM layer that seems to work like magic. But eventually you’ll run into issues as your app scales, when more power and finer grained control are needed.

With Go, it’s easy to build a custom persistence layer, giving you the best of both worlds — a simple API, and the power to harness advanced database features as apps scale.

A common best practice in creating a solid persistence layer is to abstract out the database driver. …

Image for post
Image for post
tl;dr: Wrap your Redis

Redis is easily one of the most useful pieces of open source software to come out in the past decade. It allows implementation of business logic using familiar data structures like lists and hashtables in a very fast and efficient manner. Database interaction is typically done using an object modeling or ORM layer. Similarly, Redis is best used with a similar layer of abstraction to encourage modular development and maintainability.

Here are three examples of such services for Node that were extracted from the text-only social network I built, Blink. Blink relies on Redis for much of it’s functionality, including it’s ephemeral stories feature. …


Shane Vitarana

Founder @publicawesome_

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store