Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bigger bloom file #188

Open
Alf71 opened this issue Oct 28, 2023 · 9 comments
Open

bigger bloom file #188

Alf71 opened this issue Oct 28, 2023 · 9 comments

Comments

@Alf71
Copy link

Alf71 commented Oct 28, 2023

Hello Ryan,

Would it be feasible to increase

#define BLOOM_SIZE (51210241024)

to

#define BLOOM_SIZE (102410241024)

in order to get a bigger bloom file?

@ryancdotorg
Copy link
Owner

Not usefully. The bloom filter implementation has a "hash function" that can't address more than 32 bits. It takes advantage of the fact that the input value is already hashed, and just combines various chunks of it rather than hashing again. This works as long as the filter size is a power of two and the inputs are both big enough and have an approximately uniform distribution.

I had planned to replace it with bloomslice which generalizes the technique, but I have been working on other things.

I don't really understand why anyone is still interested in brainflayer - there are people who have written their own GPU-based tools to steal everything that can be stolen, and there doesn't seem to be any further academic work going on.

@Alf71
Copy link
Author

Alf71 commented Oct 29, 2023

Lovely and patient conversatiioon partner, as always...
And we are not speaking of stealing, as far as all the 160 BTC puzzles were not resolved.
I just can't afford to pay my electricity bill, the reason why I am using only 1 - 2 threads... ; )
I got some C application to generate pur random, around 150K to 220 k per second and thread.
By increasing the number of rmd160 in bloomfile, I would have a bigger chance.

@Alf71
Copy link
Author

Alf71 commented Oct 29, 2023

// gcc -o random130_5_2_TEST random130_5_2_TEST.c -lgmp

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <gmp.h>
#include <string.h>

#define KEY_SIZE 64 // The desired key size
#define LEADING_ZEROS 31

int main(void) {
mpz_t lower_bound, upper_bound, range, num;
gmp_randstate_t state;

mpz_init(lower_bound);
mpz_init(upper_bound);
mpz_init(range);
mpz_init(num);

mpz_set_str(lower_bound, "200000fffffffffffffffffffffffffff", 16);
mpz_set_str(upper_bound, "2fffff000000000000000000000000000", 16);
mpz_sub(range, upper_bound, lower_bound);

gmp_randinit_default(state);

// Use a more random seed, and do it only once outside the loop
gmp_randseed_ui(state, time(NULL));

char str[KEY_SIZE + 1];  // Use the defined key size

while (1) {
    mpz_urandomm(num, state, range);
    mpz_add(num, num, lower_bound);

    // Convert the mpz_t to a string directly with the desired size
    mpz_get_str(str, 16, num);

    // Ensure a minimum of 31 leading zeros
    int str_len = strlen(str);
    if (str_len < KEY_SIZE) {
        int zeros_to_add = KEY_SIZE - str_len;
        memmove(str + zeros_to_add, str, str_len + 1); // Shift the string to make space for leading zeros
        memset(str, '0', zeros_to_add); // Add leading zeros
    }

    // Print the resulting string
    printf("%s\n", str);
}

mpz_clear(lower_bound);
mpz_clear(upper_bound);
mpz_clear(range);
mpz_clear(num);
gmp_randclear(state);

return EXIT_SUCCESS;

}
`

@ryancdotorg
Copy link
Owner

I don't really appreciate the apparent (apologies if I've misread) sarcasm.

For the puzzle coins, there is Pollard's kangaroo algorithm, which is faster than brute force.

If you want to try random keys in the hopes of being lucky to find things before someone doing a faster search, you would be better off doubling the keys repeatedly from a random start point and clamping them when they get too big.

I pushed all my unreleased work on it to a develop branch if you want to play with it. The doubling search algorithm is in there, as is an option to stop after checking a certain number of keys. You'll have to hack it to limit leading zeros.

@Alf71
Copy link
Author

Alf71 commented Oct 29, 2023

No, that was not sarcasm... : )
And thanks for the new develop branch

@ryancdotorg
Copy link
Owner

Have you actually tried estimating the expected value of what you're doing? I'm really curious.

@Alf71
Copy link
Author

Alf71 commented Oct 29, 2023

Not sure what you mean.
Puzzle 66 = 6, 6 BTC
Puzzle 130 = 13 BTC
Puzzle 160 = 16 BTC
Some of the pubkeys are known, some not.

At the time there are several apps to try this.
Keyhunt, Kangaroo, Brainflayer, Keysubtracter, Python scripts.

I belong to Iceland's and Alberto's school.
I have learned a lot from them.
I can't C programming, I mainly work with my own Python scripts, and they are of course slow.

Now sports:

I tried to MAKE your dev branch, but got an error message after

git clone --single-branch --branch develop https://github.com/ryancdotorg/brainflayer.git
cd brainflayer
make all

@ryancdotorg
Copy link
Owner

"it works on my machine" - I have Ubuntu 20.04. Don't have time to try to troubleshoot it for you.

@Alf71
Copy link
Author

Alf71 commented Oct 29, 2023

No problem. You've done already enough.
In case someone knows the solution for WSL in Windows 10

$ make all

git submodule init git submodule update gcc -O3 -flto -funsigned-char -falign-functions=16 -falign-loops=16 -falign-jumps=16 -Wall -Wextra -Wno-pointer-sign -Wno-sign-compare -pedantic -std=gnu99 -ggdb brainflayer.o hex.o bloom.o mmapf.o hsearchf.o ec_pubkey_fast.o dldummy.o b58/b58.o scrypt-jane/scrypt-jane.o algo/brainv2.o algo/brainwalletio.o algo/electrum1x.o algo/keccak.o algo/quorum.o algo/sha3.o algo/warpwallet.o sha256/sha256.o sha256/sha256-nayuki64-asm.o sha256/sha256-ssse3-asm.o sha256/sha256-avx-asm.o sha256/sha256-avx2-asm.o sha256/sha256-ni-asm.o secp256k1/.libs/libsecp256k1.a -lrt -lcrypto -lz -lgmp -lpthread -o brainflayer /usr/bin/ld: b58/b58.o (symbol from plugin): in function b58_csum':
(.text+0x0): multiple definition of ripemd160_xform_func'; brainflayer.o (symbol from plugin):(.text+0x0): first defined here /usr/bin/ld: b58/b58.o (symbol from plugin): in function b58_csum':
(.text+0x0): multiple definition of SHA2_256_Transform'; brainflayer.o (symbol from plugin):(.text+0x0): first defined here /usr/bin/ld: sha256/sha256.o (symbol from plugin): in function ripemd160_fast':
(.text+0x0): multiple definition of ripemd160_xform_func'; brainflayer.o (symbol from plugin):(.text+0x0): first defined here /usr/bin/ld: sha256/sha256.o (symbol from plugin): in function ripemd160_fast':
(.text+0x0): multiple definition of SHA2_256_Transform'; brainflayer.o (symbol from plugin):(.text+0x0): first defined here collect2: error: ld returned 1 exit status make: *** [Makefile:109: brainflayer] Error 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants