Pages:
Author

Topic: Point addition / Point concatenate - page 2. (Read 1052 times)

full member
Activity: 162
Merit: 230
April 27, 2021, 05:05:04 PM
#32
I got curious and wondered where you got 0x70ac8110203e9f95f8d832964b58ccc2c712bb1c6cd58e861134b48f456c9b53 from, and discovered that it's what happens when you try to decompress a point with the x coordinate set to 0. Note that there are NO points on the secp256k1 curve with 0 as a valid x coordinate, this just happens because that iancoleman site doesn't check point validity at all.

If you enter 030000000000000000000000000000000000000000000000000000000000000000 into the iancoleman site, you get x=0 and y=0x70ac8110203e9f95f8d832964b58ccc2c712bb1c6cd58e861134b48f456c9b53 - which makes me yet again wonder what the hell you are trying to do.

Could you try to explain a bit more what your goal is?
full member
Activity: 162
Merit: 230
April 27, 2021, 04:09:51 PM
#31
I don't know where you got 0x70ac8110203e9f95f8d832964b58ccc2c712bb1c6cd58e861134b48f456c9b53 from, but (x,y) = (0xeb611af1fd2e89e5361028f25d1a5510a4bc477757be925a594ce17436afe403, 0x70ac8110203e9f95f8d832964b58ccc2c712bb1c6cd58e861134b48f456c9b53) is NOT a valid point on the secp256k1 curve.


The valid y coordinates for x = 0xeb611af1fd2e89e5361028f25d1a5510a4bc477757be925a594ce17436afe403 are:

0x84125d3056d8364cf8962165f479d3da6f2ebc096f792df0ba484d8d703c0667 (you got that one) and
0x7beda2cfa927c9b30769de9a0b862c2590d143f69086d20f45b7b2718fc3f5c8

Since point compression takes just the lower bit of the y coordinate to set the prefix to either 0x02 or 0x03, the fact that you have an INVALID y coordinate which has the same lowest bit as the valid one, means point compression of course gives the same result.
member
Activity: 348
Merit: 34
April 27, 2021, 03:38:06 PM
#30
these all are simple math ecc addition, remain Q is point concatenate base on formula, where at curve or not at curve,
my logics are beyond your thinking by point concatenate, where i have reach is same address with x same 2 difrent y's
see below

1FQYNQGz32BDLcSBC4Kz54mErjzB7kbL1N
1FQYNQGz32BDLcSBC4Kz54mErjzB7kbL1N

1NWYqgBKDgJ3X8JnxynVRJeHxpsabPAcK8
1MfnBBkWkcXTQSvSucgCrh3D1WpvdV7DCM

see compressed address
04eb611af1fd2e89e5361028f25d1a5510a4bc477757be925a594ce17436afe40370ac8110203e9 f95f8d832964b58ccc2c712bb1c6cd58e861134b48f456c9b53
at y is 70ac8110203e9f95f8d832964b58ccc2c712bb1c6cd58e861134b48f456c9b53
03eb611af1fd2e89e5361028f25d1a5510a4bc477757be925a594ce17436afe403
see uncompressed address

04eb611af1fd2e89e5361028f25d1a5510a4bc477757be925a594ce17436afe40384125d3056d83 64cf8962165f479d3da6f2ebc096f792df0ba484d8d703c0667
at y is 84125d3056d8364cf8962165f479d3da6f2ebc096f792df0ba484d8d703c0667
where y is difrent but in both cases compressed address is same
uncompressed addresses are difrent

check here
https://iancoleman.io/bitcoin-key-compression/

legendary
Activity: 2268
Merit: 18771
April 27, 2021, 02:43:23 PM
#29
-snip-
You need to use the multiplicative inverse, which every number will have since p is prime.

So, using your notation, you would do:

(By - Ay) * (Bx - Ax)-1 mod p

So, as an example let's use the curve y2 = x3 + 7 mod 31, and lets use points (5,16) and (7,28)

s = (28-16)/(7-5) mod 31
s = 12/2 mod 31

The multiplicative inverse of 2 mod 31 is 16, so

s = 12*16 mod 31 = 6

Cx = 62 - 5 - 7 mod 31 = 24
Cy = 6*(5 - 24) - 16 mod 31 = -6 = 25

So the point C is (24,25).

The python command you would be looking for is:

Code:
l=(By-Ay) * libnum.invmod(Bx-Ax,p)
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
April 27, 2021, 12:58:10 PM
#28
Did you just convert the Wikipedia equations to code? This will not work at all, because the calculation has to be done modulo the characteristic of the elliptic curve's field, everything should be done mod 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f

Yes that's what I did, I kind of got the idea something was wrong when these calculations made large negative numbers for OP's output instead of points on the curve.

I guess I have to mod each addition/subtraction by this, and can't defer it to the end of the line right? E.g

Code:
l = ((By - Ay) mod p) / ((Bx - Ax) mod p)  mod p

versus:

