Bitcoin Forum
July 07, 2024, 04:03:23 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Bitcoin / Development & Technical Discussion / Re: fastest way to get bip44/bip49 addresses from seed phrase! on: September 22, 2023, 12:01:04 AM
Minor Improvement to take File opening outside the function

Code:
from bip_utils import Bip39MnemonicGenerator, Bip39SeedGenerator, Bip39WordsNum, Bip44Changes, Bip49, Bip49Coins, Bip44, Bip44Coins
from multiprocessing import Pool, cpu_count

arq = open('addresses_bip44.txt', 'a')
arp = open('addresses_bip49.txt', 'a')

def generatemenemonic(listofmenmonic):
       
    mnemonic = listofmenmonic
    seed_bytes = Bip39SeedGenerator(mnemonic).Generate()
    bip49_mst_ctx = Bip49.FromSeed(seed_bytes, Bip49Coins.BITCOIN)
    bip44_mst_ctx = Bip44.FromSeed(seed_bytes, Bip44Coins.BITCOIN)
    bip49_acc_ctx = bip49_mst_ctx.Purpose().Coin().Account(0)
    bip49_chg_ctx = bip49_acc_ctx.Change(Bip44Changes.CHAIN_EXT)
    bip44_acc_ctx = bip44_mst_ctx.Purpose().Coin().Account(0)
    bip44_chg_ctx = bip44_acc_ctx.Change(Bip44Changes.CHAIN_EXT)
    bip44_addr_ctx = bip44_chg_ctx.AddressIndex(0)
    bip49_addr_ctx = bip49_chg_ctx.AddressIndex(0)
    arq.write("%s \n" % bip44_addr_ctx.PublicKey().ToAddress())
    arp.write("%s \n" % bip49_addr_ctx.PublicKey().ToAddress())


if __name__ == "__main__":
    listofmenmonic = []   
    with open('x.txt') as f:
        for line in f:
            mnemonic = line.strip()
            listofmenmonic.append(mnemonic)
           
    cpustotal = cpu_count()-1
    pool = Pool(cpustotal)
    print("Starting Address Generator on " +str(cpustotal)+ " CPU's")
    results = pool.map(generatemenemonic, listofmenmonic)
    pool.close()
    pool.join()
2  Bitcoin / Development & Technical Discussion / Re: fastest way to get bip44/bip49 addresses from seed phrase! on: September 21, 2023, 10:16:52 PM
Here is tweaked code below

its depend on the number of CPU your processor have

if your processor have 5 CPU it will use 4 i.e cpustotal = cpu_count()-1

if you want to use all available cpu you can change it to cpustotal = cpu_count()

Code:

from bip_utils import Bip39MnemonicGenerator, Bip39SeedGenerator, Bip39WordsNum, Bip44Changes, Bip49, Bip49Coins, Bip44, Bip44Coins
from multiprocessing import Pool, cpu_count

def generatemenemonic(listofmenmonic):
    arq = open('addresses.txt', 'a')        
    mnemonic = listofmenmonic
    seed_bytes = Bip39SeedGenerator(mnemonic).Generate()
    bip49_mst_ctx = Bip49.FromSeed(seed_bytes, Bip49Coins.BITCOIN)
    bip44_mst_ctx = Bip44.FromSeed(seed_bytes, Bip44Coins.BITCOIN)
    bip49_acc_ctx = bip49_mst_ctx.Purpose().Coin().Account(0)
    bip49_chg_ctx = bip49_acc_ctx.Change(Bip44Changes.CHAIN_EXT)
    bip44_acc_ctx = bip44_mst_ctx.Purpose().Coin().Account(0)
    bip44_chg_ctx = bip44_acc_ctx.Change(Bip44Changes.CHAIN_EXT)
    bip44_addr_ctx = bip44_chg_ctx.AddressIndex(0)
    bip49_addr_ctx = bip49_chg_ctx.AddressIndex(0)
    arq.write("%s \n" % bip44_addr_ctx.PublicKey().ToAddress())
    arq.write("%s \n" % bip49_addr_ctx.PublicKey().ToAddress())


if __name__ == "__main__":
    listofmenmonic = []  
    with open('x.txt') as f:
        for line in f:
            mnemonic = line.strip()
            listofmenmonic.append(mnemonic)
            
    cpustotal = cpu_count()-1
    pool = Pool(cpustotal)
    print("Starting Address Generator on " +str(cpustotal)+ " CPU's")
    results = pool.map(generatemenemonic, listofmenmonic)
    pool.close()
    pool.join()



I want to make a note here one seed can have thousands of addresses as well which called Derivation paths address generation

let me add that code as well incase you want something like that

right now below code will get 30 address but you can change this line for i in range(30): to get more change 30 to 1000 may be

Code:

from bip_utils import Bip39MnemonicGenerator, Bip39SeedGenerator, Bip39WordsNum, Bip44Changes, Bip49, Bip49Coins, Bip44, Bip44Coins
from multiprocessing import Pool, cpu_count

