A low-cost ESP32-C3 firmware uses hashed domain storage to implement a DNS-based ad blocker that supports more than half a million blocked domains while using only around 50KB of RAM.
The firmware for the ESP32-C3 SuperMini, developed by ZedAxis, packs about 537,000 blocked domains into just 4 MB of flash memory. Designed as a low-cost alternative to conventional DNS servers and returns responses for blocked domains in less than 10 milliseconds using only about 50 KB of RAM.
The firmware does not store blocked domains in a plaintext format but encodes them as 40-bit FNV-1a hash values. Then the duplicates in the input are stripped away during the building of the hash database when it is sorted and uploaded to the ESP32 flash memory. During operation, the incoming queries are encoded in the same way and compared to the existing data via a binary search; the matching domains get blocked, and the rest get sent to an external DNS server.
It is important to note that the target model (ESP32-C3) has 400 KB of RAM and 4 MB of flash memory. According to the developer, the use of 40-bit hashes gives the most efficient balance between storage efficiency and collisions, so that the list size can be considerably increased.
If maximum storage space is desired, the flash partition reserved for Over-the-Air (OTA) updates can be repurposed by the firmware. Without OTA support, the firmware stores the full blocklist, whereas enabling OTA reduces the database capacity to about 250,000 websites.
While the project is not meant to serve as a substitute for more feature-rich systems such as Pi-hole and AdGuard Home, it offers an alternative DNS filtering service that consumes very little power and has the ability to block ads even when the main DNS server fails to respond. The source code has been released as open-source software.














































