Code:
l = (By - Ay)/(Bx - Ax) mod p

(I'll get to the edge cases later, for now let's get this clarified.)
full member
Activity: 162
Merit: 230
April 27, 2021, 09:27:46 AM
#27
your formula if write in python, will help me to understand, kindly write python script, thankx

Code:
def point_add(Ax, Ay, Bx, By):
    """Point addition of points (Ax, Ay) and (Bx, By)"""
    
    l = (By - Ay)//(Bx - Ax)
    Cx = l**2 - Ax - Bx
    Cy = l*(Ax - Cx) - Ay
    return Cx, Cy   # Point (Cx, Cy) = (Ax, Ay) + (Bx, By)

small edit: the code was full of no-break spaces

Note that you will have to unserialize your hex numbers into integers before you can pass them here. The integer type in Python (unlike in other languages) is infinite-precision.



 File "main.py", line 33
    lambda = (By - Ay)/(Bx - Ax)
           ^
SyntaxError: invalid syntax

Right. lambda is a keyword in Python so I have to name it something else. See the edited code.

Did you just convert the Wikipedia equations to code? This will not work at all, because the calculation has to be done modulo the characteristic of the elliptic curve's field, everything should be done mod 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f

Also this code does not account for the special cases where points have the same X coordinates.

Instead, take a look at https://stackoverflow.com/questions/31074172/elliptic-curve-point-addition-over-a-finite-field-in-python

