Decentralised finance (DeFi) rocks! It is without doubt one of the most interesting and potentially disruptive technologies to arise out of blockchain and smart contract development. Once you start using it, it’s a no-brainer that DeFi is going to change the face of finance as we know it. Currently there is more than $50b total value locked (TVL) in DeFi, most of which exists on Etherium. In 2021 DeFi has also boomed on a number of other blockchains and layer 2 scaling solutions, including Binance Smart Chain (BSC), Polygon, Avalanche, Harmony and Fantom.
Cosmos aims to create an ‘Internet of Blockchains’, enabling developers to rapidly create and deploy their own smart contract blockchains using the Cosmos SDK, each with their own unique features, while sharing others, such as the Tendermint consensus algorithm. You may already have used blockchains built using the Cosmos SDK without knowing it. Some notable examples are ThorChain, Terra, Binance Chain, Akash, Kava, Secret Network, Crypto.com, SifChain and Osmosis.
Cosmos launched the Inter-Blockchain Communication (IBC) Protocol in February 2021. This enables Cosmos based blockchains to interact and communicate with one another. Osmosis is an Automatic Market Maker (AMM) and decentralised exchange (DEX) utilising IBC to enable cross-chain swaps.
Moving from a centralised exchange (CEX) into DeFi is a steep learning curve for new players. Part of this stems from the fact that the process is far from intuitive for people with no development experience. Setting up to start using DeFi applications on a new ecosystem is often not intuitive even for those familiar with DeFi.
This tutorial takes a user with no previous experience in using decentralised applications (dApps) step-by-step through the process of setting up a web3 wallet, making swaps and earning rewards by being a liquidity provider (LP) using Osmosis AMM.
1— Setting up and funding a Keplr wallet
For those who already have $ATOM in their Keplr wallet, you can jump ahead to step 2.
In order to interact with dApps you need a web3 wallet. Probably the best know web3 wallet for Etherium Virtual Machine (EVM) compatible chains is Metamask. Multi-chain wallets also exist such as Trust Wallet, MathWallet and xDefi. However in this tutorial we’ll be using Keplr, a Cosmos ecosystem web3 wallet. You’ll need to install Keplr extension within a supported Chromium based browser e.g Chrome or Brave. Unfortunately, there is no Keplr extension for Firefox at this time. You’ll also need to fund your wallet with some $ATOM.
1a — Install Keplr via the Chrome webstore
1b — Create a Keplr account
Click on Create new account which will take you through the process of setting up a new wallet by recording your 12 or 24 word Mnemonic Seed phrase (and checking that you recorded it correctly), choosing an Account Name and setting a strong password.
As with all crypto wallets, make sure you record your seed phrase offline only and keep it safe. The seed phrase is the key to accessing your assets within the wallet, and is what you’ll need to restore access to your wallet should you lose it for any reason, for example, if you lost your password or computer. Your password simply unlocks this iteration of your wallet, and is not required to restore access in the event of loss. It goes without saying that you should never make a digital copy of your seed phrase on any device not permanently air-gapped (one that has or will ever be connected to the internet). This includes taking a photo, or keeping a copy on your computer or phone. The seed exists within an encrypted file on your computer that is locked using your password. Should someone else get your seed phrase, they can restore your wallet and remove all funds from it.
If you have a Ledger hardware wallet you can connect it and use Keplr for interacting with dApps. This keeps the seed phrase hidden within a secure element on the device and requires you to physically approve each transaction by pressing a button. While less convenient, using a hardware wallet is significantly safer and recommended for trading anything more than small amounts of funds. You can find a Medium article explaining how to do it here.
1c — Deposit $ATOM to your Keplr wallet
Once you’ve set up a wallet in Keplr, you can now fund it with some $ATOM. The easiest way to do this is going to be by buying it on a centralised exchange like Binance or Kraken, and withdrawing it to your newly created wallet.
Within Keplr, make sure Cosmos is selected from the drop down menu at the top. Click to copy your wallet address starting with cosmos… under the account name you chose earlier. This is the address you will paste into the Recipient field when withdrawing from your CEX of choice. It should take a few minutes for the $ATOM to arrive in your Keplr wallet.
2 — Transfer funds to your Osmosis chain wallet via the Osmosis dApp
Osmosis - The Cosmos Interchain AMM
Osmosis is the first IBC-native Cosmos interchain AMM
Navigate to the Osmosis dApp Assets page using the above link, navigate down to Cosmos Hub — ATOM and click on Deposit.
Enter the amount of $ATOM you wish to transfer, click Deposit and approve the transaction in Keplr. This will transfer the $ATOM to your Osmosis Keplr wallet. I’d recommend leaving a small amount of $ATOM in your Cosmos wallet to use for gas in future.
Wait for the transaction to complete and refresh the page. You should now see the amount you transferred next to Cosmos Hub — Atom.
3 — Swap some $ATOM for $OSMO
Now that you have some $ATOM in your Osmosis wallet, you can use the swap function to get yourself some $OSMO tokens. Since this is Osmosis chain, you’ll need $OSMO to pay for gas each time to execute a transaction. However, as you don’t have any $OSMO yet to pay for gas you can simply set Fee to Low, and it’ll execute the swap for free.
Click Trade on the left. Select From ATOM, To OSMO (if they’re already there in reverse order you can simply click the up down arrows in between them to switch their positions). If you wish to provide liquidity you’ll need to have the correct ratio of each token to pool. You can provide liquidity to any of the available pools, but for the purpose of this tutorial we will enter the incentivised ATOM/OSMO pool. Enter half the amount of ATOM tokens you have, which will populate with an equal value of OSMO tokens, then click Swap. Confirm the transaction and wait for it to complete. You will now have some OSMO tokens in your Osmosis wallet. Going back to Keplr, if you select Osmosis from the drop down menu that previously showed Cosmos, you should see how much OSMO you have.
4 — Pool and bond tokens to start receiving rewards
Now that you have an equal value amount of both $ATOM and $OSMO you can pool them into the 50% ATOM, 50% OSMO pool to receive trading fees and LP rewards.
4a —Pool $ATOM and $OSMO
Click on Pools, and select Pool#1 ATOM/OSMO.
At the top of the Pool #1 page click Add / Remove Liquidity.
Type in the amount of $ATOM you have which will populate an equal amount of $OSMO, and click Add Liquidity. I’d recommend not pooling all of your $OSMO as you’ll need some in your wallet to pay gas. In my experience, while you can make swaps for free by setting gas fee to low, doing so when adding or removing liquidity may fail. Once the transaction completes you should now see the value of you LP tokens under My Liquidity.
4b — Bond your LP tokens to receive rewards.
Before you can start earning LP rewards you need to bond your LP tokens for a certain amount of time. Bonding means that when you wish to remove your pooled tokens, you’ll need to initiate a withdrawal and then wait the amount of time you bonded for prior to your tokens unlocking. You’ll still continue to earn LP rewards during the unlock period.
Within the Pool#1 page click on Start Earning on the right.
Choose the amount of time you wish to bond your LP tokens for. You’ll earn higher APR (annualised percentage rate) the longer you bond. These rewards are paid in $OSMO once a day and are currently quite juicy. Click Max to enter all your LP tokens and then Bond, approve the transaction and wait for it to complete. The value you have locked should now show up under Bonded on the pool page.
Osmosis forces liquidity providers to bond their tokens, and pays rewards in epochs rather than linearly (the timer for which is clearly visible). This incentivises longer term investing and reduces constant downwards pressure on the price of $OSMO that would otherwise result from farmers selling their tokens as they earn them. It also limits cascading price dumps, since anyone wishing to panic sell has to wait until their tokens are unbonded, during which time the price has time to recover.
You liquidity rewards are paid directly into your Keplr wallet, which is different from most DEXs which require manual claiming. To compound your returns I’d recommend returning to Osmosis once a day, selling half your earned $OSMO to the asset you wish to pool it with, and going through step 4 again to add this to your bonded liquidity. This will significantly increase the interest you earn over time.
Osmosis is a new AMM and DEX with plenty of potential. It is the first that I’m aware of that enables such seamless cross-chain trading within the Cosmos ecosystem. The first reward epoch has still not ended and there is already close to $30m TVL pooled, showing just how much demand there is for DeFi applications amongst holders of Cosmos based blockchain assets.
The interest that can currently be earned as an LP (as high as 5,400% APY) will come down over the coming days and weeks as more liquidity enters each pool and the rewards are shared amongst a greater number of participants. Like many things, especially in crypto, it pays to be early.
You can find out more about Osmosis liquidity mining and tokenomics in their Medium channel here.
Good luck farming and as always, do your own research. Long live DeFi!
Disclaimer: All views expressed in this article are those of the author and do not constitute financial advice.