0

this is certainly my lack of understanding, but it challenge what i know about blockchain.

I created a new address p2wpkh from public key with bech32 (testnet) on ‎2022-11-10 : tb1q9ctu2t7zqvlevcamga9dfdhvlpeh93qdz6aawk Made one transaction on 2022-11-10 10:29

pseudo code

b_pubkey = bytes.fromhex(pubkey)
h160 = hash_160(b_pubkey)
segwit_hrp = 'tb'
encoding = Encoding.BECH32 
address = bech32_encode(encoding, segwit_hrp, [0] + convertbits(h160, 8, 5))

But in mempool it shows it has 3 transactions, goes back to ‎2022-11-07 15:10 https://mempool.space/testnet/address/tb1q9ctu2t7zqvlevcamga9dfdhvlpeh93qdz6aawk

aren't addresses supposed to be unique and collision resistant ?

7
  • How did you generate this address? Nov 10, 2022 at 15:43
  • i added pseudo code to post Nov 10, 2022 at 15:44
  • Ok where did you get the pubkey? Nov 10, 2022 at 15:50
  • public key of existing address, if that old address is linked to these transactions, why the NEW address is showing in output of confirmed block ? Nov 10, 2022 at 15:56
  • If you want a new address, you need a new key... Addresses just encode the hash of a key or a script. If you use the same key, you'll get the same address. Nov 10, 2022 at 15:59

1 Answer 1

2

I created a new address p2wpkh from public key

public key of existing address,

If you use the same public key as your starting point, you'll just generate the same address.

To create new addresses you need to first derive a new public key using the Hierarchical Deterministic (HD) process described by BIP-32.

(This answer is Community Wiki since it is just a summary of comments with the aim of removing this question from the list of unanswered questions)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.