Coder Social home page Coder Social logo

vlnahp / btcbf Goto Github PK

View Code? Open in Web Editor NEW
267.0 15.0 111.0 595 KB

Bitcoin private key brute force tool, written in python. Also can be used as a bitcoin wallet generator.

License: GNU Affero General Public License v3.0

Python 100.00%
bruteforce python address bitcoin private-key btc cryptocurrency sha256 wallet-generator brute-force-attacks

btcbf's Introduction

Btcbf CodeFactor

Btcbf is a fast and efficient bitcoin private key brute force tool written in python. It works based on generating random or sequential private keys and their corresponding public address. Then checking the address through an online API or an offline database.

What makes Btcbf fast, is mainly the bit library. Thanks to its developer!

Quick Start

 $ git clone https://github.com/vlnahp/Btcbf.git

 $ cd Btcbf

 $ pip install -r requirements.txt

 $ python Btcbf.py or  $ python3 Btcbf.py on Linux

The Goal

The main goal is to prove bitcoin is secure. At least until the day that Quantum computers start working against it learn python!

There are also some useful tools implemented.

Requirements

In offline mode, a database is necessary. By default, it is address.txt containing some addresses. Let's be honest, searching online takes too long and the addresses with balance included in the program are too scarce (as having a current text file with all addresses would make this repository over 5GB). So the users who wish, can download the latest text file from here (direct link), rename and replace it with the "address.txt". But be careful about memory issues. Only use this database if you have sufficient RAM!

To install the requirements run the command below:

$ pip install -r requirements.txt

Usage

Just execute this command: $ python Btcbf.py or $ python3 Btcbf.py on Linux, Btcbf tells you what to do!

Type your desired action and follow instructions. (I love to interact with my program🙂)

Results will be saved to foundkey.txt in the main directory.

Licence

Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.

Latest Release

Link to latest release(v1.2.0): link

btcbf's People

Contributors

gitpushoriginmaster avatar minhhieugma avatar nikkdevic avatar subglitch1 avatar vlnahp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

btcbf's Issues

Just curious

Just curious, how many addresses are generated and checked per second? I'm using the windows release on 6 cores and it's just zipping by. Using my own address.txt I put together too. Love how it's not lagging up my whole computer like other similar programs. :)

error for bruteforce online

traceback (most recent call last):
  File "/home/bitcoin/btcbf/Btcbf.py", line 109, in <module>
    multiprocessing()
  File "/home/bitcoin/btcbf/Btcbf.py", line 104, in multiprocessing
    results = tqdm(pool.imap_unordered(target, r), total=10e15)
UnboundLocalError: local variable 'target' referenced before assignment

JSON Decode Error

`Starting ...
Running ...
multiprocessing.pool.RemoteTraceback: elapsed time: 0.8minutes
"""
Traceback (most recent call last):
File "/usr/lib/python3.8/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "Btcbf.py", line 48, in random_online_brute
data = json.loads(url.text)
File "/usr/lib/python3.8/json/init.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "Btcbf.py", line 163, in
multiprocessing()
File "Btcbf.py", line 159, in multiprocessing
tuple(results)
File "/usr/lib/python3.8/multiprocessing/pool.py", line 868, in next
raise value
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)`

This happens at random times while running the script with option 4 and 1 selected

Crashes during online and offline brute force operation

Hi,

When I run the Python3 Btcbf.py command and follow all instructions, the program starts running but after a while it exits Terminal and reboots the system with no error message at all. What could be the issue? This happens with both offline and online brute force operation - I have my own address.txt file.

Thanks!

Btcbf.py won't run

Hello,

I used to have this running whilst on an older build of Windows. I am currently on Windows 11 23H2 and having some issues here.

All requirements installed successfully, i am also running Python 3.12

image

Any ideas on what the issue here could be?

Thank you.

Noob Issue

Hi everyone im looking into this to learn and fun
and try to start the .py file and when i start it show this

python3 /home/kali/Btcbf/Btcbf.py
Traceback (most recent call last):
File "/home/kali/Btcbf/Btcbf.py", line 3, in
from bit import Key
ModuleNotFoundError: No module named 'bit'

Help plz

