Bitcoin Forum
June 02, 2024, 09:20:50 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Bitcoin / Development & Technical Discussion / Re: Doubling the private key range on: April 24, 2016, 04:41:09 AM
Double?  Just add one bit to the representation and limits of each.

You should be able to find those lines in Bitcoin Core.
I'm pretty sure that is not how it works. The secp256k1 curve is only for 256 bit private keys. To double the range, you be using 257 bit private keys and that would require an entirely different curve.

if the range half means

n = 1 to ( FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140 / 2 )
2  Bitcoin / Development & Technical Discussion / Doubling or half of the private key range on: April 23, 2016, 01:24:42 PM
bitcoin private key range

n = 1 to FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140

and

p = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F

bitcoin public key

x =  592152c398d6c719636a03a6dad64246a5a6814aa62c156b0ce5332f6759b031
y =  72dd2e1d26c233337760c49122a1df67d0aa792b453f97bd29765c83b47ba01d

x = 79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798
y = 483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8

x= c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5
y= 1ae168fea63dc339a3c58419466ceaeef7f632653266d0e1236431a950cfe52a

x = e493dbf1c10d80f3581e4904930b1404cc6c13900ee0758474fa94abe8c4cd13
y = 51ed993ea0d455b75642e2098ea51448d967ae33bfbdfe40cfe97bdc47739922


Need to double (or) half the range of private key , so how to convert the bitcoin public key into doubled (or) half private key range

 
n = 1 to ( FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140 * 2 ) OR

n = 1 to ( FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140 / 2 )

Thank all
3  Bitcoin / Development & Technical Discussion / Re: how base point of bitcoin public key x , y formed on: April 23, 2016, 01:09:05 PM
how this base point x , y formed please explain in clear and brief with some example

Huh

Um...

It is "formed" by plotting the Gx value as the X-coordinate and the Gy value as the Y-coordinate on a Cartesian plane.

If you are asking who chose those values for the base point in the secp256k1 curve, and why, then I believe they were chosen by the Standards for Efficient Cryptography Group. I don't think they specified exactly how they came up with that particular point for the base point.

If you are asking who decided that bitcoin would use the secp256k1 curve, and why they chose that curve, the secp256k1 curve was chosen by Satoshi Nakamoto, and he didn't specify why he chose that curve.

Than You
4  Bitcoin / Development & Technical Discussion / how base point of bitcoin public key x , y formed on: April 22, 2016, 07:43:06 AM
n = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140

p = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE FFFFFC2F

base point of bitcoin public key x , y

Gx = 79BE667E F9DCBBAC 55A06295 CE870B07 029BFCDB 2DCE28D9 59F2815B 16F81798

Gy = 483ADA77 26A3C465 5DA4FBFC 0E1108A8 FD17B448 A6855419 9C47D08F FB10D4B8

private key of above public key is 1

how this base point x , y formed please explain in clear and brief with some example

Thank all
5  Bitcoin / Development & Technical Discussion / Re: Relationship between public key and private key on: November 18, 2015, 04:09:13 AM
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
6  Bitcoin / Development & Technical Discussion / Relationship between public key and private key on: November 17, 2015, 09:05:18 AM
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



Odd public key 7



Odd public key 9

7  Bitcoin / Development & Technical Discussion / bitcoin weakness private key loosed what to do ! on: October 02, 2015, 02:47:49 AM
private key loosed what to do !

Many one ask this question if i loose my private key what happen , each every bitcoin user know the coin from that address are gone ( some one take the coin )

How to avoid this in feature development . This is the one weakness in bitcoin ,

If some one bitcoin address that contain some bitcoin ( 1 or something ) the secret leaked ,

That the leaked address secret not any one used to take those coin from that address ,

only who is the real owner of that address he/she only spend those coin ,

this condition need ( if the secret leaked no problem condition need )

any ideas , algorithm , scripts , etc .......... discuss here it help feature development

Contribute : your  ideas , algorithm , scripts , etc ..........

Thank you all.................
8  Bitcoin / Development & Technical Discussion / Determine if a public key point y is negative or positive, odd or even? on: September 22, 2015, 09:07:12 AM
Take a bitcoin public key (x, y) and its additive inverse (x, -y). How do you identify which is the positive point and which is the negative point?

Example

Private key 1 -> (x, y)

x = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798L

y = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8L

-y = 0xb7c52588d95c3b9aa25b0403f1eef75702e84bb7597aabe663b82f6f04ef2777L

Private key 2 -> (x, y)

x = 0xc6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5L

y = 0x1ae168fea63dc339a3c58419466ceaeef7f632653266d0e1236431a950cfe52aL

-y = 0xe51e970159c23cc65c3a7be6b99315110809cd9acd992f1edc9bce55af301705L

