ByaigoAirdrops have become one of the most exciting ways to earn free crypto tokens — but keeping track...
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.
A Python script that:
pip install web3 requests
from web3 import Web3
RPC_URL = "https://eth.llamarpc.com"
w3 = Web3(Web3.HTTPProvider(RPC_URL))
assert w3.is_connected(), "Failed to connect"
Most airdrops follow patterns like:
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,
}
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"]
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}")
You can extend this tool to:
All the code is available on my GitHub: github.com/Byaigo
If you found this useful, consider sending some ETH:
0x18da907cb9d981bc798acb87ac27b03a2dc3cbb7
Happy hunting! 🪂