Error:
Expecting value: line 1 column 1 (char 0)
File "C:\Users\ffeam\Desktop\Btcbf-main\Btcbf.py", line 110, in multiprocessing
tuple(results)
File "C:\Users\ffeam\Desktop\Btcbf-main\Btcbf.py", line 113, in
multiprocessing()
image

Output error

Hi
The program does not output well. How to fix it? I do not see any generated wallets.

error

from bit import Key
ModuleNotFoundError: No module named 'bit'

Address.txt file question.

The address.txt file contains 3 types of bitcoin address - 1xxx, 3xxx and bc1.
Does the program generate and check all 3 types of address or just the basic 1xxx ?

Test of sequential mode fails.

I created an address.txt file with the first 10 compressed bitcoin addresses from here -

https://privatekeys.pw/keys/bitcoin/1

1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH
1cMh228HTCiwS8ZsaakH8A8wze1JR5ZsP
1CUNEBjYrCn2y1SdiUMohaKUi4wpP326Lb
1JtK9CQw1syfWj1WtFMWomrYdV3W2tWBF9
17Vu7st1U1KwymUKU4jJheHHGRVNqrcfLD
1Cf2hs39Woi61YNkYGUAcohL2K2q4pawBq
19ZewH8Kk1PDbSNdJ97FP4EiCjTRaZMZQA
1EhqbyUMvvs7BfL8goY6qcPbD6YKfPqb7e
1HSxWThjiwbC4dJbXHMpBfwRenB12UguG5
13DaZ9nfmJLfzU6oBnD2sdCiDmf3M5fmLx

to test the program in sequential mode.

I ran the program with range = 1-100 and 1 core.

The program didn't find any of the addresses in the file - why is that?

How does it stop

Hi, When I start running let's say for brute-forcing offline it doesn't stop why is that happening?

Ram issue

I have been testing the script and discovered an issue with the RAM usage going up. If you run the script long enough the ram usage will slowly go up.

Tested the script inside a limited container. Not sure how much it goes up in what span of time.

Slow with large size data

With offline mode (my cpu):

  • 1gb text data, speed of program is only about 30it/s
  • 300kb text data speed is 10000it/s
    could you fix this problem?

ModuleNotFoundError: No module named 'cryptotools.BTC'

C:\Users\amd\Btcbf>python Btcbf.py
Traceback (most recent call last):
File "C:\Users\amd\Btcbf\Btcbf.py", line 7, in
from cryptotools.BTC import generate_keypair, push, script_to_address, OP
ModuleNotFoundError: No module named 'cryptotools.BTC'

i can't find this module cryptotools.BTC

segwit & legacy keys

Hi! Is it possible to add algo for segwit & legacy address? Because I see that the script only works for addresses that begin with 1..., not for 3... and bc1.... thank you!

Foundkey

Foundkey.txt is created automatically by script after find private key?

How it verifies

What should we input in sequence field
DEC format
HEX format

I got an error

blink@localhost:/storage/emulated/0/Download/Btcbf-main$ ls
Btcbf.py _config.yml foundkey.txt
README.md address.txt requirements.txt
blink@localhost:/storage/emulated/0/Download/Btcbf-main$ python3 Btcbf.py
Traceback (most recent call last): File "/sdcard/Download/Btcbf-main/Btcbf.py", line 3, in
from bit.crypto import ECPrivateKey ImportError: cannot import name 'ECPrivateKey' from 'bit.crypto' (/home/blink/.local/lib/python3.9/site-packages/bit/crypto.py)
blink@localhost:/storage/emulated/0/Download/Btcbf-main$ python2 Btcbf.py Traceback (most recent call last):
File "Btcbf.py", line 3, in
from bit.crypto import ECPrivateKey
ImportError: No module named bit.crypto

I got the same error even after changing from Python 3 to Python 2

Help

Hello

I need to run btcbf.py in background mode on debian linux, how can i do that? Run the program in the background, for example on a vps server

AttributeError: 'tqdm_tk' object has no attribute '_tk_window'

Seems to not work on raspberry (python 3) - also python doesn't want take bit

How many cores to be used? (leave empty to use all available cores): 4
Starting ...
Traceback (most recent call last):
  File "Btcbf.py", line 85, in <module>
    multiprocessing()
  File "Btcbf.py", line 80, in multiprocessing
    results = tqdm_tk(pool.imap_unordered(check_list, r), total=10e15)
  File "/usr/local/lib/python3.7/dist-packages/tqdm/tk.py", line 76, in __init__
    self._tk_window = tkinter.Tk()
  File "/usr/lib/python3.7/tkinter/__init__.py", line 2023, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable
