I am generating public key from my private key. I did in Java script and C#. but generated public keys are different. My Code in c# (KeyCore.NET):

PrivateKey pv = new PrivateKey(Globals.ProdDumpKeyVersion, "KwY7eRvXXFd7HPX4Zuv8STZMLsVSe2X22HkU24Av84W1Cb7Rd5Yh");
PublicKey pb = pv.PublicKey;

result for C# code is 16w4zZWjWnhfEasJcSbfDQeHJRk1LytPHF5ir1ZS9mtUD5adsdH and the result for javascript code is 16reZXagkyToongduimD25SEerXwP3MQ4n

I used KeyCore.NET and bitaddress

2 Answers 2


To a private key corresponds a unique public key.

In your case, 16reZXagkyToongduimD25SEerXwP3MQ4n is an address (the hash + encoding of a public key).

  • but what about: 16w4zZWjWnhfEasJcSbfDQeHJRk1LytPHF5ir1ZS9mtUD5adsdH ? is it incorrect?
    – arman
    Commented Aug 20, 2016 at 11:19
  • As the public key corresponding to the private key you included in your post (btw don't do that !!!) is '030d4018f164d58e41e0c5fb99eb5ec26b4f21fc8ad0db726d51a7cce60c75df0a', I don't know what 16..sdH is I must say
    – hartmut
    Commented Aug 20, 2016 at 12:14

The base58 number 16w4zZWjWnhfEasJcSbfDQeHJRk1LytPHF5ir1ZS9mtUD5adsdH is a base58Check encoding of the (compressed) public key:


which corresponds toKwY7eRvXXFd7HPX4Zuv8STZMLsVSe2X22HkU24Av84W1Cb7Rd5Yh, and whose address is 16reZXagkyToongduimD25SEerXwP3MQ4n. Note that your private key is actually a bit more than a private key. It is a 38 bytes number which is a base58Check encoding of a number which contains 34 bytes (rather than just 32 for a secret key). There is an additional version byte 0x80 at the beginning which indicates that the private key is to be used for the main bitcoin network (rather than a testing network). There is an additional 0x01 suffix byte at the end (just before the 4 checksum bytes) which indicate that the public key associated with this private key is to be generated in compressed form (33 bytes) rather than uncompressed form (65 bytes). So while it is true that your WIF representation of your secret key leads to a unique address (one corresponding to a compressed key on the main network), the actual 32 bytes secret, can potentially lead to 4 addresses (depending on compression status of the public key and type of network).

  • thank you sir! so I am clear now! we can convert base58 of public key i.e 16w4zZWjWnhfEasJcSbfDQeHJRk1LytPHF5ir1ZS9mtUD5adsdH to address 16reZXagkyToongduimD25SEerXwP3MQ4n with BitcoinAddress class of Bitcoin.KeyCore namespace! actually it is for human reading convenience. I like to vote up but can't!
    – arman
    Commented Aug 20, 2016 at 20:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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