Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Hyphen(-) on March 09, 2022, 01:24:50 PM



Title: I need help on How to easily Generate Public key from private key.
Post by: Hyphen(-) on March 09, 2022, 01:24:50 PM
Hello there, everyone! I'm new to the forum and I want to learn more about bitcoin. I go a step further and study about key and address since I believe it is the first step in understanding how to keep my bitcoin safe.
During my investigation, I discovered how crucial private keys are. I discovered that the private keys to a Bitcoin wallet are generated randomly, which means they are a collection of random numbers. It's also made clear that public keys are created from private keys using the Elliptic curve  multiplication; secp256k1 in specific.
I understand that Elliptic curve multiplication is been used because it has a Trapdoor function, which makes it difficult to reverse the process, that is no one can reganarate private key from public key.

my question is, is there any alternative mathematical method of generating public keys from private keys apart from Elliptic curve secp256k1?
This is because it's beyond my comprehension, and I'd like to know how I can generate my public keys from my private keys. Thank you very much.


Title: Re: I need help on How to easily Generate Public key from private key.
Post by: BlackHatCoiner on March 09, 2022, 01:31:43 PM
If you want to generate a public key that is valid in secp256k1, then you're limited to its borders; you need it. To find a point in an elliptic curve, you either multiply an already existing starting point (usually referred to as G) with a number, a procedure called Elliptic Curve Multiplication, or add a point to another point, which is called Elliptic Curve Addition.

Learn more: https://learnmeabitcoin.com/beginners/public_keys


Title: Re: I need help on How to easily Generate Public key from private key.
Post by: o_e_l_e_o on March 09, 2022, 01:43:20 PM
my question is, is there any alternative mathematical method of generating public keys from private keys apart from Elliptic curve secp256k1?
Yes, there are several different asymmetric cryptography algorithms other than elliptic curve cryptography which can be used to produce a public key from a private key, and even within elliptic curve cryptography, there are several different curves which can be used other than secp256k1. All of this is irrelevant to bitcoin though. The bitcoin protocol only uses the secp256k1 elliptic curve. If you create a public key in some other manner, then you will not be able to spend from the resulting address because you will not be able to produce a valid signature.


Title: Re: I need help on How to easily Generate Public key from private key.
Post by: Zilon on March 09, 2022, 03:25:32 PM
There are many cryptographic curves but bitcoin uses Secp256k1 for it's ownhashing cryptography. This alphanumeric keys collectively forms a cryptographic curve. To get an elliptic curve for public key cryptography some parameters are well defined:
  • We define the two axis a and b of the curve Y2=x3+ax+b
    • We also define the prime of the finite field (https://www.google.com/search?q=a+finite+field&oq=a+finite+fi&aqs=chrome.3.69i57j0i512l2j0i22i30l5j0i390l2.11256j1j9&sourceid=chrome&ie=UTF-8) p
      • The x and y co-ordinate too of the generator point G is defined
      • Lastly we specify the order of the group, generated by G,n
      with all this defined the parameter for Secp256k1 a=0 and b = 7 giving up a general formula of y2 = x3+7
      With all this defined it is only with elliptic curve cryptography bitcoin public keys are generated from it's corresponding private key since the concept of finite fields and elliptic curves are incorporated.
      you can learn more about this here (https://www.oreilly.com/)


Title: Re: I need help on How to easily Generate Public key from private key.
Post by: DannyHamilton on March 09, 2022, 04:39:26 PM
There are many cryptographic curves but bitcoin uses Secp256k1 for it's own hashing signing.

FTFY.

Bitcoin uses the Secp256k1 cureve for ECDSA signing.  It uses SHA256 and RIPEMD160 for most of its hashing.


Title: Re: I need help on How to easily Generate Public key from private key.
Post by: alexeyneu on March 17, 2022, 06:22:52 AM
just did ctrl+f about galois on this page. 0 results ofc.


Title: Re: I need help on How to easily Generate Public key from private key.
Post by: PawGo on March 17, 2022, 07:45:08 AM
my question is, is there any alternative mathematical method of generating public keys from private keys apart from Elliptic curve secp256k1?

You ask two questions, you should be more precise. It is like asking "Is there any other way to travel than by car fiat 500"?
1) Do you want to generate keys for other Elliptic curve? Secp256k1 is just a specific curve, it is like saying that fiat 500 is just a one model of car. You may have different curves (defined by different initial parameters), BUT if you talk about bitcoin, you must use the specific one - Secp256k1
2) Do you want to generate keys not using Elliptic curve? You may travel by train of plane, it is not necessary to use car. For example you may read what is used in case of RSA (hint: prime numbers).

just did ctrl+f about galois on this page. 0 results ofc.


Does it change anything?
https://static.wikia.nocookie.net/math/images/c/c8/Evariste_Galois.jpg/revision/latest/scale-to-width-down/250?cb=20111230121338&path-prefix=ro



Title: Re: I need help on How to easily Generate Public key from private key.
Post by: alexeyneu on March 17, 2022, 07:53:25 AM
yeah it does. you ,for example, should know what is galois fields before write something here


Title: Re: I need help on How to easily Generate Public key from private key.
Post by: NotATether on March 17, 2022, 03:40:26 PM
my question is, is there any alternative mathematical method of generating public keys from private keys apart from Elliptic curve secp256k1?

Sure there is. The fact is that secp256k1 is just one of the many curves defined on a Galois field (greetings to alexeyneu), so they all share the same basic fundamental properties of Galois fields, namely:

- All curves are cyclic and it is possible to generate any point on the curve by repeatively multiplying it by itself (taking its exponent to some random integer power)
-  (k + l) * G = k * G + l * G , where G is a random point and k and l represent large numbers (the private key) -  this demonstrates that if the sum of two private keys is greater than the curve order (maximum private key - 1) then addition will just wrap around like modular arithmetic.
- Likewise, modular inverse is also possible on all curves, because it is just raising to the power of negative values, which is equivalent to cycling through the points backwards.

There are already some cryptos that use alternative curves such as Monero (Edwards25519) and Ontology (https://www.susanka.eu/coins-crypto/) (uses NIST P-256), but the vast majority of cryptocurrencies are using either secp256k1 or Edwards25519.


Title: Re: I need help on How to easily Generate Public key from private key.
Post by: Hyphen(-) on March 28, 2022, 07:40:18 PM
I want to thank each and everyone for the reply and feedback on my question. I feel loved and i feel highly welcomed in this amazing forum. thank you all.


Title: Re: I need help on How to easily Generate Public key from private key.
Post by: Asiska02 on April 02, 2022, 03:01:30 PM
You can only get a valid signature by using the elliptic curve multiplication method for generating public keys.
The advantage of using an elliptic curve function is that:
1. The process of creating the public key can’t be reversed (e.g by dividing the co-ordinates of the public key to get the initial private key)
2. The whole process is mathematically connected, therefore one can boast to own a private key by given out its public key during a bitcoin transaction. You can’t give out an account number to send money into when you don’t know the password to be able to spend the money.