Introducing the Leo Lightning DB Layer for Hive | Speed of Web2, Principles of Web3

78 comments-0 reblogs
avatar of @leofinance
LeoFinance Badge
2 years ago - 6 minutes read

Introducing the Leo Lightning DB Layer for Hive  Speed of Web2, Principles of Web3.png

The Leo Lightning DB Layer is something we've been developing for nearly 6 weeks now. The project has taken much longer to develop and release than we anticipated, but the resulting product is even better than expected. After weeks of backend development and countless rounds of testing (including 2 live fire tests), Lightning DB is now in production on https://LeoFinance.io and appears to be stable.

What is the Lightning DB Layer?

Lightning DB is the name we gave to this project. The entire premise is to bring the Speed of Web2 to the Principles of Web3.

Hive gives us the principles of Web3 by providing a decentralized, scalable and fast database for storing user data and user generated content (UGC). One issue with Hive is that the APIs can sometimes slow down the display of data on the frontend. For the most part, this is not an issue at the first layer. You can find that there are small delays in certain actions (i.e. a few seconds delay for comments and other actions).

To combat this, we built an Actions Queue to allow users to rapidly upvote/comment, etc. on LeoFinance.io and allow the Queue to deploy those actions in sequence on the backend of the site.

This allows users to interact without seeing all of those "Blockchain Errors" when they're rapidly committing actions on the frontend, but the speed caps still exist. Since LeoFinance exists on the second-layer of Hive (currently on Hive-Engine and soon migrating to our standalone second-layer), there is an additional delay on certain aspects of the site.

These delays especially impact:

  • Comment times
  • Post Publishing times
  • Trending/Created/etc. content feeds
  • Wallet Page
  • .....

LeoFinance depends heavily on the speed of both Hive APIs and second-layer APIs. While our upcoming second-layer project is much faster than Hive-Engine, neither that layer nor Hive itself will ever have the "Speed of Web2". This is simply due to limitations, even if they are only a few seconds (which is much faster than other blockchains).

A workaround is the Lightning Layer that we have developed.

The Lightning Layer is a database that exists on the backend of https://LeoFinance.io. When users commit actions on the frontend, they are instantaneously deployed to this layer and displayed on the UI frontend. From there, the layer speaks to the Hive blockchain directly and sends those actions to the chain.


You could think of Lightning as a sort of "Middle-man caching layer" that serves as an instantaneous go-between for LeoFinance and the Hive blockchain.

Note: the Lightning Layer plays an essential role in the development of #projectblank. More info on this in later announcements.

A Web2 User Experience on Web3

The Lightning Layer is a very backend-heavy project. It doesn't have all the fancy bells and whistles of frontend development where users notice some shiny new feature on the UI.

Instead, it improves the user experience in a much more subtle way. For users that have been on Hive/LeoFinance for a long time, you'll notice the speed enhancements right away. When you load the homepage of LeoFinance.io, load a feed, click on a post and especially when you publish a Post/Comment - you'll notice that it is nearly instantaneous.

The speed is incredible and shows an immediate improvement for all of us who have been here for a while. For new users, however, they expect this speed.

One of the most challenging hurtles from web2 to web3 is usability. As with any new technological breakthrough, Web3 is difficult to get started with and can often have bugs, slow loading times and steep learning curves.

LeoFinance aims to change this and make Web3 as easy to use as Web2. The significant difference is that we are plugged-in to a blockchain which allows us to store data publicly, immutably and in a decentralized fashion. We can also distribute rewards every few seconds on the Hive blockchain to tens of thousands of users.

In short, when you examine the roadmap and developments of LeoFinance, you'll notice a clear trend. Whether it's LeoInfra (instant onboarding & Hive lite accounts) or Lightning DB (caching layer for Hive), we're moving closer and closer to this vision of merging the speed of Web2 with the principles of web3.

What's the Future of Lightning ⚡️?

To see Lightning in action, just load pages/content on LeoFinance.io. On feeds and other pages, the speed improvement is about 20% faster.

User actions - commenting/publishing posts - the speed improvement is 10x... Yes, 10x.

