Jack Allan Kasbeer

← Inventions & Projects

The 3,806 Wallets My Whale Filter Missed

· databricks, delta lake, pyspark, mlflow, data engineering

On the first morning, every row in my Bronze tables belonged to the last 30 days. On the second morning that was no longer true. Bronze had picked up another day, the write window had moved forward, and Delta refused to write a row from yesterday’s window into today’s. The window had to move for that bug to show up.

After the Databricks Associate exam, I wanted a pipeline with that kind of problem. I used the public Bitcoin and Ethereum Parquet files on AWS. One daily job takes them from raw blocks and transactions to a set of wallets worth inspecting. AWS Public Blockchain Data

Pipeline: the public S3 bucket feeds Bronze (raw ETH blocks, transactions and token transfers; BTC blocks and transactions), read with an explicit schema, only for dates after the latest one already landed. Silver deduplicates, filters, converts Wei to ETH and flattens Bitcoin outputs. A data quality task either stops the run (task fails, Gold never runs, email goes out) or lets Gold build daily network stats per chain and a cross-chain whale_transactions table. The last task builds wallet features, trains an IsolationForest and logs to MLflow.
The daily job, top to bottom. Every arrow is a depends_on.

Making the next run work

AWS owns the source bucket. I could read dated folders but couldn’t set up file notifications on it. For each table, Bronze kept track of the latest date it had landed. It read newer folders in the configured window and wrote each day to its own partition. I kept the source path and ingestion time with each row.

Silver removes duplicate records and puts amounts into consistent units. On Ethereum I cast gas quantities to decimals before multiplying. The product can overflow a long integer even when both inputs fit. On Bitcoin I flattened transaction outputs into their own table. A single transaction can pay several recipients, so treating it as a single transfer would lose information.

The second-morning fix was one line in the read path. Silver had to read the same dates it was allowed to replace.

def read_bronze(chain: str, table: str):
    return spark.table(bronze_table(chain, table)).filter(F.col("date").isin(WINDOW_DATES))

Before Gold could run, I checked for missing days, duplicate or null keys and impossible values. A failed check stopped the job there. I wanted a missing Ethereum partition to show up as a failure, long before anyone mistook it for a quiet day on the network.

Two ways to find an unusual wallet

Gold gave me a simple rule. Mark Ethereum transactions over 100 ETH and Bitcoin outputs over 10 BTC. That finds large transfers. I wanted to see which other kinds of activity would stand out if a model looked at wallets over a whole month.

I kept the model to Ethereum and required at least ten transactions per wallet. That left 809,722 wallets. For each I built 18 features covering counts, values, counterparties, active days and net flow. I trained a 200-tree Isolation Forest and took the highest-scoring 1% by anomaly. Isolation Forest

809,722 Ethereum wallets with at least ten transactions; the IsolationForest flags the top 1%, 8,098 wallets. 4,292 of them (53%) are also whale-transaction counterparties: the model agrees with the rule. The other 3,806 (47%) never touched a whale transaction; they average more transactions per wallet at roughly 23 times lower average value.
Of 8,098 flagged wallets, 3,806 had no transfers above the threshold.

Of the 8,098 flagged wallets, 4,292 had appeared on at least one side of a transfer over the threshold. The remaining 3,806 had more transactions per wallet on average and roughly a twenty-third of the average transaction value of the overlap group. The model had picked up a pattern my large-transfer rule would miss. I had no labels to tell me who operated those wallets or why. That 53% tells me how often the two methods agreed.

Getting it onto a schedule

I put the daily job and a separate Sunday table-compaction job in one bundle. GitHub Actions validated changes on pull requests and deployed from main. Adding the model as a fifth task broke deployment over two small things in the YAML, a tab and a missing underscore in the dependency key.

CI/CD: a git push or pull request triggers GitHub Actions with the Databricks CLI. Every PR and push runs bundle validate against the prod target; pushes to main also run bundle deploy, which updates the daily job (06:00 Central: bronze, silver, data quality, gold, anomaly) and the weekly job (Sundays 08:00 Central: OPTIMIZE and ZORDER). Both email on failure.
Validate everything; deploy only from main.

The deployment logs caught the spelling mistake. Only letting the dates roll over caught the bad read. Those are the two checks I’d want running before changing the pipeline again. Project source

November 2026 follow-up. I connected the archive to a live Ethereum feed and built a dashboard for transfers that break a sender’s previous high. When an Ethereum Wallet Breaks Its Own Record