Product Evolution from an idea to an app: 0 to 1. Contributors united!

Gearbox Protocol ⚙️🧰
Gearbox Protocol ⚙️🧰
12 min readNov 25, 2021

GM everyone!

Don’t you find it super interesting to know why and how products do pivots and prioritize certain features? If you see how tradeoffs and decisions were made, you can really understand the overall design. And it has been quite a journey. Together with early contributors, testers, and community members — Gearbox Protocol and Gearbox App have undergone quite a few changes. Today we want to explain all major iterations. Let’s go!

ps: go test the app now to get ready for the mainnet deployment…

1. Prequel: margin trading on Uniswap @ ETHGlobal.

Gearbox Protocol started at MarketMake hackathon run by ETHGlobal in January-February 2021. Here is another article. (writer note: I have actually never seen this article before, randomly found it in Google… hello, frogs?)

What was the idea back then? A margin trading protocol for Uniswap, but with a twist. Instead of creating your own secondary market liquidity and order books, liquidity would be sourced directly from Uniswap pools. This would potentially solve early issues with liquidity as it wouldn’t require to balance both sides of the book. As such, “no funding rates” became quite an interesting point in conversations as Gearbox was not responsible for long/short ratios either.

Note: this might resurface if Gearbox Protocols starts fuelling a double digit percentage of overall volumes to other protocols, in which case some oracle and LTV questions would need to be addressed. See other disclosures in the docs.

The protocol demo worked: it allowed trading on Uniswap with 4x+ leverage. Mikael built it by himself and got to the finals, having received a lot of feedback from other participants and lurkers. That made him realize that leverage trading on DEXes in a permissionless way was cool to continue with.

1st interfact iteration: margin trading on Uniswap

The interface itself didn’t let you choose where or how you trade though. It wasn’t even aimed at other DEXes. It was just “leverage trade on Uniswap” as a tool. As such, the interface didn’t need any complex choices, it had only (1) supply capital as LP and (2) trade in a Uniswap-style interface. Dummy-dummy.

First Contributors Getting Together

In February, Ilgiz came across the project as a possible investment and shared it with ivangbi. After the first call they got so impressed with the idea and had such good vibes that they actually started working together.

Then in March, after getting the architecture and math together, core builders reached out to DeFi founders and builders across the space. Many have positively responded and fell in love with the narrative. They gave feedback on the product, on the competitive advantages, on the way to best approach the user base… those were the first external contributors — over 30 contributors continuing to help Gearbox develop from every angle.

So what came out of this? Let’s go step by step…

Inside the rabbit hole of leverage

While talking to farmers and DeFi teams, we have seen a few distinct traits when it came to why people liked the idea of Gearbox Protocol. First of all, potential users (note: “potential”, because there is no PMF in Gearbox yet and nobody knows what it actually could be) wanted a truly 100% decentralized experience with no KYC. That was the ethos with which Gearbox Protocol started with, so that was a clear “yes”.

Then, users wanted to have access to more assets and higher leverage. Naturally, that is what users ask of lending protocols and CEXes all the time, but it’s not as easy to solve as it requires deep order books. In the last year, liquidity across the board has majorly increased, so leverage on centralized exchanges was easily enabled for many random assets (that was previously really hard in 2018–2020).

When it comes to DEXes though, in a truly decentralized architecture, the question of liquidity also comes with the question of reliable oracles. Rari Capital has introduced isolated lending environments, while Euler wants to enable long-tail assets. It’s something in the works, so it’s a “yes” as well.

But was that it? Seems too easy… And you are right. There was much more.

2. Stables allowing for higher leverage.

If the operations are routed externally on Uniswap, why not let them route via Sushiswap? Ok, but then why not include other protocols? At this point, Michael Egorov from Curve Finance [🙏🧰⚙️] suggested that such a protocol can be applied to leveraged stablecoin trading-farming as well, and at a much higher leverage of 10x+ given that the stablecoin fluctuations (read: non algo-based ones) are minimal. And here we go: Gearbox Protocol at this point could leverage trade stablecoins as well, not volatile assets only.

Note: Michael Egorov was also very persistent in making us realize that we need to go through fuzzle testing. We obeyed. Looking back, it has already been instrumental as we have gone through it. Info on audits will be here.

Stables and pegged assets allow one to do this, fyi:

3. Not about Uniswap, but for any protocol. Generalized Leverage.

