wallet – Why doesn’t my bitcoin testnet address work on testnet faucets?

on

|

views

and

comments


I have created a bitcoin testnet address but it shows invalid address.
I have created it using this way

passphrase = b'blah'
secret = little_endian_to_int(hash256(passphrase))
print(PrivateKey(secret).point.address(testnet=True))

def little_endian_to_int(b):
    ans = int.from_bytes(b, 'little')
    return ans
def hash256(s):
    '''two rounds of sha256'''
    return hashlib.sha256(hashlib.sha256(s).digest()).digest()

G = S256Point(
    0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798,
    0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8)

class PrivateKey:

    def __init__(self, secret):
        self.secret = secret
        self.point = secret * G
def address(self, compressed=True, testnet=False):
        '''Returns the address string'''
        h160 = self.hash160(compressed)
        if testnet:
            prefix = b'\x6f'
        else:
            prefix = b'\x00'
        return encode_base58_checksum(prefix + h160)
def hash160(self, compressed=True):
        return hash160(self.sec(compressed))

My address generated was n1tS4gT4ksDvRUgQwpPDFR56GjbVrYb2Tw
It even starts with n, which it should, but still it shows invalid address.

Share this
Tags

Must-read

The Great Bitcoin Crash of 2024

Bitcoin Crash The cryptocurrency world faced the hell of early 2024 when the most popular Bitcoin crashed by over 80% in a matter of weeks,...

Bitcoin Gambling: A comprehensive guide in 2024

Bitcoin Gambling With online currencies rapidly gaining traditional acceptance, the intriguing convergence of the crypto-trek and gambling industries is taking place. Cryptocurrency gambling, which started...

The Rise of Bitcoin Extractor: A comprehensive guide 2024

Bitcoin Extractor  Crypto mining is resources-thirsty with investors in mining hardware and those investing in the resources needed as the main beneficiaries. In this sense,...

Recent articles

More like this