🐞 Bug description
When using the --in option to load addresses from a file, keyfinder fails with the error:
[Info] Error: invalid argument
This happens consistently when the input file contains more than 16 Bitcoin addresses, even if all of them are valid and previously tested individually.
🔍 Root Cause
After inspecting the source code, we found the following line in CudaHashLookup.cu:
#define MAX_TARGETS_CONSTANT_MEM 16
And later:
if (targets.size() <= MAX_TARGETS_CONSTANT_MEM) {
return setTargetConstantMemory(targets);
} else {
return setTargetBloomFilter(targets);
}
The logic is supposed to switch to a bloom filter automatically when more than 16 targets are provided. However, this transition silently fails and returns invalid argument.
✅ Reproduction steps
-
Create a file named addresses.txt with 17 valid Base58 Bitcoin addresses.
-
Run:
keyfinder --in addresses.txt
-
Observe the error:
[Info] Error: invalid argument
-
Reduce the file to 16 addresses → it works fine.
💡 Expected behavior
keyfinder should properly fall back to bloom filter mode.
- If any error occurs in that transition, it should print a clear message or fallback safely.
- Ideally, it should log something like:
[Warning] Input exceeds 16 constant memory targets; switching to bloom filter.
🧪 Environment
- OS: Linux (Ubuntu 22.04)
- CUDA version: 12.0
- GPU: NVIDIA RTX 2000 Ada
- Build: Compiled from latest
master using make BUILD_CUDA=1
🛠️ Workaround
By adding logging to the bloom filter logic, I verified that it does work correctly if the allocation and transfer succeed. After recompiling with minor logging fixes, it correctly loaded and processed over 100,000 addresses using the bloom filter mechanism.
❤️ Suggestion
I can submit a PR to improve the error messaging and add a note in the README for this hidden limitation.
Let me know if that would be welcome.
🐞 Bug description
When using the
--inoption to load addresses from a file,keyfinderfails with the error:This happens consistently when the input file contains more than 16 Bitcoin addresses, even if all of them are valid and previously tested individually.
🔍 Root Cause
After inspecting the source code, we found the following line in
CudaHashLookup.cu:And later:
The logic is supposed to switch to a bloom filter automatically when more than 16 targets are provided. However, this transition silently fails and returns
invalid argument.✅ Reproduction steps
Create a file named
addresses.txtwith 17 valid Base58 Bitcoin addresses.Run:
Observe the error:
Reduce the file to 16 addresses → it works fine.
💡 Expected behavior
keyfindershould properly fall back to bloom filter mode.🧪 Environment
masterusingmake BUILD_CUDA=1🛠️ Workaround
By adding logging to the bloom filter logic, I verified that it does work correctly if the allocation and transfer succeed. After recompiling with minor logging fixes, it correctly loaded and processed over 100,000 addresses using the bloom filter mechanism.
❤️ Suggestion
I can submit a PR to improve the error messaging and add a note in the README for this hidden limitation.
Let me know if that would be welcome.