Exception ignored in: <function tqdm.__del__ at 0x75813858>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/tqdm/std.py", line 1152, in __del__
    self.close()
  File "/usr/local/lib/python3.7/dist-packages/tqdm/tk.py", line 123, in close
    self._tk_window.protocol("WM_DELETE_WINDOW", _close)
AttributeError: 'tqdm_tk' object has no attribute '_tk_window'

Test

After the recent update I did a test with a known address in sequential brute force mode and it doesn't seem to work. No results found. Looks like it doesn't read adress.txt

Error

0%| | 17044/1e+16 [02:15<22138098990:39:34, 125.47it/s]
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/usr/lib/python3.6/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "Btcbf.py", line 37, in check_list_online
data = json.loads(url.text)
File "/usr/lib/python3.6/json/init.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "Btcbf.py", line 113, in
multiprocessing()
File "Btcbf.py", line 110, in multiprocessing
tuple(results)
File "/usr/local/lib/python3.6/dist-packages/tqdm-4.62.3-py3.6.egg/tqdm/std.py", line 1180, in iter
for obj in iterable:
File "/usr/lib/python3.6/multiprocessing/pool.py", line 735, in next
raise value
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Deriveing Bitcoin private key from it's p2sh-segwit address (p2sh p2wpkh)

Am going to share some details on how to get the private key from address.

I know you'll be thinking by now that the private key can't be derived from the address, that's what I thought on till I told my self nothing is impossible .
Now instead of you guys running brute force attack or try to reverse the algorithm why not create/find a different calculation that can be use to derive the address from the private key and then reverse your own calculation, now it may sound impossible looking at it this way f16dd077d18c6a2c64293da97cc84fad6e3ba8acc4079b32693a8e950fd0ce24 to 3MvhVPJesYH3teZ6eydZkdeMMGmjkQRF4M but after using the below script

from decimal import Decimal

user = input("1: Priv to position\n2: Position to priv\n3: Add to position\n4: Position to add\n[Ans]: ")

if user == '1':
   def find_position(hex_str):
       return int(hex_str, 16)+1

   key = input("\nkey: ")
   print ('Position:',find_position(key))

elif user == '2':
     def find_private_key(position):
         return hex(int(position) - 1)[2:].zfill(64)

     position = Decimal(input("\nPosition: "))
     private_key = find_private_key(position)
     print("Private Key:", private_key)

elif user == '3':
     def calculate_position(string):
         characters = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
         base = len(characters)
         length = len(string)
         position = 0
         power = 1

         for i in range(length - 1, -1, -1):
             char = string[i]
             digit = characters.index(char)
             position += digit * power
             power *= base

         return position

     input_string = input("\n[address]: ")
     position = calculate_position(input_string)+1
     print(f"Position:",position)

elif user == '4':
     def calculate_address(position):
         characters = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
         base = len(characters)
         address = ""

         while position > 0:
               position, remainder = divmod(position , base)
               address = characters[remainder] + address

         return address

     input_position = int(input("\nPosition: ")) - 1
     address = calculate_address(input_position)
     print("Address:", address)

else:
   print ('\nWrong input')

This how you should be looking at it 109201421632169861550405429025058298838764240157642115744110253215387890011685 to 36828257717136275917320730136896267955301102672325362318923 now it should look more vulnerable for your brain to comprehend.

Am not going to share the calculation/script I use in deriving the address from the private key but if you're planning on following the idea I just gave I want you to consider that

  1. Nothing is impossible
  2. It's not going to be an easy one (finding a different approach for deriveing the address from the private key)
  3. Don't be afraid of errors or failure instead fine a way to solve the issue or find a different approach (you only fail when you stop trying)
  4. Try to take a break(free your mind a bit)

If you have a calculation in mind but don't know how to implement it in python3 or any other programming language try using an Ai chatbot.

I will not be giving any prove on this

Not an issue

brother i wanted to add preset options for the remaining btc puzzles.
My question is how can i find the range in decimals from a hex private key

brute force

hey! where can i find the private keys that are cracked?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.