Private key 3 -> (x, y)

x = 0xf9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9L

y = 0x388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672L

-y = 0xc77084f09cd217ebf01cc819d5c80ca99aff5666cb3ddce4934602897b4715bdL

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

Also, how can you identify which pub key is odd and which is even?

ex: private key 1 x,y is odd , private key 2 x,y is even (based with pub key)

--------------------------------------------------------------------------------------------------------------------------
addition info :

bitcoin doubling pub key

In normal math number 7/2 results are 3 and 1 if we need 7 back 3*2 = 6 + 1 = 7

elliptical curve cryptography

private key 7 pub key are

x = 0x5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bcL

y = 0x6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264daL

Getting 7 pub key back by , just doubling below given pub key to get 7 pub key

x = 0x592152c398d6c719636a03a6dad64246a5a6814aa62c156b0ce5332f6759b031L

y = 0x72dd2e1d26c233337760c49122a1df67d0aa792b453f97bd29765c83b47ba01dL

Like the same for 3,5,9,11......etc

Just education

--------------------------------------------------------------------------------------------------------------------------
9  Bitcoin / Development & Technical Discussion / Re: x , y coordination division on: August 07, 2015, 02:23:47 AM
Hi sss555,

Sorry I missed your message about this the other day about this.

From reading your code I understand you have some point P, then 2*P = (xx, yy) while 4*P = (xx, yy). You then compute (a, b) = (xx/2, yy/2), and expect this to be equal to 2*P.

This won't be the case because "2*P" does not mean "the point whose coordinates are twice P's". It actually means P + P, where addition is defined according to the elliptic curve group law.

To contrast, when you multiply coordinates by numbers, you are simply multiplying them modulo p. This can still be described as repeated addition, but this addition is ordinary arithmetic addition modulo p, nothing exotic.

Does this clarify things?

Andrew



Thank you I understand
10  Bitcoin / Development & Technical Discussion / x , y coordination division on: August 06, 2015, 03:15:40 AM
python code

def inverse(x, p):

    return pow(x,p-2,p)

p = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f

#private key 2 -->(x , y) value

xx =  0xc6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5L
yy =  0x1ae168fea63dc339a3c58419466ceaeef7f632653266d0e1236431a950cfe52aL

#private key 4 -->(x , y) value

x  =  0xe493dbf1c10d80f3581e4904930b1404cc6c13900ee0758474fa94abe8c4cd13L
y  =  0x51ed993ea0d455b75642e2098ea51448d967ae33bfbdfe40cfe97bdc47739922L

a= (x*inverse(xx,p))%p

print "x = " + hex(a)

b= (y*inverse(yy,p))%p

print "y = " + hex(b)

output

x = 0x1d8a71dd4218a520a1f976b6a4f66ed600880baf69d401a73dd010dd60f859ffL
y = 0x8f73b0d00f8d9e262cc230b7a6bee35d44ac898986195e819d68ecafd6b7803bL

normal math 4/2 = 2

but here private key 2 x,y value divided by private key 4 x,y value, not provide correct value of x,y

bitcoin , math learning
11  Bitcoin / Development & Technical Discussion / Re: how to get X value from Y on: July 26, 2015, 04:21:27 AM
Thank you andytoshi, development purpose I ask this question
12  Bitcoin / Development & Technical Discussion / how to get X value from Y on: July 24, 2015, 02:44:58 AM
http://bitcoin.stackexchange.com/questions/38740/bitcoin-how-to-get-x-value-from-y

How to get X value from Y?



here getting y value from x

X = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798

Python code,

p = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f
x = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
ysquared = ((x*x*x+7) % p)   
print "ysquared= %s " % hex(ysquared)   
y = pow(ysquared, (p+1)/4, p)
print "y1 = %s " % hex(y)
print "y2 = %s " % hex(y * -1 % p)

Output
Y1 = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8
Y2 = 0xb7c52588d95c3b9aa25b0403f1eef75702e84bb7597aabe663b82f6f04ef2777

print hex((x**3 + 7 - y1**2) % p)  // output 0

print hex((x**3 + 7 - y2**2) % p) // output 0



above python code to get Two possible y values from x

like the same how to get possible x values from y?,

Is it any formula or script available

My question is how to get x value from y

13  Bitcoin / Development & Technical Discussion / Re: Check if your BTC-key is vulnerable on: June 12, 2015, 10:50:43 AM
Hi,

thought maybe someone can use the script below. I just wrote it to check couple of my public keys for reused R-signing values which allow generating of the private key of affected PKs. The script is very lightweight and uses urllib2 for loading the data from blockchain.info. So no local btc-node is needed. The script only works for keys with up to 50 tx. If your key got more than 50 tx you have to add some lines (add loop and use optional API-parameters limit and offset to parse through all transactions [50+]). Also the script contains a lot of debug-output which you can just comment or remove.
This is OpenSource and BETA software - USE AT OWN RISK - released under GNU Public License.


