jgilmour / brainwallet-check Goto Github PK
View Code? Open in Web Editor NEWGenerates a bitcoin address and private key according to a 'brainwallet' string, then checks to see if the wallet is active
Generates a bitcoin address and private key according to a 'brainwallet' string, then checks to see if the wallet is active
brainwallet string: satoshi
private key: da2876b3eb31edb4436fa4650673fc6f01f90de2f1793c4ec332b2387b09726f
bitcoin address: 1ADJqstUMBB5zFquWg19UqZ7Zc6ePCpzLE
First seen according to blockchain.info:
Wallet amount:
Where can i contact you for a custom made work?
Hi man, thanks for script. But i have a small problem. Your code generate not valid bitcoin address. Not all time but sometimes. I modified your code and in the request I have 200 addresses. and periodically I get 500 response from the server. when I entered the list of addresses obtained by generating your code some addresses are not correct. can you help deal with this?
#!/usr/bin/python
import os
import sys, getopt
import ecdsa
import urllib2
import binascii, hashlib
import requests
import subprocess
from itertools import islice
secp256k1curve=ecdsa.ellipticcurve.CurveFp(115792089237316195423570985008687907853269984665640564039457584007908834671663,0,7)
secp256k1point=ecdsa.ellipticcurve.Point(secp256k1curve,0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798,0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8,0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141)
secp256k1=ecdsa.curves.Curve('secp256k1',secp256k1curve,secp256k1point,(1,3,132,0,10))
def addy(pk):
pko=ecdsa.SigningKey.from_secret_exponent(pk,secp256k1)
pubkey=binascii.hexlify(pko.get_verifying_key().to_string())
pubkey2=hashlib.sha256(binascii.unhexlify('04'+pubkey)).hexdigest()
pubkey3=hashlib.new('ripemd160',binascii.unhexlify(pubkey2)).hexdigest()
pubkey4=hashlib.sha256(binascii.unhexlify('00'+pubkey3)).hexdigest()
pubkey5=hashlib.sha256(binascii.unhexlify(pubkey4)).hexdigest()
pubkey6=pubkey3+pubkey5[:8]
pubnum=int(pubkey6,16)
pubnumlist=[]
while pubnum!=0: pubnumlist.append(pubnum%58); pubnum/=58
address=''
for l in ['123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'[x] for x in pubnumlist]:
address=l+address
return '1'+address
if name == "main":
with open("1.txt") as ofile:
address_gen = ''
key_gen = ''
i = 0
b = 0
f = list(islice(ofile, 100))
for line in f:
linestrip = line.rstrip('\n')
privatekey = (int(hashlib.sha256(linestrip).hexdigest(),16))
privatekeysha = (hashlib.sha256(linestrip)).hexdigest()
bcaddy = addy(privatekey)
addr = bcaddy
keyr = privatekeysha
if i == 0:
i += 1
key_gen = key_gen + keyr
else:
key_gen = key_gen + '|' + keyr
if b == 0:
b += 1
address_gen = address_gen + addr
else:
address_gen = address_gen + '|' + addr
subprocess.Popen('sed -i 1,100d 1.txt', shell=True)
print address_gen
acc_bal = requests.get('https://blockchain.info/ru/multiaddr?active=' + address_gen)
print acc_bal
Thank you very much for sharing your code, I really liked it and that is why I have taken the liberty to adapt it to python3.
Original:
pubkey2=hashlib.sha256(binascii.unhexlify('04'+pubkey)).hexdigest()
pubkey4=hashlib.sha256(binascii.unhexlify('00'+pubkey3)).hexdigest()
Final Code:
pubkey2=hashlib.sha256(binascii.unhexlify(b'04'+pubkey)).hexdigest() # Encode as bytes
pubkey4=hashlib.sha256(binascii.unhexlify(b'00'+pubkey3.encode())).hexdigest() # Encode '00' and pubkey3 as bytes
In the final version of the code, specific changes have been made to ensure that concatenation operations are carried out correctly. Here's the detailed explanation of the changes:
pubkey2 Encoding:
Originally, pubkey is a string of hexadecimal digits. To use it with the hashlib.sha256 function, you need to convert it into bytes. In the final version, a b is added before the string '04'+pubkey, indicating that it's bytes rather than a string.
pubkey4 Encoding:
Similarly, you need to convert '00'+pubkey3 into bytes before passing it to the hashlib.sha256 function. However, in this case, pubkey3 is a hexadecimal string, so you need to explicitly encode it using .encode(). Hence, b'00'+pubkey3.encode() is used.
Input String Encoding:
Also, in the main code block section, a line has been added to encode the input string (sys.argv[1]) into bytes using .encode('utf-8'). This is necessary to ensure that the input is handled properly in the hash operations. In the original version, the input was used directly, causing issues with hash operations in Python 3.
GET Request with urllib.request:
The part of the code that handles GET requests using urllib.request is well implemented and doesn't require any changes. This allows the script to retrieve information from blockchain.info.
These changes are made to ensure compatibility with Python 3 and to ensure that concatenation and manipulation of strings and bytes are done correctly.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.