<p>I have created a bitcoin testnet address but it shows invalid address.
I have created it using this way</p>
<pre><code>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))
</code></pre>
<p>My address generated was <code>n1tS4gT4ksDvRUgQwpPDFR56GjbVrYb2Tw</code>
It even starts with n, which it should, but still it shows invalid address.</p>

CC BY-SA 4.0
2024-04-11T09:11:20.437Z
It's a valid address, where specifically does it show as invalid?
Vojtěch Strnad
CC BY-SA 4.0
2024-04-11T11:53:21.463Z
@VojtěchStrnad https://bitcoinfaucet.uo1.net/send.php, here its showing invalid
kenadams15
CC BY-SA 4.0
2024-04-11T12:06:59.710Z
It appears this faucet doesn't accept legacy addresses. There's nothing we can do about that.
Vojtěch Strnad
CC BY-SA 4.0
2024-04-11T13:10:32.333Z
Got it, Thanks @VojtěchStrnad
kenadams15
<wallet><testnet><address-generation>
Why doesn't my bitcoin testnet address work on testnet faucets?
kenadams15
# Why doesn't my bitcoin testnet address work on testnet faucets?

(Asked by: username_0 on 2024-04-11)

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.

**Tags:** wallet, testnet, address-generation

> **Comments:**
> **username_1**: It's a valid address, where specifically does it show as invalid?  
> **username_0**: @VojtěchStrnad https://bitcoinfaucet.uo1.net/send.php, here its showing invalid  
> **username_1**: It appears this faucet doesn't accept legacy addresses. There's nothing we can do about that.  
> **username_0**: Got it, Thanks @VojtěchStrnad  

---

## 0 answers