def generatemenemonic(listofmenmonic):    
        
    mnemonic = listofmenmonic
    seed_bytes = Bip39SeedGenerator(mnemonic).Generate()
    bip49_mst_ctx = Bip49.FromSeed(seed_bytes, Bip49Coins.BITCOIN)
    bip44_mst_ctx = Bip44.FromSeed(seed_bytes, Bip44Coins.BITCOIN)
    bip49_acc_ctx = bip49_mst_ctx.Purpose().Coin().Account(0)
    bip49_chg_ctx = bip49_acc_ctx.Change(Bip44Changes.CHAIN_EXT)
    bip44_acc_ctx = bip44_mst_ctx.Purpose().Coin().Account(0)
    bip44_chg_ctx = bip44_acc_ctx.Change(Bip44Changes.CHAIN_EXT)
    #bip44_addr_ctx = bip44_chg_ctx.AddressIndex(0)
    #bip49_addr_ctx = bip49_chg_ctx.AddressIndex(0)
    #arq.write("%s \n" % bip44_addr_ctx.PublicKey().ToAddress())
    #arq.write("%s \n" % bip49_addr_ctx.PublicKey().ToAddress())
    tempaddr = []
    for i in range(30):
        bip44_addr_ctx = bip44_chg_ctx.AddressIndex(i)
        bip49_addr_ctx = bip49_chg_ctx.AddressIndex(i)
        bip44addr = bip44_addr_ctx.PublicKey().ToAddress()
        bip49addr = bip49_addr_ctx.PublicKey().ToAddress()
        tempaddr.append(bip44addr)
        tempaddr.append(bip49addr)
    with open('addresses.txt', 'a') as f:
        for line in tempaddr:
            f.write(f"{line}\n")


if __name__ == "__main__":
    listofmenmonic = []  
    with open('x.txt') as f:
        for line in f:
            mnemonic = line.strip()
            listofmenmonic.append(mnemonic)
            
    cpustotal = cpu_count()-1
    pool = Pool(cpustotal)
    print("Starting Address Generator on " +str(cpustotal)+ " CPU's")
    results = pool.map(generatemenemonic, listofmenmonic)
    pool.close()
    pool.join()



If you want your to get separate files for both bip44 and bip49 then code is below


Code:

from bip_utils import Bip39MnemonicGenerator, Bip39SeedGenerator, Bip39WordsNum, Bip44Changes, Bip49, Bip49Coins, Bip44, Bip44Coins
from multiprocessing import Pool, cpu_count

def generatemenemonic(listofmenmonic):
    arq = open('addresses_bip44.txt', 'a')
    arp = open('addresses_bip49.txt', 'a')    
    mnemonic = listofmenmonic
    seed_bytes = Bip39SeedGenerator(mnemonic).Generate()
    bip49_mst_ctx = Bip49.FromSeed(seed_bytes, Bip49Coins.BITCOIN)
    bip44_mst_ctx = Bip44.FromSeed(seed_bytes, Bip44Coins.BITCOIN)
    bip49_acc_ctx = bip49_mst_ctx.Purpose().Coin().Account(0)
    bip49_chg_ctx = bip49_acc_ctx.Change(Bip44Changes.CHAIN_EXT)
    bip44_acc_ctx = bip44_mst_ctx.Purpose().Coin().Account(0)
    bip44_chg_ctx = bip44_acc_ctx.Change(Bip44Changes.CHAIN_EXT)
    bip44_addr_ctx = bip44_chg_ctx.AddressIndex(0)
    bip49_addr_ctx = bip49_chg_ctx.AddressIndex(0)
    arq.write("%s \n" % bip44_addr_ctx.PublicKey().ToAddress())
    arp.write("%s \n" % bip49_addr_ctx.PublicKey().ToAddress())


if __name__ == "__main__":
    listofmenmonic = []  
    with open('x.txt') as f:
        for line in f:
            mnemonic = line.strip()
            listofmenmonic.append(mnemonic)
            
    cpustotal = cpu_count()-1
    pool = Pool(cpustotal)
    print("Starting Address Generator on " +str(cpustotal)+ " CPU's")
    results = pool.map(generatemenemonic, listofmenmonic)
    pool.close()
    pool.join()



There is one more thing that we can add to code i.e compress and uncompressed addresses ( lemme know if u want to add that)

Also there is a built-in mnemonic lib for python as well if you want to generate random mnemonic

message me for that if you need to learn

cheers !





3  Bitcoin / Development & Technical Discussion / Re: fastest way to get bip44/bip49 addresses from seed phrase! on: September 19, 2023, 03:51:32 AM
share your python code
I can tweak it and add multiprocessing to make it fast and other tweaks if possible also customize it for required seed

4  Economy / Services / Re: [FREE] Speed up BTC unconfirmed transaction to confirmed on: November 11, 2017, 08:45:05 AM
Hi,

Need help accelerate this tx

e3e6a3fec38acf9239e94cc47a9b51bb47babfa3470850a46ec88e61738bde2f

would be highly appriciated

thx
5  Economy / Services / Re: [Free]▂▃▅▆█ Bitcoin Transaction Accelerator █▆▅▃▂ for Unconfirmed transactions on: November 11, 2017, 08:31:10 AM
Hi there bro,

                          Can you please push my tx below

e3e6a3fec38acf9239e94cc47a9b51bb47babfa3470850a46ec88e61738bde2f

Will highly appreciate and possible some donation

Regards,
Q M
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!