DEV Community

Byaigo
Byaigo

Posted on

How to Build an Automated Crypto Airdrop Eligibility Checker with Python

Airdrop Checker Banner

Airdrops have become one of the most exciting ways to earn free crypto tokens — but keeping track of eligibility across dozens of protocols is a nightmare. In this tutorial, I'll show you how to build an automated airdrop eligibility checker in Python that queries on-chain data and cross-references it with known airdrop criteria.

What We're Building

A Python script that:

  • Connects to Ethereum via RPC (using Web3.py)
  • Reads historical transaction data for any wallet address
  • Checks against a configurable set of airdrop rules
  • Outputs a clean eligibility report

Prerequisites

pip install web3 requests
Enter fullscreen mode Exit fullscreen mode

Step 1: Connect to Ethereum

from web3 import Web3

RPC_URL = "https://eth.llamarpc.com"
w3 = Web3(Web3.HTTPProvider(RPC_URL))
assert w3.is_connected(), "Failed to connect"
Enter fullscreen mode Exit fullscreen mode

Step 2: Define Airdrop Rules

Most airdrops follow patterns like:

  • Minimum transaction count
  • Contract interactions (specific DEXs, bridges)
  • Holding period (HODL duration)
  • Volume thresholds
AIRDROP_RULES = {
    "min_tx_count": 10,
    "required_contracts": [
        "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",  # Uniswap V2 Router
        "0x1111111254EEB25477B68fb85Ed929f73A960582",  # 1inch Router
    ],
    "min_volume_eth": 0.5,
    "max_wallet_age_days": 90,
}
Enter fullscreen mode Exit fullscreen mode

Step 3: Query On-Chain Data

import requests

ETHERSCAN_API_KEY = "YOUR_KEY_HERE"

def get_normal_txs(address):
    url = f"https://api.etherscan.io/api?module=account&action=txlist&address={address}&apikey={ETHERSCAN_API_KEY}"
    return requests.get(url).json()["result"]

def get_erc20_transfers(address):
    url = f"https://api.etherscan.io/api?module=account&action=tokentx&address={address}&apikey={ETHERSCAN_API_KEY}"
    return requests.get(url).json()["result"]
Enter fullscreen mode Exit fullscreen mode

Step 4: The Eligibility Engine

from datetime import datetime, timezone

def check_eligibility(address):
    txs = get_normal_txs(address)

    if len(txs) < AIRDROP_RULES["min_tx_count"]:
        return False, "Insufficient transaction count"

    interacted = set()
    for tx in txs:
        if tx["to"]:
            interacted.add(tx["to"].lower())

    for contract in AIRDROP_RULES["required_contracts"]:
        if contract.lower() not in interacted:
            return False, f"Missing interaction with {contract}"

    total_eth = sum(int(tx["value"]) for tx in txs) / 1e18
    if total_eth < AIRDROP_RULES["min_volume_eth"]:
        return False, f"Volume too low: {total_eth:.4f} ETH"

    first_tx_ts = int(txs[-1]["timeStamp"])
    wallet_age_days = (datetime.now(timezone.utc).timestamp() - first_tx_ts) / 86400
    if wallet_age_days < AIRDROP_RULES["max_wallet_age_days"]:
        return False, f"Wallet too young: {wallet_age_days:.0f} days"

    return True, "Eligible! 🎉"

if __name__ == "__main__":
    test_wallet = "0x18da907cb9d981bc798acb87ac27b03a2dc3cbb7"
    eligible, reason = check_eligibility(test_wallet)
    print(f"Address: {test_wallet}")
    print(f"Eligible: {eligible}")
    print(f"Reason: {reason}")
Enter fullscreen mode Exit fullscreen mode

Going Further

You can extend this tool to:

  • Multi-chain support: Add Arbitrum, Optimism, Base, and zkSync checks
  • Live monitoring: Watch addresses and alert on new eligible airdrops
  • Database integration: Store results in SQLite for historical tracking
  • Telegram/Discord bot: Get notified instantly

Open Source

All the code is available on my GitHub: github.com/Byaigo

Support

If you found this useful, consider sending some ETH:
0x18da907cb9d981bc798acb87ac27b03a2dc3cbb7

Happy hunting! 🪂

Top comments (0)