i try to generate list address bitcoin by code below but not worked, please help. Thanks

low  = 0x2C45E9017ED4 #2^250
high = 0x2C45E9017fff #2^251

def prv():
 while True:
    ran = (low,high,1)
def doublehash(s):
    return sha256(sha256(s).digest()).digest()
def hash160(s):
    return hashnew('ripemd160', sha256(s).digest()).digest() 
def doublehash_base58_checksum(s):
    return b58encode(s + doublehash(s)[:4]).decode("utf-8") 
def generate():
    private_key = prv()
    wif = doublehash_base58_checksum(b'\x80' + private_key + b'\x01') 
    pk = ecdsa.SigningKey.from_string(private_key, curve=ecdsa.curves.SECP256k1) 
    public_key = pk.get_verifying_key().to_string(encoding="compressed") 
    address = doublehash_base58_checksum(b'\x00' + hash160(public_key)) 
    return private_key.hex(), wif, public_key.hex(), address
private_key, wif, public_key, address = generate()
print(f"Private Key     : {private_key}")
print(f"Private Key WIF : {wif}")
print(f"Public Key      : {public_key}")
print(f"Bitcoin Address : {address}") 


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.