Note: some have called it credit, but we don’t feel like credit is the right word here for the protocol itself, because the protocol is overcollateralized at all times and functions on math instead of some personalized scoring system.

The ideas for generalized leverage came out of our first discussions with Jon Itzler from Variant Fund [🙏🧰⚙️] and Christopher from 1kx [🙏🧰⚙️], who saw the interface and were like “hmm, hard to get users to your own UI though… vendor locking is never cool. Can you not turn it into a primitive and let other developers and teams build on it / with it?Larry Cermak [🙏🧰⚙️] confirmed their ideas too.

It’s kinda ironic that the way they ended up with such ideas was more so due to the core contributors being very bad at explaining the protocol — so they asked “why vision so smol”? And it was smol. So could we change it? Yes we could, and yes we did! What ended up is what you see today.

Note: already back then in spring 2021, the final protocol design contracts-wise was set up. After that, the changes mainly occurred to the tidiness of the code and the security improvements as we set on a 4-month journey auditing the protocol and improving its security with the top firms.

Credit Accounts as an Uber-like renting model

Deploying a Credit Account for every user every time was quite a costly procedure, easily exceeding 1 million in gas… It’s hardly usable! We fixed this with an architecture similar to how Uber works: pre-deploy a factory of Credit Accounts and give them to users. This renting design ensures that a user doesn’t need to deploy and pay for gas fees every time. As such, we don’t clog Ethereum when an account gets closed and basically thrown away. Users can open an account by essentially renting a smart contract from the protocol and then giving it back when they close their positions. Elegant, isn’t it?

You shall later learn about it as a Credit Account Mining ceremony…

Note: scalability questions aside, Gearbox Protocol requires a robust and liquid DEX ecosystem to build on top of, as all trades are routed via third-party protocols. While other chains, sidechains, and rollups are still in the stage of growing — Ethereum mainnet is the only viable option right now. However, going multichain one day makes a lot of sense. DAO shall decide this.

From protocol design to interface experience

The architecture of Credit Accounts allowed for a very generalized architecture which turned Gearbox Protocol into a primitive for other developers and teams to utilize and to integrate with. Therefore, the interface had to be adjusted for these needs. How does one solve this chicken and egg problem, where the protocol is supposed to be complex and super versatile, yet users can easily understand and do what they like — aping in?

4. Battle-testing the interface: frontless (d)App

In the first major UI iteration, you would choose what application or protocol you wanted to operate with after opening your Credit Account, and then trade there. We called this concept mini-apps as they were simple forks of native interfaces of those protocols with the added functionality of connecting to Gearbox Protocol’s Credit Accounts.

2nd iteration: Credit Account with choices

On the backend, it simplified how any protocol dev team could integrate Gearbox Protocol leverage button to their own UI. However, on the frontend it was not as intuitive for normal users. It would prompt you to connect to a new interface every time in web3. Moreover, it would require Gearbox to make different interfaces for each protocol when whitelisted. That basically means a lot of work for users, and a lot of work for contributors. Hardly an ideal situation.

  • Assumption: a user can decide what they want to do;
  • Reality: this was too much to burden a user with, needed to be simplified. Users are used to coming to a page and just clicking a couple of buttons.
2nd iteration: each protocol had its own “Gearbox+XYZ” tab with a forked 1:1 mini-app interface.

Looking back into the mini-app idea, the goal was to let users understand that Gearbox is not about leverage trading. It’s about getting leverage in a generalized way and then using it for anything they want. On any app they want. Without the need for a Gearbox App. But the interface implementation turned out to be very unintuitive. What do?

When speaking to Anton Bukov and Mikhail Melnik from 1inch [🙏🧰⚙️], they pointed out to using Wallet Connect in order to achieve the same idea… and it was done! Anton and the 1inch team didn’t suggest just that: they also gave tips on the most optimal collateral value checks, and gas optimizations in general! Thanks to Pedro Gomes and Wallet Connect team too [🙏🧰⚙️]

What is happening here: you are connecting a Gearbox Credit Account with x4+ the money you usually have to a regular Uniswap. And you use that regular familiar Uniswap interface. As a user, you do all the things you are used to and love, but you do so with x4+ capital size!

Wallet Connect allows Gearbox Credit Accounts to connect to other applications and essentially let a user forget they have ever changed their experience. You can use native Uniswap, Sushiswap, or any other interface but do operations via your Credit Account! This solved yet another problem: smooth addition of new whitelisted protocols to Gearbox App: it requires no work whatsoever! (lazy devs exhale)

