Author

Topic: Relationship between public key and private key (Read 1474 times)

jr. member
Activity: 47
Merit: 2
February 04, 2024, 01:01:37 PM
#9
look
you forget a 0 before 2

correct value is =>>     Public key hex : 0400000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000

and this is =>> Public key ( wallet address p2pkh) :   16QaFeudRUt8NYy2yzjm3BMvG4xBbAsBFM


so , max private key hex : fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe
in clearly : 2^256 -1   or  16^64 -1

if calculate fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe  public key hex , result is : 04e0a65740c1c5148111a8305938c56322fbf345a18cb90cf48a788961c6b3ff918aaf0580fd9e8 be571e97bef4a067fa7911da0ff0e1a5f307fea63e3ecd903af
and publick key : 1JHzdjEL4xQ7yifAaQQKAfqPyAN92vfstP

and another

 public key hex : ( 0 )

public key ( wallet address p2pkh ) :  1FYMZEHnszCHKTBdFZ2DLrUuk3dGwYKQxh

SHA256   6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d
RipeMD-160   9f7fd096d37ed2c0e3f7f0cfc924beef4ffceb68

Add Version
Byte   009f7fd096d37ed2c0e3f7f0cfc924beef4ffceb68
Double


SHA256   7524061a0ca9cca8e0c2881fd447c20c821751e357dc7d960cd03cfc3b4cece0   

Add 4 Byte
Checksum   009f7fd096d37ed2c0e3f7f0cfc924beef4ffceb687524061a
   
Address   1FYMZEHnszCHKTBdFZ2DLrUuk3dGwYKQxh   
The correct key for your public key is this one.
Code:
0x000000000000000000000000000000014551231950b75fc4402da1732fc9bebd
You could get the correct key by doing your operation mod N. And N is
Code:
0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141
For the first address with funds you posted.
SHA-256 hash.
Code:
0x59ef1a5a00f35b1a722da56ca70b52a721f33998634d4fa4259301f170f7b6bd
RMD-160 hash.
Code:
0x3b4df4363caa9e3bd9da58020d3080be8230a4ae
Someone hashed the public key of point infinity and sent some funds to it, nobody has the private key for it.
member
Activity: 84
Merit: 37
I'm not sure what the reason is for your post.
I am as confused myself as, all I could find is alphanumeric codings and more codings with no proper explanation for someone like myself to have a head start in learning what these could be all about.

Or am in in the wrong place, perhaps am not just about what the basics might be and this space is just for a specific few as the responses show.

Help me understand. Can these be broken down any further than it already is?
Like, what is what and what is that,
Before diving straight to its derivations is come about?
That would do a lot of good for someone with the zeal to learn. I get it that there are pros her but, am obviously not and I wish to follow through.
newbie
Activity: 9
Merit: 0
I have already built a system that generates a wif and public key by entering a hexadecimal value. Of course, it has many features and does many things


I don't know what you know about crypto math and calculations, but I'll give you an example: the two public addresses below are both the same and correspond to a common hexadecimal private key, they just have a different generation process.


P2PKH Address   :  1HT7xU2Ngenf7D4yocz2SAcnNLW7rK8d4E

P2PSH Address  :  3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy



Probably, by giving the hexadecimal address of a special wallet, you will not be able to open that wallet. Because we have talked about this process on this page and you did not know it
newbie
Activity: 9
Merit: 0
look
you forget a 0 before 2

correct value is =>>     Public key hex : 0400000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000

and this is =>> Public key ( wallet address p2pkh) :   16QaFeudRUt8NYy2yzjm3BMvG4xBbAsBFM


so , max private key hex : fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe
in clearly : 2^256 -1   or  16^64 -1

if calculate fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe  public key hex , result is : 04e0a65740c1c5148111a8305938c56322fbf345a18cb90cf48a788961c6b3ff918aaf0580fd9e8 be571e97bef4a067fa7911da0ff0e1a5f307fea63e3ecd903af
and publick key : 1JHzdjEL4xQ7yifAaQQKAfqPyAN92vfstP

and another

 public key hex : ( 0 )

public key ( wallet address p2pkh ) :  1FYMZEHnszCHKTBdFZ2DLrUuk3dGwYKQxh

SHA256   6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d
RipeMD-160   9f7fd096d37ed2c0e3f7f0cfc924beef4ffceb68

Add Version
Byte   009f7fd096d37ed2c0e3f7f0cfc924beef4ffceb68
Double


