Substake is a Cross-chain Liquid Staking solution that is a boon for people wanting to participate in liquid staking from the funds on L2s. Substake allows users to deposit their wrapped tokens on L2, which our platform bridges to L1, and then stakes on the Liquid Staking Derivative platform like Lido, Rocket Pool, and Stader Labs. It is highly gas-effective as the bridging cost from L2 to L1 is significantly low. And then, for the staking purposes on L1, we lower the gas fees further. This happens through the creation of batches on L2s. Let's see how this works.
First, let's understand the stake flow. In the stake flow, users deposit their funds in our platform and receive a representational token called SubToken. These deposit funds are accumulated in a batch, and when the specified conditions are met, the batch is dispatched to L1. Whatever gas fees appear are equally distributed among the batch members, significantly reducing it. Now, after this bridging of tokens, they are staked on the LSD platforms of L1, providing them with a regular APY without individual hassling among different chains. And there, too, the transaction costs are partitioned among the batch members. So, this gets as efficient as it may. The protocol stores the thus created wstETH (in the case of Lido).
Secondly, we perform the unstaking of native tokens in a similar fashion. The users deposit their Subtokens, a batch is created, and the batch is dispatched after meeting the specific conditions. Accordingly, the wstETH is swapped for wETH and transferred to L2 for distribution.
So, Substake reduces your gas hassles and provides you with a regular APY through your L2 funds.
While working on this project, I encountered a notable problem that initially seemed to need clarification. The major problem was understanding the messaging protocols of different L2 chains. We explored CCIP, Polygon zkEVM, Base, Arbitrum, and Scroll. We worked on Scroll due to the native bridging of tokens that was available, as that felt more familiar than others.
Another major challenge was implementing the batching architecture, which involved deep thought and fine-tuning architecture for implementing the solution. We had to test for multiple batching algorithms, and it was quite cumbersome.
The exchange rate calculation between our Subtoken and the wstETH was quite complex. Data indexing was a huge problem as finding relevant APIs for listening to events on different chains and testnets took a lot of work.
Discussion