Hub and Spoke Model: An Overview
When it comes to crafting DeFi apps, you’ve got two main blueprints to choose from: 📐
- The Point-to-Point Model 🔄
- The Hub and Spoke Model 🎡
For our cross-chain borrow-lend app, we’re going with the Hub and Spoke model. But before we dive into that, let’s get a quick rundown of both! 🏃♀️
🎯 Understanding the Point-to-Point Model 🎯
In the Point-to-Point universe, here’s what you need to know:
-
Chain Autonomy 🌐: Every chain is its own boss! They all have the same functions and can operate solo, without needing a central hub to hold their hand. 🤲
-
Peer-to-Peer Accounting 📊: No middleman needed here! Chains can directly keep tabs on each other’s transactions. It’s like having a direct chat instead of a group conversation. 🗨️
-
Home is Where the Asset Is 🏠: Your assets stay put on their native chains. No need to wrap them up or change their form to interact with other chains. 🛒
-
Wormhole Chit-Chat 🪐: The system uses Wormhole messages as the main line of communication between chains. These messages keep everyone on the same page, making sure the accounting across chains is in sync. 🔄
And there you have it! Below is a schematic to help you visualize this design: 📊
🤔 Challenges with the Point-to-Point Model 🤔
The point-to-point model sounds great, but it’s not all sunshine and rainbows. 🌦️ Here are some hurdles you might face:
-
Rollercoaster Interest Rates 🎢: When you’ve got assets and accounting all over the place, keeping track of ever-changing interest rates can get tricky.
-
Timing Troubles ⏱️: Without a central hub to keep things in sync, you might run into timing issues, especially if Wormhole messages aren’t processed right away.
-
Scattered Liquidity 💦: Your liquidity could end up like puzzle pieces scattered across multiple chains, making things less efficient and user-friendly.
🎡 Exploring the Hub Model 🎡
Switching gears, let’s talk about the hub-and-spoke model. Here, the hub is the star of the show, acting as the central accounting or liquidity manager. 🌟
Different spokes (think of them as mini-chains or apps) chat with the hub, sending either accounting updates or wrapped tokens when there’s movement. 📨
Why go for the hub model? Well, it’s got some perks:
-
One-Stop Accounting 📚: All the number-crunching happens on one blockchain, making updates seamless.
-
Liquidity Central 🏦: By pooling all the liquidity in one place, the hub model makes for a smoother user experience.
🛠️ Workflow of Protocol Operations 🛠️
-
Meet & Greet the Spoke 🤝: First off, you’ve got to introduce your spoke contracts to the hub. This is like getting a VIP pass that lets you deposit assets into the spoke, which the hub then acknowledges.
-
The Deposit Dance 💃: Users can deposit assets from different chains into the hub, making it the go-to place for all things financial.
-
Borrow & Payback Time ⏳: Once you’ve got your assets in the hub, you can borrow from various chains. And of course, what you borrow, you must return!