The Avalanche ecosystem is one of the most exciting in all of DeFi right now. At the core of this excitement are its two groundbreaking innovations:
- Consensus level optimistic sampling, speeding up block production to levels that are expected to keep up with the masses
- A subnet with shared security architecture, which will enable a variety of application specific chains to emerge, each built with their own specific requirements in mind while maintaining integrity and security that rivals the default subnet
In this post, we’ll dig into how Avalanche works, some of the complexities associated with building on top of it, and how we rolled out our staking integration despite the challenges. We’re incredibly proud to partner closely with Ava Labs, Figment, and many other builders in the ecosystem to announce our release.
For a bit of context, Steakwallet is a self-custodial, multi-chain mobile wallet. Supporting more than 20 distinct L1 and L2 networks and boasting over 30 native yield integrations, Steakwallet is your entry point into DeFi and beyond.
The complexity that presents itself when trying to offer AVAX staking as a self-custodial wallet comes down to the fact that Avalanche is made up of a collection of separate blockchains, rather than one individual chain. This is all part of Avalanche’s approach to scaling – by eventually offering a multitude of application specific blockchains with easy interoperability between them, the protocol believes they will be able to sufficiently scale for global adoption.
Right now there are three primary subnets deployed, with new subnets being announced by up and coming teams every week. The contracts chain ("C-chain") is an EVM compatible subnet where all the DeFi on Avalanche currently happens. The C-chain can be used with most of the EVM compatible wallets and all the dApps you know and love on Avalanche. For example, Trader Joe, Pangolin, and Crabada have been built on the Avalanche C-chain. By offering a cheap and fast EVM compatible chain, Avalanche has been able to capture significant TVL in a relatively short period of time.
The exchange chain ("X-chain") is used for trading digital assets, such as fungible and non-fungible tokens. Rules can be constructed that constrain the usage of these assets in interesting ways – more information can be found in the official Avalanche documentation.
The platform chain ("P-chain") is strictly for consensus. Validators and delegators register their stake for a predefined set of time and earn rewards for doing so, provided their stake isn’t slashed.
How does AVAX staking work?
At Steakwallet, we pride ourselves on our signature 3-tap staking mechanism we’ve created for each supported yield integration, no matter the associated complexity. Now that we’re familiar with the C, X and P-chains, we can dig into how exactly delegation works on Avalanche. Given the natural starting point for most users is the C-chain, the first challenge for users is to transfer their C-chain AVAX to the P-chain.
Previously, this meant firing up the Avalanche web wallet on a desktop and interfacing with these chains directly, managing import/export transactions and approving each step manually. With Steakwallet, this is now nicely abstracted behind the staking flow you’ve come to enjoy in recent months. End to end, your Steakwallet makes three calls to the Avalanche C and P-chains to secure your stake:
- Export AVAX from the C-chain – this is done by submitting a specially formed avax.exportAVAX transaction to Avalanche; it’s important to note that this is not a smart contract call as one might expect on an EVM chain
- Import AVAX to the P-chain – using the unspent transaction outputs (UTXOs) for the account
- Delegate to the chosen validator – because the P-chain is so limited in functionality, constructing the delegate message consists of pulling the UTXOs for the delegator address on the P-chain before adding the AVAX asset ID, validator address, and signing it
Thanks to the fast block times Avalanche supports, this whole process takes less than ten seconds, ensuring users have an experience that is consistent with other interactions on the Avalanche network.
Once in a staked position, your AVAX is earning (at the time of writing) an APR of approximately 9.8%, representing a great way to earn yield on your AVAX without the smart contract risk associated with many other DeFi options.
Unlike many other staking integrations in Steakwallet or typical PoS networks, there is no concept of unstaking or undelegating in Avalanche. During the staking process, users choose for how long they would like to lockup their funds, and at the end of the delegation period, these funds (with any rewards earned) are distributed back to users.
After the delegation period for a stake is up, Steakwallet will send a notification prompting users to take action. At this stage, users can either re-delegate their stake, compounding their rewards and locking up funds for another delegation period (3 months), or withdraw their AVAX to the C-chain.
After rolling out the first mobile native staking experience for Avalanche, Steakwallet is excited to continue supporting the Avalanche ecosystem for years to come. At the time of writing, liquid staking support for AVAX (via Benqi’s sAVAX integration) is live, more yield opportunities are being investigated as they emerge in the ecosystem (veJOE anyone?), and we’re of course reserving engineering capacity to integrate upcoming subnets as they’re launched over the course of 2022.