Post
Topic
Board Development & Technical Discussion
Merits 8 from 2 users
Re: Python Request : Add, Subtract, Divide and Multiply Public Keys
by
NotATether
on 24/12/2021, 07:40:34 UTC
⭐ Merited by mocacinno (5) ,ETFbitcoin (3)
The issue was because the public keys were not being converted to secp256k1 points in the example. It should work now and print this:

Code:
$ python script.py
X: 0xf0c386f6714fe5940ec7e622d8ba2e5204c58cd71a9c73ca95fb0e4ec0e76d72
Y: 0x56cc1950b7e993f76df9848ad106789f49d1bee3f68d346e03024cd31b3ffcb8
(On curve <secp256k1>)
X: 0x6ccae81fef496780cab0b333a2712e867bda428f09fb4374628a16b164d48cf2
Y: 0x32141673b26e4302a3d33c9148d16c0445ae4e84c577352a47dceebb0a6cf0e6
(On curve <secp256k1>)
X: 0xea31f5d48f0c43969b607d592636e2443539e7a86ef1350dba0d9040a98fc378
Y: 0x9e324a7345f1b9c1ee964b82fe43492b8f0bc5186713d81f45d7488139e4b7c
(On curve <secp256k1>)
X: 0x97539272d59d6e75488df9a5628e7b0efc03b4fec79de246ac116ae40c05225a
Y: 0xc809e0056436079a426d5084fef7b806015f4138e1c544857a2a2bb1a7f80c2e
(On curve <secp256k1>)

What is k value?

k is equal to 1/i (one divided by 'i'). Because division is not directly possible on the curve, I raise the divisor to the (N-2)th power. Because when you do that and then take modulo N, that is equal to taking the (-1)th power.

[if I were to take the (N-1)th power instead, that would be like taking the 0th power because taking the Nth power gives us the 1st power - the exact same result because the group is cyclic - repeats itself over and over again.]