Discover more from Kerman Kohli
How to Become a DeFi Developer
A entry level guide to how you can up-skill to become a developer in DeFi space
Hey all, this is a slightly different article but I hope it helps the next generation of developers attempting to get into crypto, but more specifically the DeFi space! If you know someone that might benefit from this, share it along!
In a similar time as now many years ago, people in my network started whispering the word ‘blockchain’. As I started digging deeper, I became more intrigued about what the whole fuss was about. Being an experienced iOS engineer/entrepreneur who had sold an app, the world of crypto was entirely different. It almost felt like starting all over again after specialising 8-9 years deep in a single stack. Nevertheless, I was up for a challenge and decided to dive in.
Fast forward 3 years later and I’ve founded two DeFi protocols and have a solid 3 years of Solidity experience with contracts that have handled tens of millions of dollars. I don’t want that to come across as a humblebrag, but rather a sense that within a pretty short amount of time as an experienced developer you can transfer your existing engineering skills to this new wild west of crypto/DeFi.
My motivation for writing this guide is to help present a conceptual framework of the knowledge you need to get up to speed so you can then branch off and use the existing resources out there to level up even faster.
Before you get into DeFi, you need to understand the abstractions and layers below that make this new “Wall Street” work. Presented below is a roadmap of the layers of the onion you need to unwrap before you can get into DeFi.
Body of Knowledge #1
Understand Bitcoin. Wait what? Before you do anything else your basic knowledge about how the very first Blockchain works and the fundamental concepts work. If you skip this step you’ll have lots of blank holes in your understanding — especially as you get deeper into DeFi applications and need to ensure the limitations & security risks.
Some good markers to test your knowledge would be if you can understand the following concepts and you could re-explain them:
Your wallet isn’t something you “hold” but rather a private key/seed phrase that authorises you to make transactions on the Bitcoin network. If you think that a wallet is something that’s stored inside your device, you need to go back and revisit your understanding.
What is a transaction and what makes a valid one versus an invalid one? Nonces, and UTXOs (inputs and outputs) are key concepts to understand here.
What is a block and how do blocks get constructed and then mined to become valid on the network? How do miners avoid mining the same transactions?
How do the incentives of the Bitcoin network ensure that someone can’t re-write the history or cheat their way? Understanding that ‘hacking’ the Bitcoin network is not only infeasible but counter productive since the act of doing it would destroy the price of BTC itself.
What are hard-forks versus soft-forks? Understanding Segwit2x and why it was controversial is a good crash course.
My two resources to answer the above questions are included here:
- Bitcoin Whitepaper: https://bitcoin.org/bitcoin.pdf - Understanding Consensus: https://www.youtube.com/watch?v=bBC-nXj3Ng4
Body of Knowledge #2
Now that you’re well versed with how a Proof of Work (PoW) blockchain works, the UTXO model and why Bitcoin is revolutionary in its thinking: the next step is to understand what makes Ethereum special and what advantages an Account-based blockchain has over a UTXO one. Ethereum was born out of the frustration do do more advanced things with the concept of a blockchain which Bitcoin wouldn’t add to their codebase.
The key thing I like to help people understand Ethereum is that it’s fundamentally a state machine. Each transaction is a request to update the global state of this meta-machine (which is actually powered by thousands of physical machines).
When understanding and getting up to scratch with Etheruem, the list of things to understand gets quite a bit bigger but is just as crucial to understand since this is the bedrock of modern day blockchain development:
Understanding how accounts work in Ethereum and the difference between an EOA and Contract. Most people think a smart contract as a “digital paper contract” that can automatically execute transactions.
Having a firm understanding of the Ethereum Virtual Machine, the role of Ether and how memory/storage works. Don’t worry if some of the super deep computer science concepts scare you. Take your time and keep re-reading till you feel like you have a base understanding of what’s being said. Leaving some details as abstractions is okay here.
How are Ethereum transactions constructed and broadcasted. The hardest part here is probably the role between gas cost, gas limits and the gas price. This is something that confuses users of the Ethereum network and will take you time to wrap your head around as well.
Getting a feel for how Solidity looks like and understanding the flow of Solidity -> ABIs -> Bytecode. Make sure you look carefully into ABIs since they’re your best friend when working with smart contracts.
Understanding the key differences between how sending a token works and how sending Ether to another account works. The nuance here is understanding that tokens are really just balances in a contract whereas Ether is a first class money citizen on the network itself.
Digging deeper into how transactions, logs, events and filters work. This is especially important if you want to build an application that reads data off-chain.
Getting to know what the limitations of full nodes, light nodes and archive nodes are + how to connect to them via Infura + Ethers.js/Web3.js. If you’re building a dApp this is going to be one of the first few things you get into. Bonus tip: learn about how Metamask injects Web3.js to your application. It’s ugly but it works.
Last but not least, you probably want to read a few pieces about smart contract security. It’ll show you some examples of why writing smart contracts is harder than anything you’ve ever done before given that they’re financial instruments at their core.
Keywords: DAO Reentrancy Attack, Parity Multisig Exploit 2016.
As always, the best way to learn about Ethereum is to actually build an application with it. Creating a single dApp from start to finish will help you
A history of the Etheruem network - https://www.reddit.com/r/ethereum/comments/7jj1so/rethereum_i_wrote_this_to_explain_ethereum_in/
Ethereum Beige Paper (a simplified re-write of the yellow paper) - https://github.com/chronaeon/beigepaper/blob/master/beigepaper.pdf
An extremely detailed guide about the inner workings of Ethereum - https://www.preethikasireddy.com/post/how-does-ethereum-work-anyway
Learning to write Solidity - https://cryptozombies.io/
Build your own decentralised applications (dApps):
My ultimate test for determining if you’re past this stage is that you can write a basic Solidity contract, create a simple front-end (React), can read on-chain data and write data back on-chain. Bonus points if you can read some event logs and show them on your front-end!
Achieving all of this is going to be very challenging but I promise the reward is worth it!
Body of Knowledge #3
Okay so now that you’re fully equipped with how the Etheruem stuff works, the next part of your education to learning about DeFi is understanding how finance works and the core pillars of it. If you’re an experienced developer who managed to crunch through the above, you’re probably going to find the below probably hard since it’s outside of your natural domain.
The reason why you need to know and understand these concepts at the back of your palm when becoming a DeFi developer is because you’re literally a financial engineer. If you don’t understand the underlying thing you’re developer for you will almost most certainly lose money. Not only will you be creating security bugs, but you’ll also probably have a skewed understanding of how DeFi works and what products users want/need.
Okay enough warnings, let’s jump in. As a financial engineer, you need to understand and be able to re-explain the following terms if your mother asked you about them:
Liquidity. What is it and why does it matter?
Fixed/variable interest rates. What are the advantages and disadvantages of them in the traditional financial world?
Debt. What forms of debt are there and why do different people use it? Credit card debt is one form you’ve heard of but understanding why companies take debt worth billions even when they have plenty of cash.
Leverage. What is it, why do people use it and what are the dangers? Understanding the mechanics of what happens when you use more money than you hold is literally 50% of DeFi.
Margin Trading. What is it, why do people use it and what are the popular venues for margin trading in crypto?
Order Books. What are they, how they work, what are depth/volume/bids/asks/limit orders etc. Plenty to go through here. Best is to experiment trading with real money.
Options. If you can understand these with ease you’re probably financially literate enough to understand all of the above and can move on. If you don’t get options, you can revisit them later but don’t leave them out since they are an emerging area in DeFi.
I won’t be linking resources to understand the above terms since there’s already plenty out there but if you want to really understand more about finance I highly recommend the following:
A primer on why we need finance and why it helps the world: https://www.goodreads.com/book/show/30971680-the-wisdom-of-finance
Watch “The Big Short” (2015). Yeah not even kidding here.
Body of Knowledge #4
Alright savvy and committed future DeFi developer, congrats on making it this far. No seriously, you’re so close to reaching the light at the end of the tunnel. The final stage in your education is about learning how the existing DeFi applications work by:
Reading the whitepapers or blog posts around their inner workings and what they set out to achieve
Using them. No seriously, use them.
Checking out their code on Github to understand what’s going on underneath the hood
If you want to skip any of the three, don’t skip #2 whatever you do. Until you use DeFi applications you’ll never be able to develop for them. Best thing to do here is to buy $1,000 worth of ETH and treat it as tuition money that you’ll most likely lose. So what’s the list of applications you say? Here’s a list of tasks for you tod.
1. Trade on an AMM
How token approvals work
How liquidity pools work (https://www.youtube.com/watch?v=Ui1TBPdnEJU)
What is front-running and the risks?
Setting the correct gas price
2. Become a Liquidity Provider
What it means to be a liquidity provider and the trade-offs
Understand what impermanent loss is (https://www.youtube.com/watch?v=41WVTwmSPng)
Get to learn how providing liquidity can earn you passive yield
3. Open a MakerDAO Vault
Why DAI as a stablecoin is unique/different to anything else out there
The motivations for someone to mint DAI with their crypto assets
The risks of using a platform like MakerDAO from a financial leverage point of view
Understand what are liquidations and how they work
4. Borrow USDC via Compound
Understand that when you lend to Compound you get “cTokens”
Learning how interest rates work and interest accumulates to all balances without updating each user individually
Understanding what the collateral factor is and the risks associated
Learning the differences between Compound and MakerDAO
If you manage to get through all of the above with decent proficiency, congratulations! You’ve literally now ready to start developing your own DeFi apps. If you need help with any of the above, I’ve spent the past year creating videos to help me understand all of these topics and can probably help you as well: https://www.youtube.com/c/DeFiWeekly
Developing in DeFi
As a general statement, all the basic things from TradFi (traditional finance) have been ported over into DeFi. The next leg in DeFi will be new things and involve a combination of:
New novel financial instruments that don’t exist (merging primitives)
The integration of more novel assets with different characteristics (time decay assets)
Figuring out how to map DeFi to NFTs
Developing on new emerging chains (Ethereum is where all the DeFi activity happens but opportunities on other blockchains is unchartered territory)
Creating interfaces to help understand the complex activity of on-chain data
Furthermore, you probably want to take time to understand all of the recent DeFi exploits that have happened in 2020 + 2021. Keywords: flash loan attacks & token re-enterancy are your best friends here.
Money markets, exchanges and asset management are highly competitive spaces where you probably shouldn’t go for unless you have a novel insight on how to improve them. If you’re going to enter the DeFi arena you have a few presented options:
Join an existing DeFi venture full time that can show you the ropes and learn on the job. Arguably lower risk and perfect to learn the ropes.
Launch your own DeFi venture. This can be great to level up your technical skills very quickly although navigating the market structure will be a challenge and cause issues if you want to make it into a venture (speaking from experience here).
Figure out an idea and keep hacking on it with the expectation that it’ll take many months, maybe up to a year to be worthwhile. Some of the biggest projects in the space started off this way! There’s plenty of ETH Global hackathons you should check out here.
Become a contributor in a community. and help out with whatever they need help with. Since crypto is all about community if you can volunteer your developer skills there’ll be all sorts of arrangements you can get into. The easiest comparable is being a contractor in the real world.
All of the above paths are viable, each engineer will have something that’s suited to them. If you’d love to be join something existing and be paid to learn, we’re actively hiring at ARCx. Reach out to me at firstname.lastname@example.org with your details to learn more.
Congratulations on reaching this far and reading through all of this. This guide was meant to be a rough roadmap to get you to basic comprehension however it will probably feel a little outdated over time. If I get enough messages in the future I’d be more than happy to have an updated/part 2 version of this.
Your journey to becoming a DeFi developer won’t be just about engineering but also the friends and people you meet along the way. Always have an open mind, especially to things that seem crazy and impossible on the surface. Have fun and enjoy the ride, the next few years of your life will be consumed in this rabbit hole we’ve come to love as crypto.