Testnet and Mainnet have same private key


#1

I was playing around with NEM API, and I got a feature, that maybe it’s obvious but I didn’t know that.
You can have the same address in testnet and mainnet with the same keys.
In fact, the first letter of an address is not meaningful to the keys.

So let’s say I have TALICExxxx with pub key A and priv key B.
If I change the address to NALICExxx it will have the same pub key A and priv key B.

I don’t know if it is so on purpose, but what do you think? a pitfail? or a feature?


#2

That is known. A private / public key is just a sequence of 256 bit. You can use it in any network. The address in different networks will be different though, not only the first character but also at the end of the address string.
General rule of thumb is: Do not use the same private key in different networks!


#3

I see the tail of the address is also different.
Practically they are the same address, the algorithm that “builds” NEM addresses just puts a letter in front (T, N, M), and some kind of checksum at the end? Why not be totally different strings?

I sent my public key to get some data to a NIS Server, and I forgot to change the network, when I saw a result with 0 balance and I got :hushed:
The same public key was returning data in two networks!

Interesting, thanks!


#4

Why would there be a need for totally different string?