DEX Lesson Plan
Here is a 5-Day Lesson Plan for learning to use a cryptocurrency Decentralized Exchange (DEX).
This 5-day lesson is designed for aspiring blockchain developers with some coding experience. By the end of the week, participants will be able to trade on a DEX using a command-line script. Each day includes three core components:
Day 1: Introduction to DEX and Blockchain Foundations
Keywords
Reading
- CoinDesk: What is a Decentralized Exchange (DEX)?
- Investopedia: How Do Automated Market Makers Work?
Hands-on Lab
- Objective: Set up a local development environment for blockchain interactions.
- Tasks:
- Install and configure a blockchain development environment (e.g., Hardhat, Truffle, or Remix).
- Install a crypto wallet (like MetaMask) and create a seed phrase for testnet usage.
- Create and fund a wallet on a testnet (like Ropsten, Rinkeby, or Sepolia) using a faucet.
- Write a simple script to connect to a public blockchain API (like Infura or Alchemy) and check wallet balances.
Day 2: Wallets, Private Keys, and Secure Interactions
Keywords
Reading
Hands-on Lab
- Objective: Automate wallet creation and secure key management.
- Tasks:
- Write a script (using Web3.js or Ethers.js) to generate a new Ethereum wallet.
- Export and store the wallet’s private key securely (encrypted storage).
- Use the script to sign a test transaction and broadcast it to the blockchain using a testnet.
- Write a small function to calculate gas fees for a transaction.
Day 3: Interacting with Smart Contracts and Liquidity Pools
Keywords
- ABI (Application Binary Interface)
- Contract Call
- Contract Write
- ERC-20
- Liquidity Providers
- Solidity
- Testnet
- Remix IDE
Reading
Hands-on Lab
- Objective: Write and deploy a simple smart contract to interact with a DEX protocol.
- Tasks:
- Write a simple Solidity smart contract that interacts with an existing DEX.
- Deploy the contract on a testnet (using Remix IDE or Hardhat).
- Use Web3.js or Ethers.js to call contract functions and query data from the blockchain.
- Write a script to read and update contract state (like checking liquidity balances or pool info).
Day 4: Advanced DEX Operations
Keywords
Reading
Hands-on Lab
- Objective: Build and deploy a simple liquidity pool on a testnet.
- Tasks:
- Create a script to add liquidity to a decentralized exchange.
- Simulate trades and analyze the effects of slippage.
- Write functions to calculate impermanent loss.
Day 5: Capstone Project - DEX Trading Script
Keywords
Reading
Hands-on Lab
- Objective: Build a command-line trading bot for a DEX.
- Tasks:
- Write a script to monitor token prices on a DEX.
- Build a bot that executes a token swap using specific conditions (like price thresholds).
- Test the bot on a testnet to verify trading logic.
See also: DEXs.