Code:
#!/usr/bin/python


#################################################################################
#                                                                               #
#.______               _______.  ______     ___      .__   __.                  #
#|   _  \             /       | /      |   /   \     |  \ |  |                  #
#|  |_)  |    ______ |   (----`|  ,----'  /  ^  \    |   \|  |                  #
#|      /    |______| \   \    |  |      /  /_\  \   |  . `  |                  #
#|  |\  \----.    .----)   |   |  `----./  _____  \  |  |\   |                  #
#| _| `._____|    |_______/     \______/__/     \__\ |__| \__|  v0.1.2          #
#                                                                               #
#GNU PL - 2015 - ca333                                                          #
#                                                                               #        
#USE AT OWN RISK!                                                               #
#################################################################################

import json
import urllib2
import time
import sys

#for some reason blockchain.info api-chain is 59711 blocks short..
blockstart = 170399
blockstart += 59711
blockcount = urllib2.urlopen("https://blockchain.info/de/q/getblockcount").read()

print "WELCOME TO R-scan v0.1.2!"

print "ADDRESS-R-SCAN: "
addr = raw_input("type address:  ")
urladdr = "https://blockchain.info/de/rawaddr/" + str(addr)
#control api-url
print urladdr
addrdata = json.load(urllib2.urlopen(urladdr))
print "Data for pubkey: " + str(addr)
print "number of txs: " + str(addrdata['n_tx'])
#tx-details:
y = 0
inputs = []
while y < addrdata['n_tx']:
print "#################################################################################"
print "TX nr :" + str(y+1)
print "hash: " + str(addrdata['txs'][y]['hash'])
print "number of inputs: " + str(addrdata['txs'][y]['vin_sz'])
#only if
#if addrdata['txs'][y]['vin_sz'] > 1:
zy = 0
while zy < addrdata['txs'][y]['vin_sz']:
print "Input-ScriptNR " + str(zy+1) + " :" + str(addrdata['txs'][y]['inputs'][zy]['script'])
inputs.append(addrdata['txs'][y]['inputs'][zy]['script'])
zy += 1

y += 1

print "compare: "

xi = 0
zi = 1
lenx = len(inputs)
alert = 0

#compare the sig values in each input script
while xi < lenx-1:
x = 0
while x < lenx-zi:
if inputs[xi][10:74] == inputs[x+zi][10:74]:
print "In Input NR: " + str(xi) + "[global increment] " + str(inputs[xi])
print('\a')
                        print "Resued R-Value: "
print inputs[x+zi][10:74]
                        alert += 1

x += 1

zi += 1
xi += 1

#check duplicates
#alert when everything ok

if alert < 1:
print "Good pubKey. No problems."


sys.exit()

if you have question ask me.
thank you.

The script working good but some problem more then a 50 transaction it not process

address: 1szVke6ThJtfdUTi6Y5AAMDMePM4Ha8vK

output

Resued R-Value: 262e481b6d8905b5adba67aff05eb8261501b0a9434c0b7f043d00cf8d23c91b
----------------------------------------------------------------------------------------------------------------------
if address: 1QCRoj5dPAsADvzd2o7NBy6kywBEkfC1Xh

output

compare:

Good pubKey. No problems.
------------------------------------------------------------------------------------------------------------------------
if address: 1BFhrfTTZP3Nw4BNy4eX4KFLsn9ZeijcMm

output

TX nr :51
Traceback (most recent call last):
  File "C:\master\identical-r-check.py", line 61, in <module>
    print "hash: " + str(addrdata['txs'][y]['hash'])
IndexError: list index out of range
------------------------------------------------------------------------------------------------------------------------
1BFhrfTTZP3Nw4BNy4eX4KFLsn9ZeijcMm -> this address reused r value but the script give error how to solve , if any solved script available
14  Bitcoin / Development & Technical Discussion / Re: Check if your BTC-key is vulnerable on: June 02, 2015, 11:24:53 AM
http://bitcoin.stackexchange.com/questions/37740/same-identical-r-value-of-all-transaction-not-provide-corresponding-privatekey

Same identical R value of all transaction not provide corresponding privatekey


https://blockchain.info/tx/9ec4bc49e828d924af1d1029cacf709431abbde46d59554b62bc270e3b29c4b1

transaction you get

R = d47ce4c025c35ec440bc81d99834a624875161a26bf56ef7fdc0f5d52f843ad1

S1 = 44e1ff2dfd8102cf7a47c21d5c9fd5701610d04953c6836596b4fe9dd2f53e3e