Here is a demo we released on Twitter showing the speed improvement of creating comments. We managed to shave the time needed to publish comments/posts to the blockchain from 9.95 seconds to 0.92 seconds.

It's truly an incredible experience.


This is just V1 of our Lightning Layer. In our roadmap, we've scoped out other aspects of Hive APIs/second-layer actions that can be improved with Lightning.

As the project is developed, you'll notice other action become instantaneous. You'll notice further enhancements to page loading times, etc.

Lightning can also handle more than just speed improvements. We've begun playing with a few ideas which could potentially allow Lightning to publish/retrieve data to/from multiple blockchains simultaneously in the background.

If you're paying attention to the Crypto/DeFi space, you'll notice that everything is moving toward this idea of being "Cross-Chain compatible". LeoFinance.io already has cross-chain features (i.e. allowing seamless wallet co-operation between Ethereum and Hive and also allowing Ethereum Metamask users to sign-in to Hive lite accounts and interact on the site), but the future is in deepening this relationship with other blockchains.

Through Lightning, LeoInfra and other projects, we're building bridges to other blockchains now and in the future. Hive is an incredible blockchain for scalable, decentralized data storage. Its future lies in cooperating with other blockchains to adopt their ecosystems and tap into the wider crypto market.

LeoFinance and the LEO/WLEO token economy will be at the center of this expansion.

Test Lightning

We've already spent countless hours testing and fixing Lightning. It's been a rough project to develop, but the result has been 100% worth the effort. This project is essential for #projectblank and a few of the other key aspects on our roadmap.

Lightning may still encounter issues from time to time. If you spot any issues, please report them in Discord so we can deploy patches quickly and keep Lightning online.

Other Announcements

Lightning has taken a significant amount of focus to deliver, but we have a number of other projects being developed simultaneously. I'd like to take this time to announce that there are a lot of announcements that we will announce in the near future.

#projectblank development is currently the core focus as we try to roll it out in the next month. This project is massive and brings a level of content creation and interaction to the Hive blockchain that has never before been possible. In fact, we're currently developing a new solution for handling "Blanks" (think "Tweets") on the Hive blockchain.

As many of you know, ProjectBlank does not utilize top-level content. We've run through a few different ideas for handling "Blanks" (Tweets), but have finally come up with a solution that we think brings the best of both worlds. Lightning ;) fast speeds and immutable content on the Hive blockchain.

Much like Splinterlands did with custom JSONs on Hive, ProjectBlank will change the way you view content creation on the blockchain. Posts are just scratching the surface of what is possible and ProjectBlank will dive beneath this layer and create something entirely new.

The new LeoFi dashboard is also being developed right now. This new dashboard will introduce an entirely new use case for LEO POWER in V1 and will add cross-chain "DeFi" applications in subsequent versions. This will allow users to interact with the WLEO Geyser and other Fi applications we develop. The expected release date of LeoFi is roughly 3 weeks from today. ProjectBlank should launch around the same time, depending on the speed of our development and closed Alpha tests.

We're still working on the LeoFinance Whitepaper which outlines a lot of these projects and importantly, the future of LeoFinance. With every day that passes, this paper gets longer and more nuanced. Stay tuned for the announcements.

Update on Lightning:

30 minutes after this post went live, we had to roll back Lightning for a key performance update.

After making some significant changes and upgrades, Lightning is now back online, stable and faster than ever before ⚡️


Image from thread

LeoFinance is a blockchain-based social media platform for Crypto & Finance content creators. Our tokenized app allows users and creators to engage and share content on the blockchain while earning cryptocurrency rewards.

|        Track Hive Data           |           New Interface!               |          About Us          | |:---------------------------------:    |:-----------------------------------:    |:-----------------------------------:    | | Hivestats     | LeoFinance Beta     | Learn More     | |

Image from thread
Image from thread
Image from thread

|          Trade Hive Tokens              |        Wrapped LEO           |       Hive  Witness           | |:-----------------------------------:    |:-------------------------------:    |:-------------------------------:    | | LeoDex     | wLEO On Uniswap | Vote |

Image from thread
Image from thread
Image from thread

Posted Using LeoFinance Beta