Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Fizak on August 29, 2017, 01:23:13 PM



Title: Question about SHA256 address
Post by: Fizak on August 29, 2017, 01:23:13 PM
So, a SHA256 private key is just a random 256 bits number. Does it means that I can use a bitcoin address on any coin using the SHA256 algo?
What about others algo?
I think I missed something.


Title: Re: Question about SHA256 address
Post by: achow101 on August 29, 2017, 02:05:45 PM
So, a SHA256 private key is just a random 256 bits number.
There is no such thing as "a SHA256 private key". SHA256 is not a private key generation algorithm, it is a hashing algorithm. Do not use SHA256 to generate your private keys as it is not secure. The data that you are hashing will most likely not be random enough to be a secure private key.

Private keys are ECDSA private keys, specifically private keys for the secp256k1 curve. They are just 256 bit random integers.

Does it means that I can use a bitcoin address on any coin using the SHA256 algo?
You can use your Bitcoin private keys with anything that uses ECDSA and secp256k1. You won't have the same address and the import formats will be different because there is additional encoding to differentiate so that people don't accidentally use the wrong addresses.


Title: Re: Question about SHA256 address
Post by: DannyHamilton on August 29, 2017, 02:11:58 PM
So, a SHA256 private key

What is a SHA256 private key?

A bitcoin private key is just a random number between 1 and 115792089237316195423570985008687907852837564279074904382605163141518161494336.

While the results of the SHA256 algorithm typically fall within that range, there is no need to use SHA256 when generating private keys. Any number chosen randomly enough will work.

Does it means that I can use a bitcoin address on any coin using the SHA256 algo?

That depends on the signature algorithm that the altcoin is using and how the altcoin generates their addresses.

What about others algo?

If the coin uses a different algorithm for generating addresses, then their address won't be the same for the same private key.

I think I missed something.

I think you missed a LOT.

  • You missed the fact that Bitcoin uses ECDSA key pairs.
  • You missed the fact that the standard version 1 Bitcoin addresses requires hashing the public key with SHA256
  • You missed the fact that the standard version 1 Bitcoin addresses requires hashing the SHA256 hash with RIPEMD160
  • You missed the fact that the standard version 1 Bitcoin addresses requires a version byte in the front that tells the wallet what to do with the address.
  • You missed the fact that the standard version 1 Bitcoin addresses requires the resulting value to be base58check encoded.


Title: Re: Question about SHA256 address
Post by: Fizak on August 29, 2017, 02:25:25 PM
Thanks for your answers! I go back to learn  ;D