def createAddress(private_key): # print 'null' # private_key ''.join(['%x' % random.randrange(16) for x in range(0, 64)]) public_key = keyUtils.privateKeyToPublicKey(private_key) address = keyUtils.keyToAddr(private_key) wif = keyUtils.privateKeyToWif(private_key) return public_key
def address_new(request): if request.method == "POST": priv_key = keyUtils.makePrivKey() wif = keyUtils.privateKeyToWif(priv_key) addr = keyUtils.keyToAddr(priv_key) addressObj = BitcoinAddress(address=addr, priv_key=priv_key, priv_wif=wif) addressObj.save() return redirect('blog.views.post_list') else: return render(request, 'blog/post_list.html',{}) return render(request, 'blog/post_list.html',{})
def address_new(request): if request.method == "POST": priv_key = keyUtils.makePrivKey() wif = keyUtils.privateKeyToWif(priv_key) addr = keyUtils.keyToAddr(priv_key) addressObj = BitcoinAddress(address=addr, priv_key=priv_key, priv_wif=wif) addressObj.save() return redirect('blog.views.post_list') else: return render(request, 'blog/post_list.html', {}) return render(request, 'blog/post_list.html', {})
def genNewAddresses(num): addresses_list={} for i in xrange(1,num): private_key = os.urandom(32).encode('hex') addresses_list[keyUtils.keyToAddr(private_key)]=keyUtils.privateKeyToWif(private_key) #print keyUtils.keyToAddr(private_key)+ " : "+ keyUtils.privateKeyToWif(private_key) print "== Import genwallet.key in multibit == " print "=======================================" file = open('genwallet.key','a') pubkeys = open('pubkeys.txt','a') for key in addresses_list: pubkey = key line = addresses_list[key] + " 2015-01-12T01:00:17Z\n" print key + " : " + line pubkeys.write(key+"\n") file.write(line) file.close() pubkeys.close() print "======================================="
signableTxn.decode('hex')).digest()).digest().encode('hex') assert (parsed[1][-2:] == '01') # hashtype sig = keyUtils.derSigToHexSig(parsed[1][:-2]) public_key = parsed[2] print "public_key:", public_key public_key = keyUtils.getFullPubKeyFromCompressed(public_key) print "uncompressed public_key:", public_key vk = ecdsa.VerifyingKey.from_string(public_key[2:].decode('hex'), curve=ecdsa.SECP256k1) assert (vk.verify_digest(sig.decode('hex'), hashToSign.decode('hex'))) # Warning: this random function is not cryptographically strong and is just for example private_key = ''.join(['%x' % random.randrange(16) for x in range(0, 64)]) print keyUtils.privateKeyToWif(private_key) print keyUtils.keyToAddr(private_key) # privateKey = keyUtils.wifToPrivateKey("5HusYj2b2x4nroApgfvaSfKYZhRbKFH41bVyPooymbC6KfgSXdD") #1MMMM # signed_txn = makeSignedTransaction(privateKey, # "81b4c832d70cb56ff957589752eb4125a4cab78a25a8fc52d6a09e5bd4404d48", # output (prev) transaction hash # 0, # sourceIndex # keyUtils.addrHashToScriptPubKey("1MMMMSUb1piy2ufrSguNUdFmAcvqrQF8M5"), # [[91234, #satoshis # keyUtils.addrHashToScriptPubKey("1KKKK6N21XKo48zWKuQKXdvSsCf95ibHFa")]] # ) # 5HusYj2b2x4nroApgfvaSfKYZhRbKFH41bVyPooymbC6KfgSXdD # KyFvbums8LKuiVFHRzq2iEUsg7wvXC6fMkJC3PFLjGVQaaN9F1Ln # cU1UcuA7HRMNoJMamquHLpGMnkDQtwhSt8d3Z2UpGFdx1E4osE7D # 5JhuTf9i4fXU8nkonyWDuY8B9vq3LiqQ6vCKH7VpLib4f7hty42
keyUtils.addrHashToScriptPubKey("mwAnSj8gvAkDHbW5wTN67DRQETdmTVDdHz").decode() keyUtils.addrHashToScriptPubKey("moRsbz4GMe99KFSzq8XsSfkS2gmPfQ3GpC").decode() k=keyUtils.wifToPrivateKey("5J3mBbAH58CpQ3Y5RNJpUKPE62SQ5tfcvU2JpbnkeyhfsYB1Jcn") print('privk ', codecs.encode(k,'hex').decode().upper()) print('pk', keyUtils.privateKeyToPublicKey(codecs.encode(k,'hex').decode()) ) pk = keyUtils.privateKeyToPublicKey(codecs.encode(k,'hex').decode()) print('pubk ', codecs.encode(pk, 'hex').decode() ) print('addr ', keyUtils.keyToAddr("754580de93eea21579441b58e0c9b09f54f6005fc71135f5cfac027394b22caa")) k=keyUtils.wifToPrivateKey("KzTg2wn6Z8s7ai5NA9MVX4vstHRsqP26QKJCzLg4JvFrp6mMaGB9") print('privk ', codecs.encode(k,'hex').decode().upper()) #print('pk', keyUtils.privateKeyToPublicKey(codecs.encode(k,'hex').decode()) ) pk = keyUtils.privateKeyToPublicKey(codecs.encode(k,'hex').decode()) print('pubk ', codecs.encode(pk, 'hex').decode() ) print('addr ', keyUtils.pubKeyToAddr("0328592df0ad9de33919e38caa7ff567b708699f9c2f67d8e91ff7185f1e8158b3")) k=keyUtils.wifToPrivateKey("cQmNq39nKXu1FbTE4uCX2PfpE4Q3K3Svxf9gAZEeRWTQSZYvLrTQ") print('privk ', codecs.encode(k,'hex').decode().upper()) #print('pk', keyUtils.privateKeyToPublicKey(codecs.encode(k,'hex').decode()) ) pk = keyUtils.privateKeyToPublicKey(codecs.encode(k,'hex').decode(),net='test')
import threading, Queue, sys import string import random def id_generator(size=8, chars=string.ascii_uppercase + string.digits + string.ascii_lowercase): return ''.join(random.choice(chars) for _ in range(size)) salt = '[email protected]' realtarget = '1MkupVKiCik9iyfnLrJoZLx9RH4rkF3hnA' temptarget = '1L537cT8Uurxk15xPG1Nv4iPRL9TbBuRXi' counter =1 for x in range(50000): passphrase = id_generator() result = generate_keypair(passphrase, salt) private = privateKeyToWif(result) public = keyToAddr(result) if public[:2] == '1M': print private print public print passphrase if public == realtarget: print 'WIN - passphrase:' print passphrase with open("win", "w") as k: k.write(passphrase) k.close break print "result and counter: " with open("temp1m", "a") as fi: fi.write(passphrase +'\n') fi.write(private+'\n')
import random import keyUtils private_key = ''.join(['%x' % random.randrange(16) for x in range(0, 64)]) print keyUtils.privateKeyToWif(private_key) print keyUtils.keyToAddr(private_key)
chars=string.ascii_uppercase + string.digits + string.ascii_lowercase): return ''.join(random.choice(chars) for _ in range(size)) salt = '[email protected]' realtarget = '1MkupVKiCik9iyfnLrJoZLx9RH4rkF3hnA' temptarget = '1L537cT8Uurxk15xPG1Nv4iPRL9TbBuRXi' counter = 1 f = open("wordlist10k.txt", "r") for passphrase in f: passphrase = passphrase[:-1] res = generate_keypair(passphrase) private = privateKeyToWif(res) publicaddress = keyToAddr(res) requesturl = 'https://blockchain.info/address/' + publicaddress page = requests.get(requesturl) sourceCode = page.content htmlElem = html.document_fromstring(sourceCode) tdElems = htmlElem.cssselect("[id=final_balance]") for elem in tdElems: text = elem.text_content() text = text.partition(' ')[0] balance = float(text) if balance > 0: print "yay got some balance!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" print balance print publicaddress print private
print(nums, nums & 0xff, nums & 0xff >> 4, (nums & 0xff) & 0xf, digits[nums & 0xff >> 4], digits[(nums & 0xff) & 0xf], 0xff >> 4, 0xf) keyUtils.addrHashToScriptPubKey("mwAnSj8gvAkDHbW5wTN67DRQETdmTVDdHz").decode() keyUtils.addrHashToScriptPubKey("moRsbz4GMe99KFSzq8XsSfkS2gmPfQ3GpC").decode() k = keyUtils.wifToPrivateKey( "5J3mBbAH58CpQ3Y5RNJpUKPE62SQ5tfcvU2JpbnkeyhfsYB1Jcn") print('privk ', codecs.encode(k, 'hex').decode().upper()) print('pk', keyUtils.privateKeyToPublicKey(codecs.encode(k, 'hex').decode())) pk = keyUtils.privateKeyToPublicKey(codecs.encode(k, 'hex').decode()) print('pubk ', codecs.encode(pk, 'hex').decode()) print( 'addr ', keyUtils.keyToAddr( "754580de93eea21579441b58e0c9b09f54f6005fc71135f5cfac027394b22caa")) k = keyUtils.wifToPrivateKey( "KzTg2wn6Z8s7ai5NA9MVX4vstHRsqP26QKJCzLg4JvFrp6mMaGB9") print('privk ', codecs.encode(k, 'hex').decode().upper()) #print('pk', keyUtils.privateKeyToPublicKey(codecs.encode(k,'hex').decode()) ) pk = keyUtils.privateKeyToPublicKey(codecs.encode(k, 'hex').decode()) print('pubk ', codecs.encode(pk, 'hex').decode()) print( 'addr ', keyUtils.pubKeyToAddr( "0328592df0ad9de33919e38caa7ff567b708699f9c2f67d8e91ff7185f1e8158b3")) k = keyUtils.wifToPrivateKey( "cQmNq39nKXu1FbTE4uCX2PfpE4Q3K3Svxf9gAZEeRWTQSZYvLrTQ")
def _gen_addr(self): self.addr = keyUtils.keyToAddr(self.priv_key.encode('hex'))