SHA256   7524061a0ca9cca8e0c2881fd447c20c821751e357dc7d960cd03cfc3b4cece0   

Add 4 Byte
Checksum   009f7fd096d37ed2c0e3f7f0cfc924beef4ffceb687524061a
   
Address   1FYMZEHnszCHKTBdFZ2DLrUuk3dGwYKQxh   
jr. member
Activity: 47
Merit: 2
@aminsolhi, you and OP are both doing things the wrong way.

This is not a public key
Code:
400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
This can not be used as N,  it's just 2**256-1
Code:
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
This address has no known public key
Code:
16QaFeudRUt8NYy2yzjm3BMvG4xBbAsBFM
Besides the invalid one,  do you actually have a public key hashing to that address?

Using a non-prime value as either N or P,  will result invalid keys.
Now what exactly is your question?
newbie
Activity: 9
Merit: 0
orginaly this value:       
       var P = new bigInt('fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f',
            16); //2²⁵⁶ - 2³² - 2⁹ - 2⁸ - 2⁷ - 2⁶ - 2⁴ - 1
        var N = new bigInt('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 16);
        var ZERO = new bigInt(0);
        var SEVEN = new bigInt(7);
        var x = new bigInt('79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', 16);
        var y = new bigInt('483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8', 16);
        var ONE = new bigInt(1);
        var TWO = new bigInt(2);
        var THREE = new bigInt(3);
        var Pp1d4 = new bigInt('3fffffffffffffffffffffffffffffffffffffffffffffffffffffffbfffff0c', 16);
        var Nd2p1 = new bigInt('7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1', 16);

but i changed to this
        var P = new bigInt('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
            16); //2²⁵⁶ - 2³² - 2⁹ - 2⁸ - 2⁷ - 2⁶ - 2⁴ - 1
        var N = new bigInt('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 16);
        var ZERO = new bigInt(0);
        var SEVEN = new bigInt(7);
        var x = new bigInt('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 16);
        var y = new bigInt('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 16);
        var ONE = new bigInt(1);
        var TWO = new bigInt(2);
        var THREE = new bigInt(3);
        var Pp1d4 = new bigInt('3fffffffffffffffffffffffffffffffffffffffffffffffffffffffbfffff0c', 16);
        var Nd2p1 = new bigInt('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 16);


and now , result : i generate by any (private key hex)  this wallet address :

Public Key Hex : 4000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000

address: 16QaFeudRUt8NYy2yzjm3BMvG4xBbAsBFM

balance : 0.01075050 BTC


newbie
Activity: 16
Merit: 1
Was there a question in there somewhere?

Or some new piece of information you are sharing that we didn't previously know?

I'm not sure what the reason is for your post.

Its just information education purpose, math behind crypto
legendary
Activity: 3360
Merit: 4570
Was there a question in there somewhere?

Or some new piece of information you are sharing that we didn't previously know?

I'm not sure what the reason is for your post.
newbie
Activity: 16
Merit: 1
p = fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f

n = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140

cryptography point multiplication

private key 14

base point 1

x = 79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798
y = 483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8

Note : point multiplication
       private key is even only point doubling operation,
       If private key is odd point addition with before doubled point or initial point
       then double the point ( before doubled point )
       when the privatekey is less then 1 operation ended

step 1 : private key is even (14) so point addition is none         
         and just double base point x,y , 1 * 2 = 2
         x=c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5
         y=1ae168fea63dc339a3c58419466ceaeef7f632653266d0e1236431a950cfe52a
         and private key divided by 2 get 7 , 14 / 2 = 7

step 2 : now private key is odd (7) so process addition function. step 1 addition value plus doubled point so the addition point is 0(none) + 2 = 2
         x = c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5
         y = 1ae168fea63dc339a3c58419466ceaeef7f632653266d0e1236431a950cfe52a
         Now double the doubled point to get point 2 * 2 = 4
         x = e493dbf1c10d80f3581e4904930b1404cc6c13900ee0758474fa94abe8c4cd13
         y = 51ed993ea0d455b75642e2098ea51448d967ae33bfbdfe40cfe97bdc47739922
         and private key divided by 2 get 3 , 7 / 2 = 3

step 3 : now private key is odd (3) so process addition function. step 2 addition value plus doubled point so the addition point is 2 + 4 = 6
         x = fff97bd5755eeea420453a14355235d382f6472f8568a18b2f057a1460297556
         y = ae12777aacfbb620f3be96017f45c560de80f0f6518fe4a03c870c36b075f297
         Now double the doubled point to get point 4 * 2 = 8
         x = 2f01e5e15cca351daff3843fb70f3c2f0a1bdd05e5af888a67784ef3e10a2a01
         y = 5c4da8a741539949293d082a132d13b4c2e213d6ba5b7617b5da2cb76cbde904
         and privatekey divided by 2 get 3 , 3 / 2 = 1

step 4 : now private key is odd (1) so process addition function. step 3 addition value plus doubled point so the addition point is 6 + 8 = 14
         x = 499fdf9e895e719cfd64e67f07d38e3226aa7b63678949e6e49b241a60e823e4
         y = cac2f6c4b54e855190f044e4a7b3d464464279c27a3f95bcc65f40d403a13f5b
         Now double the doubled point to get point 8 * 2 = 16
         x = e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a
         y = f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821
         and privatekey divided by 2 get 1 , 1 / 2 = 0.5
         operation ended

at last the output x , y

private key 14 public keys are

x = 499fdf9e895e719cfd64e67f07d38e3226aa7b63678949e6e49b241a60e823e4
y = cac2f6c4b54e855190f044e4a7b3d464464279c27a3f95bcc65f40d403a13f5b

==================================================================
Even
same point multiplication, public key to private key here some operation

points are 8 public key ( half of all public key are even )

x = 2f01e5e15cca351daff3843fb70f3c2f0a1bdd05e5af888a67784ef3e10a2a01
y = 5c4da8a741539949293d082a132d13b4c2e213d6ba5b7617b5da2cb76cbde904

step 1 : half of 8 public keys to get 4 public keys
         x = e493dbf1c10d80f3581e4904930b1404cc6c13900ee0758474fa94abe8c4cd13
         y = 51ed993ea0d455b75642e2098ea51448d967ae33bfbdfe40cfe97bdc47739922
         and public keys is even ( 8 ) so just double, 1 * 2 = 2

step 2 : half of 4 public keys to get 2 public keys
         x = c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5
         y = 1ae168fea63dc339a3c58419466ceaeef7f632653266d0e1236431a950cfe52a
         and public keys is even (4) so just double, 2 * 2 = 4

step 3 : half of 2 public keys to get 1 public keys
         x = 79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798
         y = 483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8
         and public keys is even (2) so just double, 4 * 2 = 8

step 3 : public key is 1 so end the operation

at last the output 8

so the private key 8

--------------------------------------------------------------------------------------------------------------
Odd
points are 14 public key ( half of all public key even and odd public key entered ),
here we need to identify which public-key is odd and which is even

x = 499fdf9e895e719cfd64e67f07d38e3226aa7b63678949e6e49b241a60e823e4
y = cac2f6c4b54e855190f044e4a7b3d464464279c27a3f95bcc65f40d403a13f5b

step 1 : half of 14 public keys to get 7 public keys
         x =  5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc
         y =  6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da
         and public keys is even (14) so just double, 1 * 2 = 2

step 2 : half of 7 public key to get 7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a4 public key
         x =  592152c398d6c719636a03a6dad64246a5a6814aa62c156b0ce5332f6759b031
         y =  72dd2e1d26c233337760c49122a1df67d0aa792b453f97bd29765c83b47ba01d
         you can double above public key to get 7 public key x,y But we expect public key of 3 then only we     get private key back,
         so identify which public key is odd and which is even

---------------------------------------------------------------------------------------------------------------

here some analyse 7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a4 + 1 public key are

x =  66954eca0543426304036fc70fc0fe3381f5195e88433bc32c5a8a60341e2859
y =  f274e4ebbf160edc0c6379a70629b18201bf8e0f52578615bd114528b2c80733

double the above public key to get 9 public key

x =  acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe
y =  cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37

---------------------------------------------------------------------------------------------------------------

7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a4 - 1 public keys are

x =  5699b93fc6e1bd29e09a328d657a607b4155b61a6b5fcbedd7c12df7c67df8f5
y =  3eb81178ebcdab6894d1acb3196fd8b7d5a3cc237988cd5af7cc70f98cc978a7

double the above public key to get 5 public key

x =  2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4
y =  d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6

---------------------------------------------------------------------------------------------------------------

Note: n = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140

n / 2 = 7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0

7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0 + 5 == public key == half of 9 public key

7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0 + 4 == public key == half of 7 public key

7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0 + 3 == public key == half of 5 public key

7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0 + 2 == public key == half of 3 public key

7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0 + 1 == public key == - half of n public key

---------------------------------------------------------------------------------------------------------------

Note:

7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0 --> <= this private key public keys are (+ half public key)

x =  3b78ce563f89a0ed9414f5aa28ad0d96d6795f9c63
y =  3f3979bf72ae8202983dc989aec7f2ff2ed91bdd69ce02fc0700ca100e59ddf3


7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1  --> >= this private key public keys are (- half public key)

x =  3b78ce563f89a0ed9414f5aa28ad0d96d6795f9c63
y =  c0c686408d517dfd67c2367651380d00d126e4229631fd03f8ff35eef1a61e3c

---------------------------------------------------------------------------------------------------------------

my analyse half of even public key point goes down, but odd public key half goes higher >=  - half

Example:

8 public key half is 4 public key, but 7 public key half is 7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0 + 4

even public key half example

x = 2f01e5e15cca351daff3843fb70f3c2f0a1bdd05e5af888a67784ef3e10a2a01   ----->  8 public key
y = 5c4da8a741539949293d082a132d13b4c2e213d6ba5b7617b5da2cb76cbde904

8 public key half below get 4 public key

x = e493dbf1c10d80f3581e4904930b1404cc6c13900ee0758474fa94abe8c4cd13
y = 51ed993ea0d455b75642e2098ea51448d967ae33bfbdfe40cfe97bdc47739922

odd public key half example

x =  5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc  ----->  7 public key
y =  6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da

7 public key half below get 7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0 + 4 public key

x =  592152c398d6c719636a03a6dad64246a5a6814aa62c156b0ce5332f6759b031
y =  72dd2e1d26c233337760c49122a1df67d0aa792b453f97bd29765c83b47ba01d

-------------------------------------------------------------------------------------------------------------------

another analyse 7th half and 9th half public key make them further half to get different answer

7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0 + 5 == public key == half of 9 public key

7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0 + 4 == public key == half of 7 public key

now divide n into 4 half n/4 get 0x3fffffffffffffffffffffffffffffffaeabb739abd2280eeff497a3340d9050L


3fffffffffffffffffffffffffffffffaeabb739abd2280eeff497a3340d9050 --> below this, public keys are 1st half public keys

3fffffffffffffffffffffffffffffffaeabb739abd2280eeff497a3340d9050 --> above this, and 7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0 --> below this public keys are 2nd half public keys

7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0 --> above this, and bfffffffffffffffffffffffffffffff0c0325ad0376782ccfddc6e99c28b0f1 --> below this public keys are 3rds half public keys

bfffffffffffffffffffffffffffffff0c0325ad0376782ccfddc6e99c28b0f1 --> above this, public keys are 4th half public keys

-----------------------------------------------------------------------------------------------------------------

7 public key half below get 7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0 + 4 public key

x =  592152c398d6c719636a03a6dad64246a5a6814aa62c156b0ce5332f6759b031
y =  72dd2e1d26c233337760c49122a1df67d0aa792b453f97bd29765c83b47ba01d

half of above 7 publickey half to get 3fffffffffffffffffffffffffffffffaeabb739abd2280eeff497a3340d9052 public key it goes 2 nd half

x =  13780453c56d0cc911a106e74dbf49e743e46396dc09e42dba4aeaff970bacef
y =  8888029b003fb198c81ecabd9f7992df7a73d33734c0a71ca4ba0f4a7f607be6

-----------------------------------------------------------------------------------------------------------------

9 public key half below get 7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0 + 5 public key

x =  66954eca0543426304036fc70fc0fe3381f5195e88433bc32c5a8a60341e2859
y =  f274e4ebbf160edc0c6379a70629b18201bf8e0f52578615bd114528b2c80733

half of above 9 public key half to get bfffffffffffffffffffffffffffffff0c0325ad0376782ccfddc6e99c28b0f3 public key it goes 4 th half

x =  a09125a449d92c03a1c677a0a276cf157cb3fc0ad313b2526aca7d6c9808363
y =  5bd9757b686012ee83b1546139bbb4f73b2ad4e0af198cdfdf7e649266b2a8c

------------------------------------------------------------------------------------------------------------------
Below picture to understand clear

Even public key

http://virtacoin.do.am/images/1.png

Odd public key 7

http://virtacoin.do.am/images/2.png

Odd public key 9

http://virtacoin.do.am/images/3.png
Jump to: