Collision for finding the private key of a Bitcoin wallet using the Bloom filter algorithm

20.03.2025
Collision for finding the private key of a Bitcoin wallet using the Bloom filter algorithm

A Python script that uses collisions to find a Bitcoin wallet’s private key using the Bloom filter algorithm is impractical and almost impossible for several reasons:

  1. Collision Probability : The probability of finding a collision for the RIPEMD-160 hash function used in Bitcoin is extremely low. Collisions exist for most hash functions, but their frequency is close to the theoretical minimum of 5 .
  2. Keyspace : The private keyspace in Bitcoin is huge (2^256), making brute-force or collision searching nearly impossible without massive computing resources 5 .
  3. Bloom filter : The Bloom filter algorithm is used to quickly determine the presence of an element in a set, but it is not suitable for finding collisions or private keys directly.

However, if you want to understand how you can use the GPU to enumerate keys (without using the Bloom filter), you can look at examples such as the “oclexplorer” project, which uses OpenCL to accelerate key enumeration 1 .

Below is an example of a simple private key enumeration using Python and a library ecdsafor computing public keys and hashes. This example does not use a Bloom filter and is not intended for practical use due to the huge key space.

pythonimport hashlib
import ecdsa
import random

def generate_private_key():
    """Генерирует случайный приватный ключ."""
    return ecdsa.SigningKey.generate(curve=ecdsa.SECP256k1)

def get_public_key(private_key):
    """Получает публичный ключ из приватного."""
    return private_key.get_verifying_key()

def get_ripemd160_hash(public_key):
    """Вычисляет хеш RIPEMD-160 для публичного ключа."""
    sha256_hash = hashlib.sha256(public_key.to_string()).digest()
    return hashlib.new('ripemd160', sha256_hash).hexdigest()

def search_collision(target_hash):
    """Простой пример поиска коллизии."""
    while True:
        private_key = generate_private_key()
        public_key = get_public_key(private_key)
        hash_value = get_ripemd160_hash(public_key)
        if hash_value == target_hash:
            print("Коллизия найдена!")
            return private_key

# Пример использования
target_hash = "some_target_hash_here"  # Замените на целевой хеш
search_collision(target_hash)

This script is not intended for real collision detection due to its low efficiency and huge key space. For practical purposes, it is recommended to use existing Bitcoin libraries and tools, such as bitcoinlibor bit, to create and manage wallets 7 .


What are the alternatives to Bloom filter algorithm for finding collisions?

Alternatives to the Bloom filter algorithm for finding collisions or checking whether an element belongs to a set include the following data structures and algorithms:

  1. Hash tables :
    • Advantages : Hash tables provide an accurate check for whether an element belongs to a set, but require more memory, especially when working with large data sets.
    • Disadvantages : Hash tables can experience collisions, requiring additional resolution mechanisms such as chained hashing or open 6 addressing .
  2. Cuckoo hashing :
    • Advantages : Cuckoo hashing is designed to resolve collisions in hash tables and provides constant worst-case retrieval time. It is more memory efficient than traditional hash tables, but can be more complex to implement 8 .
    • Disadvantages : May be less efficient if the table is very full, resulting in increased time to insert and delete elements 8 .
  3. Quotient Filter :
    • Advantages : Quotient Filter is similar to Bloom filter in speed and complexity, but has a false negative rate, meaning it may report an element as missing even if it is present. It uses more memory than Bloom filter 2 .
    • Disadvantages : Performance degrades as the filter fills, making it less effective for very large datasets 2 .
  4. Representation trees :
    • Advantages : Representation trees, such as suffix trees or prefix trees, can be used to find substrings or elements in a set. They provide accurate data checking, but can be more complex to implement 1 .
    • Disadvantages : Typically used for string data and may be less efficient for other data types.
  5. Counting Bloom Filter :
    • Advantages : This is a variation of the Bloom filter that allows you to track the number of times each element occurs, which can help reduce false positives 1 .
    • Disadvantages : Requires more memory than the standard Bloom filter and may be less efficient for very large datasets.

The choice of alternative depends on the specific requirements of the task, such as the need for accuracy, memory limitations, and data processing speed.

What security measures should be taken into account when using Bloom filter to find private keys

When using Bloom filter to find private keys or any sensitive data, the following security precautions should be taken into account:

  1. Collision protection :
    • Increasing the filter size : The larger the filter size, the lower the probability of false positive results 6 .
    • Increasing the number of hash functions : Using multiple hash functions reduces the likelihood of collisions 5 .
    • Choosing good hash functions : Use hash functions with low collision probability 1 .
  2. Data encryption :
    • Encrypted Bloom Filters : Use encryption to protect the data in the filter, as is done in some systems 4 .
  3. Data anonymization :
    • Anonymous Identifiers : Use anonymized identifiers to protect personal information, as in the BreachWatch 2 system .
  4. Location of data processing :
    • Client-side processing : Process sensitive data on the client side to reduce the risk of leakage 2 .
  5. Filter update :
    • Update your filter regularly to keep it current and effective, especially if your data set changes frequently 2 .
  6. Access control :
    • Restrict access to the filter and data to prevent unauthorized use or information leakage.
  7. Implementation of additional measures :
    • Use additional security measures such as secure cryptographic functions and hardware security modules (HSMs) to protect data 2 .

These measures will help minimize the risks associated with using Bloom filter for sensitive data. However, it is worth noting that finding private keys using Bloom filter is not a practical approach due to the huge key space and the likelihood of false positives.

What are the ready-made tools for finding Bitcoin private keys

There are several ready-made tools and services that can be used to find Bitcoin private keys, although most of them are intended for theoretical or educational purposes rather than practical use due to the huge key space. Here are some examples:

  1. SecretScan :
    • This is a pool for finding private keys of Bitcoin, Ethereum and other cryptocurrencies. SecretScan uses GPU to speed up the search process and allows users to participate in the pool to jointly find keys 1 .
  2. BTC Puzzle :
    • Provides a complete list of all Bitcoin private keys, but this is more of a theoretical tool as the probability of finding a used address is extremely low 2 .
  3. BlackCat Collider :
    • This is a password recovery tool for encrypted Bitcoin wallets. It uses multi-threaded processes to generate and verify keys, but is not designed to find random private keys 6 .
  4. Key Hunter – Bitcoin Checker :
    • An Android app that calculates Bitcoin and Ethereum wallet addresses from private keys and checks the balance. It can also search for wallets with positive balances in the background 5 .
  5. Metasploit Framework and MSFVenom :
    • They are used to find vulnerabilities in code, but can be used to extract private keys from vulnerable applications such as some mobile wallets 4 .

These tools are mainly used for educational or research purposes, since finding random private keys is almost impossible due to the huge key space (2^256).

Citations:

  1. https://secretscan.ru
  2. https://btcpuzzle.info/ru/private-keys/btc
  3. https://wsem.ru/publications/bitcoin_koshelek_3335/
  4. https://habr.com/ru/articles/773412/
  5. https://play.google.com/store/apps/details?id=io.github.keyhunter
  6. https://4pda.to/forum/index.php?showtopic=1053402
  7. https://habr.com/ru/companies/distributedlab/articles/413627/
  8. https://ru.bellingcat.com/materialy/putevoditeli/2017/10/31/bitcoin-follow-the-trail/

  1. https://gitverse.ru/blog/articles/data/255-chto-takoe-filtr-bluma-i-kak-on-rabotaet-na-praktike
  2. https://www.keepersecurity.com/blog/ru/2018/10/29/introducing-keeper-breachwatch/
  3. https://habr.com/ru/companies/otus/articles/541378/
  4. https://bigdataschool.ru/blog/bloom-filter-for-parquet-files-in-spark-apps.html
  5. https://ru.hexlet.io/blog/posts/filtr-bluma-zachem-nuzhen-i-kak-rabotaet
  6. https://neerc.ifmo.ru/wiki/index.php?title=%D0%A4%D0%B8%D0%BB%D1%8C%D1%82%D1%80_%D0%91%D0%BB%D1%83%D0%BC%D0%B0
  7. https://habr.com/ru/articles/788772/
  8. https://evmservice.ru/blog/filtr-bluma/

  1. https://gitverse.ru/blog/articles/data/255-chto-takoe-filtr-bluma-i-kak-on-rabotaet-na-praktike
  2. https://rdl-journal.ru/article/download/746/821/1185
  3. https://habr.com/ru/articles/788772/
  4. http://e-notabene.ru/view_article.php?id_article=30541&nb=1&logged=0&aurora=0
  5. https://habr.com/ru/companies/otus/articles/541378/
  6. https://ru.hexlet.io/blog/posts/filtr-bluma-zachem-nuzhen-i-kak-rabotaet
  7. https://neerc.ifmo.ru/wiki/index.php?title=%D0%A5%D0%B5%D1%88%D0%B8%D1%80%D0 %BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5_%D0%BA%D1%83%D0%BA%D1%83%D1%88%D0%BA%D0%B8
  8. https://ru.wikipedia.org/wiki/%D0%9A%D1%83%D0%BA%D1%83%D1%88%D0%BA%D0%B8%D0 %BD%D0%BE_%D1%85%D0%B5%D1%88%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5

  1. https://github.com/svtrostov/oclexplorer
  2. https://habr.com/ru/articles/525638/
  3. https://proglib.io/p/new-bitcoin
  4. https://ru.wikipedia.org/wiki/%D0%9A%D0%BE%D0%BB%D0%BB%D0%B8%D0%B7%D0%B8%D1%8F_%D1%85%D0%B5%D1%88-%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D0%B8
  5. https://habr.com/ru/articles/319868/
  6. https://science-engineering.ru/ru/article/view?id=1247
  7. https://vc.ru/dev/1616346-vnedryaem-oplatu-btc-kuda-ugodno-python
  8. https://github.com/svtrostov/oclexplorer/issues/6

Source code

Telegram: https://t.me/cryptodeeptech

Video: https://youtu.be/i9KYih_ffr8

Video tutorial: https://dzen.ru/video/watch/6784be61b09e46422395c236

Source: https://cryptodeeptech.ru/discrete-logarithm


Useful information for enthusiasts:


Discrete Logarithm mathematical methods and tools for recovering cryptocurrency wallets Bitcoin