What about the users who really just want to press “long ETH”? We did not think that “degrading” the UX into such features would make sense for the protocol. People would get a really wrong idea of what Gearbox Protocol is. So when speaking to Nodar from Zapper [🙏🧰⚙️], he suggested using the idea of ZAPs more. As such, we ended up with leverage actions which are an interface-shortcut to opening your Credit Account quicker. Note: they are currently discontinued due to a few changes pending, but will likely be back soon. The contracts for them were already audited too, but the UI requires modifications.

5. The launch version: fixing the final bugs

3rd iteration: in-built router and Wallet Connect

So we ended up with what you see today, a hopefully more streamlined experience. Based on the 2–3 months testing period, we have received feedback that the current version is pretty alright for new users. The thing is, we can’t know what is right because only real live testing can show which direction the interface has to go.

The current app at launch would allow you to:

  • Do trades in a familiar way right on Gearbox App after opening a Credit Account, whether by using the in-built router to choose a path for you, or by forcing the app to take the path you want. You can always fix for slippage in the settings button.
  • Use Wallet Connect to connect your Credit Account to another DeFi application and use those native applications you are already used to. But with x4+ efficiency!
Leverage Sensei taught many new students, make sure to not miss out.

ps: go test the app now to get ready for mainnet deployment…

More contributors, more big brains helping [🙏🧰⚙️]

Some early protocol ideas were brought forward by Andre, who has been an amazing friend and shared his code and ideas on the leverage tools he built before. In general, YFI family have been incredibly supportive with words, actions, capital, and experience. Thanks to Klim & bunny banteg

Over numerous calls, we kept refining our vision for the product with Konstantin Lomashuk from Lido / P2P when talking about how to get to the users and what to focus on at first. Moreover, Stani (who saw the project super early as he was one of the judges) & Ernesto from Aave shared amazing insights when it came to how liquidity pools and their security should be constructed, as well as their feedback on oracles and collateral handling.

[🙏🧰⚙️ ]Allan from Yield also actively supported us with product feedback and sharing very interesting ideas on what models should be tested. Charles from Element Finance and Nik from MakerDAO (and MakerMafia gang in general, aka the DeFi cardinals) not only battle-tested the app, but also provided incredible feedback for the governance structure of the future protocol. We also can’t forget Kartik Talwar who has been there with Gearbox as an idea from literally the first days. He has been helping even with such small things as product pitch refining before Ilgiz & Ivan even joined.

[🙏🧰⚙️ ]DegenScore team have been one of our new best friends helping both with the UI ideas and getting to the right market of community members and testers. Fiskantes from Zeeprime and Elias helped with product testing and strategy ideas, hedgehog & egirl team as well as Igor from The Block with amazing h̶e̶n̶t̶a̶i̶ p̶i̶c̶t̶u̶r̶e̶s̶ detailed reports on the UX. Santiago with great product growth ideas and token economy related discussions, Anthony from Encode with developer outreach, [redacted] working on the liquidator bot with their awesome team. Degenerates Darren and Daryl with product testing and insightful comments for the strategy … And others (this is the first time Fiskantes didn’t actually end up in -the others- section probably).

The shoutout to security researchers and other contributors will come in later stages, for now it was all product & architecture related. Thank you ❤

Credit Accounts integration is super easy now

Gearbox Protocol value proposition has shifted from an end-user solution for margin trading — to an infrastructure lawyer, which provides leverage as a service. Now it could be considered as a primitive that increases capital efficiency for any DeF protocol which goes through the DAO.

Gearbox is created by developers and for developers. We made integration process as simple as possible: you should write a simple contract called adapter, DAO approves the integration and it’s done. You protocol immediately starts to work with “x4+” cheques and new users!

No need to make any interface and dApp changes, Gearbox App could be connected with yours via Wallet Connect and provide native experience for your customers with leverage. We are so excited to see what creative devs could build with Gearbox tomorrow…

Speaking of Gearbox DAO, that is not far away from now…

JOIN DISCORD

Docs | Twitter | GitHub | Website | Discord

Note: [🙏🧰⚙️] means = “big thanks ser for ur help”

--

--

Gearbox Protocol ⚙️🧰
Gearbox Protocol ⚙️🧰