dYdX
Market Recap
Volatile Week For All Assets
dYdX
Over the past few articles, we have covered a few essential activities in Decentralised Finance (DeFi), including exchanging with Uniswap, earning with Aave, yearn.finance and MakerDAO and staking with Lido. This week, we will explore how to use dYdX, the decentralised exchange, to participate in spot, margin and perpetual trading.
What is dYdX?
dYdX is a non-custodial, permissionless decentralised exchange powered by Ethereum that supports lending and borrowing and margin and perpetual trading.
dYdX was founded in 2017 by Antonio Juliano, an ex-Coinbase and Uber engineer. The initial launch of v1 was on Ethereum, and it supported lending, borrowing and margin trading. This launch marked a huge step forward for DeFi; before this, it was only possible to take out margin while trading on a centralised exchange like BitMEX.
Juliano also realised that there were shortcomings in only being able to trade on the Ethereum mainchain, most notably speed and cost. Therefore, in 2020 the announcement was made that dYdX would be moving its operations onto an Ethereum layer 2 scaling solution with the help of StarkWare, a ZK-Rollup solution. In the April of 2021, dYdX launched the layer 2 product to the public. With the move, dYdX now offers users faster trades with negligible gas fees, lower trading fees and a reduced minimum trade size, and they also offered users the ability to trade perpetual contracts. The exchange now combines the transparency and security of a decentralised exchange with the speed and functions of a centralised one.
In addition to this, in August 2021, they also launched a governance token through an airdrop to users of the platform. The dYdX token gives holders certain rights such as voting on the protocol decisions as well as discounts on trading fees.
How Does dYdX Work?
To understand how dYdX works, you need to understand what margin and perpetual trading are.
Margin Trading
Margin trading is a method of trading that involves borrowing funds; it essentially allows you to access greater sums of capital to leverage your position. This money is usually borrowed from a broker, and you are required to put up the other assets in your account as collateral in case your position goes against you. Buying on margin can carry significant risk if you don't understand what you are doing. There are many horror stories of people taking out too much leverage and losing their whole account when the market moves one or two percent against them.
Perpetual Trading
A perpetual contract is a special type of futures contract. A normal futures contract is an agreement to buy or sell an asset at a predetermined price at a specific time in the future. When the contract is initially entered into, there is no exchange of assets; this will happen at the specified time in the future when both asset and cash (or another asset) are exchanged (settlement date). This essentially allows a trader to bet on the price of an asset, whether it will go up or down, without having to actually own the asset at that point in time.
A perpetual contract is slightly different from the above in that it doesn't have a settlement date. Traders can therefore hold the position as long as they like; however, they have to pay a funding rate (effectively an interest rate + a premium). Who pays this funding rate is determined by where the futures contract is trading, either above or below the spot price. If the contract is trading above spot, longs have to pay shorts due to a positive funding rate and vice versa.
dYdX Funding
So now that you understand what margin and perpetual trading are. How do dYdX offer margin and perpetual contracts? Well, dYdX has its own internal crowdsourced liquidity. Where more traditional centralised exchanges have a broker supplying liquidity, dYdX's comes from other traders/users. As a user, you can deposit your assets into the protocol, and those looking to margin trade can borrow from the global liquidity pool. The risk as a lender here is that the dYdX smart contract doesn't liquidate a user when they have reached their collateralisation ratio, which is similar to the other lending markets we have previously explored.
How To Use dYdX
dYdX can be used for different things. Two core uses are trading and earning a yield by supplying liquidity to the global liquidity pool. In this guide, we will show you how to do both.
Trade on dYdX
You will be trading on the dYdX layer 2 rollup solution, and because of this, you are required to migrate your capital from the Ethereum mainnet to the StarkWare ZK-Rollup.
Step 1: Set Up MetaMask Wallet
In order to interact with Ethereum and its layer 2's, you require a wallet. Our wallet of choice is MetaMask, but you are free to choose your own. Please find our guide to setting up your own MetaMask wallet here.
Once you have set up and funded the wallet, you can now use dYdX.
Step 2: Visit the dYdX Website
Visit the dYdX Website
Make sure you land on "https://dydx.exchange/"
Click Trade in the top right hand of the screen
You should see the below page:
Step 3: Connect Wallet
Click Connect wallet
Enter your MetaMask password when prompted
If you have read through and agree with the terms and conditions click, I agree
You will now be prompted to link your wallet and start generating a Stark Key
Click Send requests
You will be required to sign two transactions in your MetaMask wallet
Please note that this will be required every time you use dYdX unless you click Remember me. However, this should only be done on a secure computer that no one else has access to
Step 4: Set Up Account
You will now have to set up your account:
Enter a username and enter your email
You can also decide on what type of communications you want to receive from dYdX
Click Set up account
You will be required to verify your email. Please do this in the meantime
Next, click Deposit funds under the Open Positions heading, about halfway down the page
The below should pop up:
You can see a list of all the available assets that you can deposit and trade under Asset
You will be prompted to approve the asset if it is the first time you are using it on dYdX
Click Enable XXX (in our case, it is USDC)
Please bear in mind this will carry a gas cost; if you are happy with it, please proceed
The gas cost involved with moving between the Ethereum mainchain and the rollup can sometimes be expensive. To incentive users, dYdX will subsidise this transfer's cost if you transfer a minimum amount. For USDC, this is $500, and you can do it once every three days
Step 5: Confirm Your Deposit
Once you have decided on how much you intend on moving across, click Confirm deposit
Whenever prompted, click "Confirm" to sign the transaction on MetaMask if you are happy with the gas fees.
The transaction may take some time, so be patient (10 block confirmations). However, once this has gone through, the token will now be in your account on the rollup, and you can start trading.
Please always remember that trading with leverage carries a high degree of risk and should only be done if understood.
Add Liquidity To dYdX
You can earn rewards by supplying liquidity (in USDC) or staking dYdX in the Safety Pool with dYdX. The dYdX Foundation manages this, and so the process is different to the above. However, you will still require an Ethereum wallet, so if you have done that, you can skip to Step 2. Before this, it is always essential to read through the risks involved with staking and understand how it differs from some of the more traditional money markets we have previously dealt with.
Step 1: Set Up MetaMask Wallet
In order to interact with Ethereum and its layer 2's, you require a wallet. Our wallet of choice is MetaMask, but you are free to choose your own. Please find our guide to setting up your own MetaMask wallet here.
Once you have set up and funded the wallet, you can now use dYdX.
Step 2: Visit the dYdX Foundation Website
Visit the dYdX Foundation Website
Make sure you land on "https://dydx.community/dashboard"
You should see the below page:
Step 3: Connect Wallet
Click Connect on the top right-hand side of the screen
Under Staking, you will see the USDC Liquidity Pool
Click Stake
If you have read through and agree with the terms and conditions, click I agree
You will be prompted to approve the asset if it is the first time you are using it on dYdX
Click Enable USDC
Please bear in mind this will carry a gas cost; if you are happy with it, please proceed
Step 4: Confirm Your Deposit
Once this has been approved, and you have input how much you want to Stake and earn rewards on, Click Stake funds
Whenever prompted, click "Confirm" to sign the transaction on MetaMask if you are happy with the gas fees.
This transaction can take some time, so please be patient. However, once it is approved, you can now view your dashboard and get an idea of the rewards you stand to earn and monitor your position.
Conclusion
Using these networks is the best way to learn about them. It shows and allows you to understand what blockchain networks are capable of. Each has its own unique advantages, disadvantages and user experiences.
If you look at dYdX as just a trading platform, what it can do is not very different from many exchanges. Nevertheless, what they have achieved in a decentralised manner is significant. They have managed to use blockchain technology to deliver a high-performance trading platform at a low cost while inheriting the security of the Ethereum blockchain.
If you have any questions or have trouble using the network, please feel free to reach out and ask us questions. We always look forward to chatting with our readers. Otherwise, please feel free to share this article if you know anyone who is interested in using these networks.
Notable Articles and News Stories This Week:
Aave Launches Alternative to Traditional Social Media
Software development company Aave has launched its Web3 social platform powered by NFTs that aims to be an alternative to traditional social media platforms.
Called Lens Protocol, the open-source tech stack allows developers to build Web3-powered social media apps, marketplaces and recommendation algorithms.
Social media has remained relatively unchanged over the last decade due in part to user content being owned by a company, Aave CEO Stani Kulechov said in a statement. Elon Musk's bid to purchase Twitter shows people are ready for a better experience, he added.
"Lens will be the infrastructure that will give rise to the golden age of Web3 apps," Kulechov told Blockworks. "For the first time since the internet has been born, people can finally own their accounts and all of their content without an intermediary."
Read more about the move here
China Reemerges as Top Mining Hub a Year After Blanket Ban
New data on global bitcoin mining released by the Cambridge Centre for Alternative Finance (CCAF) on Tuesday suggests China has reemerged as one of the world's leading bitcoin mining hubs.
The research, obtained in collaboration with mining pools BTC.com, Poolin, ViaBTC and Foundry, reveals how China is now placed second behind the US almost a year after the Chinese government cracked down on major domestic operations.
China has reemerged as a major mining hub to lead ahead most with a 21.1% mining capacity, followed by Kazakhstan (13.22%), Canada (6.48%) and Russia (4.66%). The US, meanwhile, has firmly established itself as a leader with a 37.84% share of total hash rate activity.
Read more about the story here
Ethereum Merge Coming in August 'If Everything Goes to Plan': Core Dev
Ethereum core developer Preston Van Loon told a panel at the Permissionless conference today that there's momentum behind finalizing the move in the next three months.
"As far as we know, if everything goes to plan, August—it just makes sense," said Van Loon. "If we don't have to move [the difficulty bomb], let's do it as soon as we can."
Ethereum Foundation Justin Drake, also on the panel, noted there's a "strong desire to make this happen before [the] difficulty bomb in August," according to a tweet from event co-host Bankless.
Read more about the merge here
Whilst we all have the option to look, to seek to understand, it’s often easier not to. Bitcoin, Ethereum and distributed ledger technology are complex systems that require significant due diligence. At Etherbridge, we aim to lower the barriers to understanding this fast-growing digital economy.
If you are interested in staying up to date, please subscribe to our newsletter at etherbridge.co
This is not financial advice. All opinions expressed here are our own. We encourage investors to do their own research before making any investments.