Getting Started

Everything you need to set up your environment and start learning DeFi.


Quick Start Options

Option 1: Google Colab

Recommended for beginners

**Zero setup required!** Run notebooks directly in your browser. 1. Click any notebook link in the course materials 2. Add your API key when prompted 3. Run cells sequentially Start with Week 1

Option 2: Local Development

Full development environment

Set up a complete local environment for advanced DeFi analysis. 1. Clone the repository 2. Install dependencies 3. Configure API keys 4. Run Jupyter locally Setup Instructions

Local Setup Guide

Step 1: Prerequisites

Ensure you have the following installed:

# Check Python version (3.10+ required)
python --version

# Check pip
pip --version

# Check git
git --version

Step 2: Clone the Repository

git clone https://github.com/Digital-AI-Finance/Course-Framework.git
cd Course-Framework

Step 3: Create Virtual Environment

macOS/Linux:

python -m venv venv
source venv/bin/activate

Windows:

python -m venv venv
.\venv\Scripts\activate

Step 4: Install Dependencies

pip install -r requirements.txt

Key packages include:

  • web3 - Ethereum interaction
  • pandas - Data analysis
  • matplotlib - Visualization
  • requests - API calls

Step 5: Configure API Keys

Create a .env file in the project root:

# .env file - DO NOT commit this file!
INFURA_API_KEY=your-infura-key
ETHERSCAN_API_KEY=your-etherscan-key
DEFILLAMA_API_KEY=optional-for-higher-limits

Never commit your .env file to version control. It contains sensitive credentials.

Step 6: Verify Installation

# test_setup.py
from web3 import Web3
from dotenv import load_dotenv
import os

load_dotenv()

# Test Ethereum connection
infura_key = os.getenv("INFURA_API_KEY")
w3 = Web3(Web3.HTTPProvider(f"https://mainnet.infura.io/v3/{infura_key}"))

if w3.is_connected():
    print(f"Connected to Ethereum! Block: {w3.eth.block_number}")
else:
    print("Connection failed. Check your API key.")

Getting API Keys

Infura

1. Go to [infura.io](https://infura.io) 2. Create a free account 3. Create a new project 4. Copy your Project ID Get Infura Key

Etherscan

1. Go to [etherscan.io/apis](https://etherscan.io/apis) 2. Create a free account 3. Generate an API key 4. Copy your API key Get Etherscan Key

Wallet Setup (Optional)

For testnet interactions, you’ll need a wallet:

  1. Install MetaMask browser extension
  2. Create a new wallet (or import existing)
  3. Switch to a testnet (Goerli or Sepolia)
  4. Get testnet ETH from a faucet

Never use a wallet with real funds for development. Create a separate development wallet.


Troubleshooting

Connection Errors

Problem: Could not connect to Ethereum node

Solution:

  1. Verify your Infura API key
  2. Check internet connection
  3. Try a different RPC provider

Import Errors

Problem: ModuleNotFoundError

Solution:

pip install -r requirements.txt

Rate Limiting

Problem: Too many requests from APIs

Solution:

  • Wait and retry
  • Use caching in your code
  • Consider upgrading API tier

Need Help?

Support Resources


Back to top

© 2025 Prof. Dr. Joerg Osterrieder | FHGR - University of Applied Sciences of the Grisons