(I still have no idea what OP is trying to do, and I suspect they don't know themselves either)
member
Activity: 211
Merit: 20
$$$$$$$$$$$$$$$$$$$$$$$$$
April 27, 2021, 07:25:45 AM
#26
@brainless I don't see any advantage in calculating this ... Maybe just out of curiosity? Any personal projects or research? Or did you discover something interesting?
member
Activity: 348
Merit: 34
April 27, 2021, 07:09:32 AM
#25
P + G = PG

hex prvkey is abc
x: 3ef30130654689a64c864d6dd38760481c55fc525e2c6c7084e2d2d3d4d51be9
y: f7d86b288c09ddb5311f292285168000e43e4b62201bd8de23a391daa8e00ce8

hex prvkey is def
x: 6a6e1dc6f203f7fdd97965892301e5fb995a37318c410543835f0edcd3456c49
y: 2a072b9898b93e9eb05f9ad86a97546d83b579bf6efd3482f93baca13784496b


result = hex prvkey is abcdef:

x: 12faae608bd6562562b8f85564664cd1fdcd667f6b24b2b221ef86b9231f4d74
y: 512ee8cd9b34331afd05ccb8d81d1393c150c73ec5695845b731f7e6e0086719

Let me see if I understand ....

Instead:

2 + 1 = 3
3 + 4 = 7

You want this:

2 + 1 = 21
3 + 4 = 34

?
yes
member
Activity: 211
Merit: 20
$$$$$$$$$$$$$$$$$$$$$$$$$
April 27, 2021, 06:55:12 AM
#24
P + G = PG

hex prvkey is abc
x: 3ef30130654689a64c864d6dd38760481c55fc525e2c6c7084e2d2d3d4d51be9
y: f7d86b288c09ddb5311f292285168000e43e4b62201bd8de23a391daa8e00ce8

hex prvkey is def
x: 6a6e1dc6f203f7fdd97965892301e5fb995a37318c410543835f0edcd3456c49
y: 2a072b9898b93e9eb05f9ad86a97546d83b579bf6efd3482f93baca13784496b


result = hex prvkey is abcdef:

x: 12faae608bd6562562b8f85564664cd1fdcd667f6b24b2b221ef86b9231f4d74
y: 512ee8cd9b34331afd05ccb8d81d1393c150c73ec5695845b731f7e6e0086719

Let me see if I understand ....

Instead:

2 + 1 = 3
3 + 4 = 7

You want this:

2 + 1 = 21
3 + 4 = 34

?
member
Activity: 348
Merit: 34
April 26, 2021, 06:52:50 PM
#23
here we are taking as hex
b+d =bd
where b is one point and d is 2nd point, result should be bd point in concatenation
for your easy dec result will be 189 not 1113

I guess you do understand that this concatenation you're doing is not point addition but rather a different operation (which makes me feel better), so now you're looking for math properties of this concatenation thing?

Well for starters the operation you're doing is equal to a*len(b)*4 + b [there are 4 bits in a hex char] in terms of the real addition so so you should be able to use it almost anywhere you need an Ax + B style expression.
this is simple math operation to calc, a*len(b)*16 + b
but based on x,y points, there will be 2 snaorio, if concatenate under mod p, will be calculated, and result will apear on curve other not at curve, that will be apear based on point formula,
and if operation everything will be on curve always
member
Activity: 348
Merit: 34
April 26, 2021, 03:15:24 PM
#22
chinese remainder theorem

https://math.stackexchange.com/questions/317637/combine-two-given-elliptic-curves

any commnet related to our research ?
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
April 26, 2021, 01:31:12 PM
#21
here we are taking as hex
b+d =bd
where b is one point and d is 2nd point, result should be bd point in concatenation
for your easy dec result will be 189 not 1113

I guess you do understand that this concatenation you're doing is not point addition but rather a different operation (which makes me feel better), so now you're looking for math properties of this concatenation thing?

Well for starters the operation you're doing is equal to a*len(b)*4 16 + b [there are 4 bits in a hex char] in terms of the real addition so so you should be able to use it almost anywhere you need an Ax + B style expression.
member
Activity: 348
Merit: 34
April 26, 2021, 01:22:37 PM
#20
Impossible, not real and not logical.

movie name mission impossible, always done at possible, i believe some math expert have solution, Smiley
member
Activity: 259
Merit: 47
April 26, 2021, 12:28:20 PM
#19
Impossible, not real and not logical.
member
Activity: 348
Merit: 34
April 26, 2021, 11:57:00 AM
#18
hex b dec 11
x: 774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb
y: d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b

hex d dec 13

x: f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8
y: 0ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81

result should be
hex bd dec 189
x: 6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859
y: cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10
member
Activity: 348
Merit: 34
April 26, 2021, 10:02:16 AM
#17
Here you write 1 + 1 = 11
And in what system should this be applied? Decimal, hex, or maybe binary?
For example, two numbers in hex b(11) and d(13)
In hex
b + d = bd
But in dec
11 + 13 = 1113
But
hex bd = dec 189 and not equal 1113 from previso result
So which system should you use as a basis for concatenation?
If decimal
X + Y = XY
in mathematic

X*strpad('1', len(Y)+1, '0', right) + Y

But in Hex it is completely different!

But if we transfer this to the points of coordinates, then nothing will work, because the length of Y is not known.

here we are taking as hex
b+d =bd
where b is one point and d is 2nd point, result should be bd point in concatenation
for your easy dec result will be 189 not 1113
member
Activity: 259
Merit: 47
April 26, 2021, 04:10:53 AM
#16
Here you write 1 + 1 = 11
And in what system should this be applied? Decimal, hex, or maybe binary?
For example, two numbers in hex b(11) and d(13)
In hex
b + d = bd
But in dec
11 + 13 = 1113
But
hex bd = dec 189 and not equal 1113 from previso result
So which system should you use as a basis for concatenation?
If decimal
X + Y = XY
in mathematic

X*strpad('1', len(Y)+1, '0', right) + Y

But in Hex it is completely different!

But if we transfer this to the points of coordinates, then nothing will work, because the length of Y is not known.
legendary
Activity: 2268
Merit: 18771
April 25, 2021, 03:05:21 PM
#15
if its not 1+1 = 2
then could be 1+1 = 11
No, it is neither 1+1 = 2 nor is it 1+1 = 11. The correct answer has been given by NotATether in the first reply in this thread.

Graphically, you plot the two points on the curve, draw a straight line between them, extend that straight line to find the third point where it intersects the curve, and then reflect that third point across the x axis to find your answer.

Algebraically, you use the equations given above.

This is explained on page 8 of the link you gave, with the (slightly more complicated) equations given on page 10.
member
Activity: 348
Merit: 34
April 25, 2021, 02:54:59 PM
#14
here http://web.math.princeton.edu/swim/SWIM%202010/Yao-Zhan%20Presentation%20SWIM%202010.pdf
page 5
Adding points is not the same addition as
1+1=2.
this line make me thinking
if its not 1+1 = 2
then could be 1+1 = 11
just this make me thinking different and test
legendary
Activity: 2268
Merit: 18771
April 25, 2021, 02:47:27 PM
#13
but what i am looking addition like example in hex prvkeys based on x,y points
abc
def
abc+def = abcdef
Well first, these aren't private keys but rather points on the curve, which would be public keys if anything.

Yes, I guess you could concatenate two points together. You could take the two x coordinates:
Code:
3EF30130654689A64C864D6DD38760481C55FC525E2C6C7084E2D2D3D4D51BE9
6A6E1DC6F203F7FDD97965892301E5FB995A37318C410543835F0EDCD3456C49

Concatenate them together:
Code:
3EF30130654689A64C864D6DD38760481C55FC525E2C6C7084E2D2D3D4D51BE96A6E1DC6F203F7FDD97965892301E5FB995A37318C410543835F0EDCD3456C49

Modulo p:*
Code:
0D1C311FC0BD9915B98E45F586FE55821BAE99FB78ADB182BCCDC84652001073

And then calculate the two corresponding y coordinates:
Code:
76C85E288DE490C4281D4E5C94F930900FABA66B47B4CF1788C657BAF15C9BBA
8937A1D7721B6F3BD7E2B1A36B06CF6FF0545994B84B30E87739A8440EA36075

I have no idea why you would want to do such a thing though. Care to explain what you are trying to achieve here?



*p is the finite field over which the secp256k1 curve is defined:
Code:
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F
Pages:
Jump to: