[Paper Review] Blockchain Large Language Models
BlockGPT trains a large language model to detect anomalous Ethereum transactions in real-time by learning from transaction execution traces without predefined rules, achieving high throughput and identifying many attacks among top abnormal transactions.
This paper presents a dynamic, real-time approach to detecting anomalous blockchain transactions. The proposed tool, BlockGPT, generates tracing representations of blockchain activity and trains from scratch a large language model to act as a real-time Intrusion Detection System. Unlike traditional methods, BlockGPT is designed to offer an unrestricted search space and does not rely on predefined rules or patterns, enabling it to detect a broader range of anomalies. We demonstrate the effectiveness of BlockGPT through its use as an anomaly detection tool for Ethereum transactions. In our experiments, it effectively identifies abnormal transactions among a dataset of 68M transactions and has a batched throughput of 2284 transactions per second on average. Our results show that, BlockGPT identifies abnormal transactions by ranking 49 out of 124 attacks among the top-3 most abnormal transactions interacting with their victim contracts. This work makes contributions to the field of blockchain transaction analysis by introducing a custom data encoding compatible with the transformer architecture, a domain-specific tokenization technique, and a tree encoding method specifically crafted for the Ethereum Virtual Machine (EVM) trace representation.
Motivation & Objective
- Motivate the need for dynamic, scalable anomaly detection in blockchain/DeFi transactions.
- Propose a self-supervised learning approach to model transaction execution traces without predefined vulnerability patterns.
- Develop a domain-specific encoding and tokenization pipeline compatible with transformer architectures.
- Demonstrate BlockGPT as an anomaly ranking tool on a large Ethereum dataset and assess real-time performance.
Proposed method
- Construct a new intermediate trace representation (ITR) as a tree combining call, state, and log traces.
- Tokenize ITR nodes into domain-specific tokens forming a fixed vocabulary.
- Compute local token embeddings as a sum of token, tree position, and context embeddings.
- Apply a transformer encoder with tree-aware positional encoding to learn trace embeddings.
- Use a causal language modeling loss to train BlockGPT in an unsupervised/self-supervised manner.
- Rank transactions by log-likelihood of their traces and raise alarms for the most abnormal ones.
Experimental results
Research questions
- RQ1Can unsupervised/self-supervised learning on Ethereum transaction traces detect anomalous or malicious behavior without predefined vulnerability patterns?
- RQ2How effective is a transformer-based model trained on ITR representations at ranking abnormal transactions in real-time?
- RQ3What throughput and false-positive characteristics can BlockGPT achieve in high-volume DeFi contexts?
Key findings
- BlockGPT achieved an average throughput of 2,284 ± 289 transactions per second.
- BlockGPT ranked 49 of 124 attacks among the top-3 most abnormal transactions.
- BlockGPT identified 20 transactions as the most abnormal, 20 as the second most abnormal, and 7 as the third most abnormal across the attacks.
- In high-volume DeFi settings, BlockGPT maintained a low absolute FPR (0.097%) at a 0.01% alarm threshold and could alert roughly every 10 days at 0.1% FPR for 100 daily transactions.
- BlockGPT demonstrates real-time anomaly detection capabilities with an average 0.16 ± 0.3 seconds to rank a single transaction.
- The work introduces custom data encoding, a domain-specific tokenization, and a tree encoding method tailored to EVM traces, achieving robust unsupervised anomaly detection.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.