S2 = 9a5f1c75e461d7ceb1cf3cab9013eb2dc85b6d0da8c3c6e27e3a5a5b3faa5bab

Z1 = c0e2d0a89a348de88fda08211c70d1d7e52ccef2eb9459911bf977d587784c6e

Z2 = 17b0f41c8c337ac1e18c98759e83a8cccbc368dd9d89e5f03cb633c265fd0ddc

z = 7a1a7e52797fc8caaa435d2a4dace39158504bf204fbe19f14dbb427faee50ae

private key = c477f9f65c22cce20657faa5b2d1d8122336f851a508a1ed04e479c34985bf96

but the other transaction not providing corresponding private key

with same identical R value = d47ce4c025c35ec440bc81d99834a624875161a26bf56ef7fdc0f5d52f843ad1

https://blockchain.info/tx/47106ff70bf779efc32230f5ca956d0fc563f35a3c4395d1977fc38995327fe1

https://blockchain.info/tx/00b4dea9266283d93f35240f34b871b55e59c3d4a7705aa08d5745af398d9046

https://blockchain.info/tx/d6f071e082ebb8c7c7721a9019d7478489e3fd423cae6acabdbd2ffd28f5c300

https://blockchain.info/tx/83415dded4757181c6e1c55104e2742a6f8cff05a9a46fbf029ae47b0054d511

https://blockchain.info/tx/2bd15366f5bcc2046c480db4d6ad82450893f2a3370935ddee753325f1a7c6cc

https://blockchain.info/tx/e96feca9744b95533a5a3f657c346d7772a5004a76f4bc8de810b7ad015f6440

https://blockchain.info/tx/5a994f485039ebd83a0ed22cae943f0c792d85d218884f4cd80bd7cccdd75aae
15  Bitcoin / Development & Technical Discussion / Re: Check if your BTC-key is vulnerable on: April 23, 2015, 02:07:46 AM
how to get ( sop1 & sop2 ) these two value,
any formula or any script available...........

Not too easy. You should have good lib for bitcoin transactions to create "a template" and take a sha256d () of it.
Here is a piece of my code. But it will be useless for you. Just a pseudo-code

Code:
const MyKey32 Transaction::getRawHash ( const int n, const QByteArray& scr ) const
{
  MyByteArray ret;                                     // create empty array
  Stream stream ( s );                               
  ret.putInt32 ( stream.readU32 ( ) );                 // version
  ret.putVarInt ( stream.readVar ( ) );                // input count
  for ( int i ( 0 ); i < inputs; i++ )                 // copy all inputs
  {
    ret.append ( stream.readHash ( ) );                // copy 32 byte hash as is
    ret.putInt32 ( stream.readU32 ( ) );               // copy 4 bytes index
    stream.skipVarData ( );                            // skip original script
    ret.putPrefixedCond ( i ^ n, scr );                // script replacement
    ret.putInt32 ( stream.readU32 ( ) );
  }
  ret.putVarInt ( stream.readVar ( ) );                // output count
  for ( int i ( 0 ); i < outputs; i++ )                // copy all outputs byte-by-byte
  {
    ret.putInt64 ( stream.readU64 ( ) );
    ret.putPrefixed ( stream.readVarData ( ) );
  }
  ret.putInt32 ( stream.readU32 ( ) );                 // lock
  ret.putInt32 ( SIGHASH_ALL );                        // append hashcode
  return MyKey32 ( ret.constData ( ), ret.size ( ) );  // create hash256 of array
}

Thank you

http://bitcoin.stackexchange.com/questions/25387/how-to-get-the-z-value-aka-hash-of-the-outputs-to-be-signed

http://bitcoin.stackexchange.com/questions/25814/ecdsa-signature-and-the-z-value

http://bitcoin.stackexchange.com/questions/3374/how-to-redeem-a-basic-tx

here i get explanation, i almost understand but not clear, i need step by step explanation please...
16  Bitcoin / Development & Technical Discussion / Re: Check if your BTC-key is vulnerable on: April 22, 2015, 05:55:50 AM
p    = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141
r    = 0xd47ce4c025c35ec440bc81d99834a624875161a26bf56ef7fdc0f5d52f843ad1
s1   = 0x44e1ff2dfd8102cf7a47c21d5c9fd5701610d04953c6836596b4fe9dd2f53e3e
s2   = 0x9a5f1c75e461d7ceb1cf3cab9013eb2dc85b6d0da8c3c6e27e3a5a5b3faa5bab

sop1 = 0xc0e2d0a89a348de88fda08211c70d1d7e52ccef2eb9459911bf977d587784c6e
sop2 = 0x17b0f41c8c337ac1e18c98759e83a8cccbc368dd9d89e5f03cb633c265fd0ddc

how to get ( sop1 & sop2 ) these two value,

any formula or any script available...........
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!