
Dec 2022 - Dec 2023
3min read
Automated Ethereum NFT Trader
When NFT collections reveal their metadata, and thus the rarity of tokens, their token metadata goes live on-chain before trading marketplaces like OpenSea or Blur catch up. That short delay creates an opportunity to spot and buy rare undervalued NFTs before front users realize their value.
This project was all about building a system that could detect these reveals the moment they happened, fetch thousands of token metadata entries almost instantly, calculate rarity rankings, and automatically buy the rare ones that looked underpriced.
How it works
The system continuously monitored smart contracts, decoded pending transactions in the mempool, and polled token metadata endpoints — combining all of these signals to catch reveals early, no matter how the collection was structured.
Once a reveal was detected, a distributed network of ten lightweight Go servers kicked in to fetch metadata in parallel. Each server stayed connected to a central coordinator over WebSockets, which streamed tasks and results in real time. This setup made it possible to pull and process around 10.000 token metadata entries within seconds.
To handle the competitive side of things, I deployed a small Solidity contract that obfuscated transaction parameters to reduce simple mempool frontrunning. I also reverse-engineered RarityTools' scoring system so the bot could instantly rank tokens by rarity, as seen by the user once the front-end catches up, and prioritize which ones to buy.
Architecture
The core system was originally built in Node.js (v1) and later rewritten in Golang (v2) for better performance and concurrency. It handled everything from task coordination to transaction assembly, while distributed workers focused purely on speed and scale and the coordinator managed job distribution, event tracking, and purchase logic.
All transactions, both marketplace listings and direct on-chain buys, were assembled and signed manually without relying on third-party SDKs. This gave full control over timing, priority fee strategies, and security, which is crucial when real money is involved.
Results & Takeaways
The bot reliably detected reveals in real time, ranked all tokens by rarity within seconds, and executed purchases directly on-chain. It was competitive and was able to semi-consistently outperform other users with similar strategies. It resulted in successful purchases of undervalued tokens, that were then sold for a profit. Unfortunately, the project finalized and become competitive right as the NFT bubble burst, resulting in the exploitation phase to unfortunately be short.
It ended up being an amazing project to dive deep into:
Distributed systems: Designing and scaling real-time WebSocket servers.
Blockchain internals: Working directly with smart contracts, mempools, and transaction assembly.
Security & reliability: Building safety checks for systems that interact with funds.
New tech stacks: Learning Golang and Solidity from the ground up and applying them in a real project.
Overall, this project taught me how to design fast, fault-tolerant systems under real-world constraints, and how to stay calm when your code is literally moving money.
See More
The code can be found in this Github Repository.
Please note that many of the dependencies and APIs are deprecated, thus the project is not usable in its current state.
