btcpy icon indicating copy to clipboard operation
btcpy copied to clipboard

Addresses generation

Open rafaelpac opened this issue 5 years ago • 3 comments

Hi! I don't understand something. If I take private key 0000000000000000000000000000000000000000000000000000000000000001 private key WIF is KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn public key compressed is 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798

https://segwitaddress.org/ will give me address 3JvL6Ymt8MVWiCNHC7oWU6nLeHNJKLZGLN but BTCPY will give me 3CNHUhP3uyB9EUtRLsmvFUmvGdjGdkTxJw

https://segwitaddress.org/bech32/ will give me address bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 but BTCPY will give me bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 (version 0) bc1pw508d6qejxtdg4y5r3zarvary0c5xw7k8e76x7 (version 1) bc1zw508d6qejxtdg4y5r3zarvary0c5xw7k6jw83r (version 2)

Why are these differences?!?

rafaelpac avatar Aug 25 '19 23:08 rafaelpac

@rafaelpac It's everything right! From a key you can generate MANY addresses. You are assuming it should return always the same address, but it is not true. Reuse addresses is not a good practice.

brunoerg avatar Aug 31 '19 11:08 brunoerg

Bech32 is fine, I understand it, btcpy is working as expected. But for the P2SH, it is weird. What script is btcpy using to get that different address? I am not talking about HD addresses, I mean, SH means script hash, right? What script when hashed will make it to this p2sh btcpy gives out?

rafaelpac avatar Aug 31 '19 12:08 rafaelpac

how is possible generate each time new address for Bech32 can some one share code?

kojibhy avatar Jul 04 '22 22:07 kojibhy