Bitcoin Forum
May 02, 2024, 01:07:05 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1] 2 3 4 5 »
1  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: January 17, 2024, 03:05:04 AM

I can't figure out how to calculate the ccap=20 parameter?
I have an RTX 4050 Laptop.
Help please.

This is architecture "Ada Lovelace", you need 8.9 so use ccap=89 in your compiling task. In case you have no success try downgrading and use max CUDA 11.8. However I wish you best of luck and success.

citb0in
and edit GPUEngine.cu; 4 lines are commented out; they are not in version 10.2.
https://bitcointalk.org/index.php?topic=1306983.msg63128300#msg63128300
2  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: January 12, 2024, 02:12:26 AM
Bro thanks again, will test, but is it still present somewhere the bip39_english.h and Winm.lib
Added in VanitySearch.vcxproj <AdditionalDependencies> Winmm.lib;
Wordlist_en.h in folder 013 commented - not use.
Just uploaded bip39_english.h. Thank you. Forgot to copy Smiley
They differ only in the sizes of the rows, the array is the same here and there.

If the countdown starts from zero, then you can change keyIndex = 65;
Replace:
Code:
keyIndex = (uint32_t)TARGET_KEY_BITS;// BITS 66
To:
Code:
keyIndex = (uint32_t)TARGET_KEY_BITS - 1;// BITS 66
Or any:
Code:
keyIndex = 65;
it will be a patch - m/0'/0'/65'
But we still don’t know the patch.

3  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: January 12, 2024, 01:03:12 AM

The beginning of private key  for 130 is 0x3

You are already stuck with your guesses! Stop spreading spam!

Added mod 013

https://github.com/alek76-2/VanitySearch/tree/main/mod/013

Added Path - m/0'/0'/66' For 32 BTC Puzzle

Use SSE2 instructions - default VanitySearch code / Disable SSE cmd: -nosse
Initial SEED extension to 64 bits
GPU Added rotation - #define NB_SPIN 16
Modification file GPUHash.h
The speed on the Tesla T4 GPU is 670.98 Mkeys/s
If Use GPU Rekey multiple by 1000

RUN CMD:
Code:
VanitySearch.exe -stop -nosse -verbose 1 -level 0 -t 1 -bits 66 -r 10 13zb1hQbWVsc2S7ZTZnP2G4undNNpdh5so

VanitySearch.exe -stop -t 0 -nosse -o Result.txt -verbose 1 -level 0 -gpu -r 500000000 -bits 66 13zb1hQbWVsc2S7ZTZnP2G4undNNpdh5so

Added play sound buzzer.wav in Windows version Wink

p.s. The binaries assemble everything themselves.
4  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: January 10, 2024, 01:57:57 PM
Optimized code a little.
https://github.com/alek76-2/VanitySearch/blob/main/mod/other_files/GPUHash_nc_optimized.h
Previously, the data array was transferred from one function to another when initializing RIPEMD160.
I put the constants directly into the RIPEMD160Transform() function.
Now the question is, can this be optimized using compiler options? The uint32_t * array is no longer used.
Code:
__device__ void RIPEMD160Transform(uint32_t s[5],uint32_t* w) {

  uint32_t u;
  //uint32_t a1 = s[0], b1 = s[1], c1 = s[2], d1 = s[3], e1 = s[4];
  //uint32_t a2 = a1, b2 = b1, c2 = c1, d2 = d1, e2 = e1;
  
  uint32_t a1 = 0x67452301ul, b1 = 0xEFCDAB89ul, c1 = 0x98BADCFEul, d1 = 0x10325476ul, e1 = 0xC3D2E1F0ul;
  uint32_t a2 = a1, b2 = b1, c2 = c1, d2 = d1, e2 = e1;

  //uint32_t t = s[0];
  //s[0] = s[1] + c1 + d2;
  //s[1] = s[2] + d1 + e2;
  //s[2] = s[3] + e1 + a2;
  //s[3] = s[4] + a1 + b2;
  //s[4] = t + b1 + c2;
  
  //uint32_t t = 0x67452301ul;
  s[0] = 0xEFCDAB89ul + c1 + d2;
  s[1] = 0x98BADCFEul + d1 + e2;
  s[2] = 0x10325476ul + e1 + a2;
  s[3] = 0xC3D2E1F0ul + a1 + b2;
  s[4] = 0x67452301ul + b1 + c2;//s[4] = t + b1 + c2;


Or will the compiler do it itself now? Who can test the speed and correctness of the code?
I checked it on Tesla T4, this code works.
5  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: January 10, 2024, 09:15:30 AM

In the meantime I rewrite the GPUHash.h file
GPU constant memory is not used in hash functions. I checked the program's operation on PK 40 bit. It works, but the speed is the same.
https://github.com/alek76-2/VanitySearch/blob/main/mod/other_files/GPUHash_nc.h

Can someone test it?

nice work alek !

could you please add a stride function on it ?


There, for starting keys in the getGPUStartingKeys function, the step is set here.
Code:
else {
      //
      keys[i].Set(&startKey);
      Int offT((uint64_t)i);
      //offT.ShiftL(32);  
      Int offG((uint64_t)thId);
      //offG.ShiftL(40);
      // new offset
      int nbBit = startKey.GetBitLength();
      offT.ShiftL((uint32_t)(nbBit / 2));
      offG.ShiftL((uint32_t)(nbBit - 4));
      //
      keys[i].Add(&offT);
      keys[i].Add(&offG);
      if (i < 10 || i > nbThread - 10) { printf("Bit %d GPU startKey Base Key %d: %s\n", Random_bits, i,             
      keys[i].GetBase16().c_str()); }
      //
}

I don’t want to, I will need to recalculate the distance traveled and create an addition for a new start of the keys. A table and steps are used. +1 and -1 further to +512 and -512 Delta is needed to increase the speed when calculating the inversion modulo distance - this is when adding points.
You can generate starting keys in increments. The dot addition step cannot be changed.
For example, you won’t be able to add 16, 64 or 2048. The addition step is 1 - all because of the table.
6  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: January 09, 2024, 09:23:27 PM
Is Digaran talking to himself again   Roll Eyes

In the meantime I rewrite the GPUHash.h file
GPU constant memory is not used in hash functions. I checked the program's operation on PK 40 bit. It works, but the speed is the same.
https://github.com/alek76-2/VanitySearch/blob/main/mod/other_files/GPUHash_nc.h

Can someone test it?
7  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: January 06, 2024, 06:59:05 AM
And so on and on....This is only part of it.

I even modify BIOS on Intel boards and even GPU bios.  Until the components burn *from efficiency. Grin
Wow... Approaching your goal step by step. This is great !
8  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: January 06, 2024, 04:16:53 AM
What happened to your vansearch kangaroo on github? You take it down?

For an unspecified time.
_______________________________________________________________________________ __________
This is another one that remembers the steps and saves it to a file; re-running does not generate new start keys. It extracts them from the file. Save and unload functions were once available in the repository. Kangaroos are not currently available.
No, I will not distribute this version of the program for now. It seems like a lot of work has been done. Thanks also to the farm owners who offer paid access to GPU computing resources. This is starting to annoy me Smiley

There is also a division function, installed with the -div command...
In 2020, the beginning of my Kangaroo GPU code was laid, before the start of version 1.0 from Jean Luc.
Where the functions of adding points in the GPU were used in the same way as in the VanitySearch program.
A couple of people said thank you and that’s it. It looks funny.
9  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: January 05, 2024, 07:49:32 PM
Launched it on one video card.
Code:
[i] Upload work file: Work_Kangaroos_128.txt 
[i] File Work_Kangaroos_128.txt: 255590400 bytes 1317476 lines

[i] Get Keys time: 24549.068 msec From file: Work_Kangaroos_128.txt Size: 255590400 bytes
[i] GPU Use Start Keys from work file: Work_Kangaroos_128.txt

[+] Runing Comparator every: 300 sec
[i] Save Work_Kangaroos_id.txt file every: 600 sec

[i] WILD Check Distance: 8D206E8B3814706BABF1C3A693EE7A0
[i] TAME Check Distance: 3E23F093957C9DD9A3D9AB48B3482F85C
[|][  0: 0:36 ;   0.0  j/s; [GPU 0.00 Mj/s]   0.0 j   0.0%; dp/kgr=0.0;   1.0Ty  2m 22d 14: 0:32 ]  
[i] Write work Kangaroos in file: Work_Kangaroos_128.txt
[i] Save Work file OK
[/][  0: 0:38 ;   0.0  j/s; [GPU 0.00 Mj/s]   0.0 j   0.0%; dp/kgr=0.0;   1.0Ty  2m 22d 14: 0:32 ]  
[i] Load Work file to Drive
[|][  0:11:48 ; 460.8M j/s; [GPU 460.83 Mj/s] 311.0Gj   0.0%; dp/kgr=0.0;   2.0Ky 10m 28d 19:52:16 ]  
Python Comparator time: 708831.895 msec
[-][  0:12:40 ; 461.3M j/s; [GPU 461.26 Mj/s] 335.0Gj   0.0%; dp/kgr=0.0;   2.0Ky  6m  1d 10:52: 6 ]  
[i] WILD Check Distance: 8D206EC1A13D020EFECB550DA146C3D
[i] TAME Check Distance: 3E23F093CC220F1301640B64F086A15D5
[|][  0:13:24 ;   0.0  j/s; [GPU 0.00 Mj/s] 335.0Gj   0.0%; dp/kgr=0.0;   1.0Ty  7m 14d  3:41:52 ]  
[i] Write work Kangaroos in file: Work_Kangaroos_128.txt
[i] Save Work file OK
[-][  0:13:28 ;   0.0  j/s; [GPU 0.00 Mj/s] 335.0Gj   0.0%; dp/kgr=0.0;   1.0Ty  7m 14d  3:41:52 ]  
[i] Load Work file to Drive
[|][  0:13:56 ; 461.1M j/s; [GPU 461.14 Mj/s] 348.0Gj   0.0%; dp/kgr=0.0;   2.0Ky  2m  0d 10:55:49 ]  
[i] Copy tame and wild files in My Drive
[-][  0:24:16 ; 461.1M j/s; [GPU 461.09 Mj/s] 634.0Gj   0.0%; dp/kgr=0.0;   2.0Ky  5m  9d  9:27:12 ]  

And leave it like that until January 1, 2025   Roll Eyes
10  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: December 31, 2023, 09:22:25 AM
Go get that bag mcdouglas!!!

Rooting for you even though I am a 130 searcher as well.
Puzzle 130 will not be solved soon, around February 1, 2025 Smiley
11  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: December 31, 2023, 03:23:57 AM

I'm still trying to figure out a stride function; it has gotten the better of me, off and on, for 2+ years lol.

A stride that strides each GPU thread, by x amount. I could find one of these challenges much quicker, but to no avail; I stick with Kangaroo for larger puzzles; 512 RTX 4090s would solve 130 in roughly 246 days Smiley
Not everyone has such resources. But the probability can be different, and for this you need a good chance. Again we need a good random. Here, depending on your luck, it’s possible to win 130 in a month. I’m trying to increase the maximum jump size to 2^105. It's just a matter of chance Smiley
12  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: December 31, 2023, 02:18:18 AM

I do not know about another way to build in OpenSSL.

So all of those mods are for just trying to generate starting keys, in different ways?

I like your work alek, but just to generate a starting key differently, that's a no from me. It's not about the starting key to me, but about the 2^64 ones after those starting keys Smiley

It's solid work/code. Was it all for trying to generate starting keys differently? I thought there was something in there about trying to crack deterministic wallets, no?

You're caught Smiley No, this is not a hack. This is a generation method. We need approximately the same algorithm as deterministic wallets.
It is also possible that we need a correct way to generate SEED, which includes its entropy - according to a different principle. The space is very large. And we need life somewhere nearby in the starting keys.

It's all because of nomachine Smiley, how it went and went with these seed receipts... But, he's great Smiley
13  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: December 31, 2023, 01:36:00 AM

NGL....I lost interest after reading this much and not being half way done Smiley

Quote
Build OpenSSL:
Install Perl x64 for MS Windows from https://strawberryperl.com
Link: https://strawberryperl.com/download/5.32.1.1/strawberry-perl-5.32.1.1-64bit.msi
Install Netwide Assembler (NASM).
Download NASM x64 https://www.nasm.us/pub/nasm/releasebuilds/2.16.01/win64/nasm-2.16.01-installer-x64.exe
Add Path C:\Program Files\NASM;
Add PATHEXT .PL; before .BAT;
those. - .COM;.EXE;.PL;.BAT;
And be sure to restart your PC.
Download the library from the official website openssl-1.0.1a.tar.gz
http://www.openssl.org/source/old/1.0.1/openssl-1.0.1a.tar.gz

And there's not a clear and concise excerpt telling anyone what is what and what does what with your changes. Seems like only you and nomachine know what is going on.


Is there another way to build OpenSSL?
Do you have any idea about the size of the keyspace or not? In any case, you need a good random generator. In another case, you will search with compressed entropy, which will also be in the 66-bit range. Then choose "compressed entropy", perhaps for this reason the search takes so long...
And don’t forget to add - Add Path C:\Strawberry\perl\bin;
What else should I tell you? The code is open. These are different ways to obtain a starting key. That's about it. But the entropy must be good in any case.

14  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: December 31, 2023, 12:17:56 AM
Added a file with a Spin loop. The code is only for P2PKH addresses.

https://github.com/alek76-2/VanitySearch/blob/main/mod/other_files/GPUCompute_fast.h
https://github.com/alek76-2/VanitySearch/blob/main/mod/other_files/GPUEngine.cu

Edit GPUEngine.h - add #define NB_SPIN 32 // max 64
Edit GPUGroup.h - add #define GRP_SIZE_DIV2 512
Replace GPUEngine.cu

Run:
Code:
VanitySearch.exe -stop -t 0 -nosse -o Result.txt -verbose 1 -gpu -level 0 -r 50000000 -bits 66 13zb1hQbWVsc2S7ZTZnP2G4undNNpdh5so

VanitySearch.exe -stop -t 0 -nosse -o Result.txt -verbose 1 -gpu -bip39 12 -level 1 -r 50000000 -bits 66 13zb1hQbWVsc2S7ZTZnP2G4undNNpdh5so

There the rekey are reduced by 1000.

Who can test the speed increase or find a bug?  Smiley New Year's gift Smiley
15  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: December 30, 2023, 11:06:15 PM
Yeah you're right, damn it. I guess that's it, we reached a limit.
Thank you again for the responses.
The only thing we can do is use parity mode. Keeping in mind the fact that even private keys have public keys prefixed with 02 and 03, this is not important. The main thing is the parity of the private key.
1. Generate a new table GPUGroup.h from even numbers - 2G, 4G, 6G, 8G, 10G, 12G,... 1024G
2. In the getGPUStartingKeys() function we use only even private keys, make a dot and send it to the Poins p array, filling it completely. This way we will only look for an even private key. It doesn't matter what prefix PubKey has.
Winning plus 100% or minus 100%. Without knowing the even or odd target private key.
I also removed the return to save any result to a file:
Code:
string chkAddr = secp->GetAddress(searchType, mode, p);
    if (chkAddr != addr) {
      printf("\nWarning, wrong private key generated !\n");
      printf("  Addr :%s\n", addr.c_str());
      printf("  Check:%s\n", chkAddr.c_str());
      printf("  Endo:%d incr:%d comp:%d\n", endomorphism, incr, mode);
      //return false; error ?
    }
I think this return is unnecessary.
16  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: December 30, 2023, 11:02:59 AM
...
Yes, I understood your idea. But there is 1 fact. When adding a point with even private keys and then adding them, the Y coordinate can be either even or odd. If you filter in getGPUStartingKeys(), I think that after 1 addition the result can be anything. Yes. Just check the rand key generator, how many even and odd values it generates Smiley
Try it. I used only 1 nbThread to check the GPU code; you can even print points from the GPU using the printf() function, preloading fixed repeating even or odd ones.
17  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: December 30, 2023, 10:01:47 AM
How do you know if PubKey prefix = 02?

I think it's a waste of time to guess whether it's 02 or 03 prefix. Whatever the script is, it must pass all the private keys. It is impossible to accelerate this way. It can be filtered, but filtering is not acceleration. Grin

Sorry mate but you don't seem to understand what I asked, read again my post.
I started studying this program in 2020. Now I will try to explain to you what you are doing wrong.
1. In the getGPUStartingKeys function, it forms an array of points with X and Y coordinates. In this function, you do not need to check them for compliance with the prefixes 02 and 03. Because later in the GPU code, when adding any point to the coordinates generated in this function, the new points will be with the prefixes 03 (not even Y). You won't even know it. You need to filter specifically in the GPU code. For this reason, you won't be able to add new cmd argument.
2. There is no need to reduce nbThread > filtredKeys by 50%, the remaining threads are filled with zeros. The entire Points p array must be transferred to the GPU.
I suggested that you check in the GPU code for the parity of the Y coordinate. uint8_t isOdd = (uint8_t)(py[0] & 1); It's simple Smiley
It is not entirely clear what you want to increase further. This is the limit Smiley
18  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: December 30, 2023, 08:27:37 AM
How do you know if PubKey prefix = 02?

I think it's a waste of time to guess whether it's 02 or 03 prefix. Whatever the script is, it must pass all the private keys. It is impossible to accelerate this way. It can be filtered, but filtering is not acceleration. Grin
That's right, that's the limit. It can speed up by about 6.3%. If spin rotation is used. I don’t know what can be optimized in the GPU anymore. Everything is clear there. This is absolutely a normal increase in speed. Every percent is worth it, especially in GPUs.

19  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: December 30, 2023, 06:38:46 AM
Any ideas?
How do you know if Point X prefix = 02?
you can do this:
Code:
if (isOdd == 0) { //  02
    _GetHash160Comp(px, isOdd, (uint8_t *)h);
    CHECK_POINT(h, incr, 0, true);
}

In addition, you will have to calculate the Y coordinate when adding points. Look at my mod 12. I removed everything unnecessary there in GPU.
And I changed the conditions in GPUEngine.cu - the ComputeKeys() code is executed. But ComputeKeysComp() is not executed - for the reason that the Y coordinate is needed.
It was measured that it is more profitable to add the Y coordinate than to calculate Ripemd160 2 times.
Everything has already been checked, you can only add a condition. Or loop using Spin. So I gained 6.3% in speed. #define NB_SPIN 32
You also need to change the increment index multiplied by the number of Spin rotations and  add Load256(sx, px); Load256(sy, py);
Post the code and I'll check it Smiley
20  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: December 23, 2023, 04:13:18 AM
Script for check / generating address + wif and hex key. P2PKH Compressed / UnCompressed address.
If you need an address without an online service.
Python 2.7 code:
Code:
#! /usr/bin/env python

import random
from ecdsa.ecdsa import int_to_string
from ecdsa.ecdsa import string_to_int
from binascii import hexlify
import hashlib


class CurveFp( object ):
  def __init__( self, p, a, b ):
    self.__p = p
    self.__a = a
    self.__b = b

  def p( self ):
    return self.__p

  def a( self ):
    return self.__a

  def b( self ):
    return self.__b

  def contains_point( self, x, y ):
    return ( y * y - ( x * x * x + self.__a * x + self.__b ) ) % self.__p == 0

class Point( object ):
  def __init__( self, curve, x, y, order = None ):
    self.__curve = curve
    self.__x = x
    self.__y = y
    self.__order = order
    if self.__curve: assert self.__curve.contains_point( x, y )
    if order: assert self * order == INFINITY
 
  def __add__( self, other ):
    if other == INFINITY: return self
    if self == INFINITY: return other
    assert self.__curve == other.__curve
    if self.__x == other.__x:
      if ( self.__y + other.__y ) % self.__curve.p() == 0:
        return INFINITY
      else:
        return self.double()

    p = self.__curve.p()
    l = ( ( other.__y - self.__y ) * \
          inverse_mod( other.__x - self.__x, p ) ) % p
    x3 = ( l * l - self.__x - other.__x ) % p
    y3 = ( l * ( self.__x - x3 ) - self.__y ) % p
    return Point( self.__curve, x3, y3 )

  def __mul__( self, other ):
    def leftmost_bit( x ):
      assert x > 0
      result = 1L
      while result <= x: result = 2 * result
      return result / 2

    e = other
    if self.__order: e = e % self.__order
    if e == 0: return INFINITY
    if self == INFINITY: return INFINITY
    assert e > 0
    e3 = 3 * e
    negative_self = Point( self.__curve, self.__x, -self.__y, self.__order )
    i = leftmost_bit( e3 ) / 2
    result = self
    while i > 1:
      result = result.double()
      if ( e3 & i ) != 0 and ( e & i ) == 0: result = result + self
      if ( e3 & i ) == 0 and ( e & i ) != 0: result = result + negative_self
      i = i / 2
    return result

  def __rmul__( self, other ):
    return self * other

  def __str__( self ):
    if self == INFINITY: return "infinity"
    return "(%d,%d)" % ( self.__x, self.__y )

  def double( self ):
    if self == INFINITY:
      return INFINITY

    p = self.__curve.p()
    a = self.__curve.a()
    l = ( ( 3 * self.__x * self.__x + a ) * \
          inverse_mod( 2 * self.__y, p ) ) % p
    x3 = ( l * l - 2 * self.__x ) % p
    y3 = ( l * ( self.__x - x3 ) - self.__y ) % p
    return Point( self.__curve, x3, y3 )

  def x( self ):
    return self.__x

  def y( self ):
    return self.__y

  def curve( self ):
    return self.__curve
  
  def order( self ):
    return self.__order
    
INFINITY = Point( None, None, None )

def inverse_mod( a, m ):
  if a < 0 or m <= a: a = a % m
  c, d = a, m
  uc, vc, ud, vd = 1, 0, 0, 1
  while c != 0:
    q, c, d = divmod( d, c ) + ( c, )
    uc, vc, ud, vd = ud - q*uc, vd - q*vc, uc, vc
  assert d == 1
  if ud > 0: return ud
  else: return ud + m

# secp256k1
_p  = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2FL
_r  = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141L
_b  = 0x0000000000000000000000000000000000000000000000000000000000000007L
_a  = 0x0000000000000000000000000000000000000000000000000000000000000000L
_Gx = 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798L
_Gy = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8L

class Public_key( object ):
  def __init__( self, generator, point ):
    self.curve = generator.curve()
    self.generator = generator
    self.point = point
    n = generator.order()
    if not n:
      raise RuntimeError, "Generator point must have order."
    if not n * point == INFINITY:
      raise RuntimeError, "Generator point order is bad."
    if point.x() < 0 or n <= point.x() or point.y() < 0 or n <= point.y():
      raise RuntimeError, "Generator point has x or y out of range."

curve_256 = CurveFp( _p, _a, _b )
generator_256 = Point( curve_256, _Gx, _Gy, _r )
g = generator_256

b58_digits = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'

### generate privkey
randrange = random.SystemRandom().randrange
n = g.order()
#n = 115792089237316195423570985008687907852837564279074904382605163141518161494337

ripehash = hashlib.new('ripemd160')

def b58encode(b):
    
n = int('0x0' + hexlify(b).decode('utf8'), 16)
res = []
while n > 0:
n, r = divmod (n, 58)
res.append(b58_digits[r])
res = ''.join(res[::-1])
import sys
czero = b'\x00'
if sys.version > '3':
czero = 0
pad = 0
for c in b:
if c == czero: pad += 1
else: break
return b58_digits[0] * pad + res

###

#Compress_fl = 0 # UNCompressed
Compress_fl = 1 # Compressed

### Start generate secret
password = "123" # SET PASSWORD -----------------------!!!!!!!!!!!!!!!!!!!!!----------------------- SET PASSWORD
#password = raw_input('Your string here:')
sha1 = hashlib.sha256(password).digest()
temp1 = string_to_int(sha1)
secret_bw = temp1 # brainwallet
### End generate secret

#secret = secret_bw # brainwallet

secret = randrange( 1, 2**256 )

### SET SECRET KEY ###
### SET SECRET KEY ###
### SET SECRET KEY ###
### SET SECRET KEY ###
### SET SECRET KEY ###

#secret = 0xf13b87e9L # PointX len 62

#secret = 0xF7051F27B09112D4

### SET SECRET KEY ###
print '====================================================================================='
print 'Secret Key: '
print hex(secret)
print '====================================================================================='

### generate pubkey
myp = g * secret
### generate address

print "Points: "

px_str = hex(myp.x())[2:-1]
py_str = hex(myp.y())[2:-1]

while len(px_str) < 64:
    #print 'px_str: ', len(px_str)
    px_str = '0' + px_str

while len(py_str) < 64:
    #print 'py_str: ', len(py_str)
    py_str = '0' + py_str

print px_str
print py_str

print '====================================================================================='

# if Compressed address
if myp.y() % 2 == 0:
y_parity = '\x02'
pk_y_parity = '02'
#print "02" + px_str
else:
y_parity = '\x03'
pk_y_parity = '03'
#print "03" + px_str

# Public Key
if Compress_fl:
    pk = pk_y_parity + px_str
else:
    pk = '04' + px_str + py_str
print 'Public Key: '
print pk
print '====================================================================================='

# !!! NORMALIZE Length !!!
print 'NORMALIZE Length PointX and PointY'
# Point X
px_string = int_to_string(myp.x())

if len(px_string) < 32:
    print 'NORMALIZE Length PointX: ', len(px_string)

while len(px_string) < 32:
    px_string = '\x00' + px_string

print 'Check len PointX: ', len(px_string)

# Point Y
py_string = int_to_string(myp.y())

if len(py_string) < 32:
    print 'NORMALIZE Length PointY: ', len(py_string)

while len(py_string) < 32:
    py_string = '\x00' + py_string

print 'Check len PointY: ', len(py_string)

print '====================================================================================='

if Compress_fl:
    step1_mod = y_parity + px_string  # Compressed
else:
    step1_mod = '\x04' + px_string + py_string # UNCompressed

# End

step2 = hashlib.sha256(step1_mod).digest()

print "Pubkey sha256: "
istep2 = string_to_int(step2)
Psha256 = hex(istep2)[2:-1]
print Psha256
print '====================================================================================='

ripehash.update(step2)
step3 = ripehash.digest()
address160 = hex(string_to_int(step3))[2:-1]
print "Address hash160: "
print address160
step4 = '\x00' + ripehash.digest()
step5 = hashlib.sha256(step4).digest()
step6 = hashlib.sha256(step5).digest()
chksum = step6[:4]
addr = step4 + chksum
address = b58encode(addr)
#print address
### Convert private key to wallet import format
wif1 = int_to_string(secret)
i = 0;
while  i < (64 - len(hex(secret)[2:-1])) / 2:
wif1 = '\x00' + wif1
i = i + 1

#wif2 = '\x80' + wif1
# Compressed privkey
if Compress_fl:
    wif2 = '\x80' + wif1 + '\x01' # Compressed privkey
    addr_mode_str = 'Compressed'
else:
    wif2 = '\x80' + wif1 #        # UNCompressed privkey
    addr_mode_str = 'UnCompressed'

wif3 = hashlib.sha256(wif2).digest()
wif4 = hashlib.sha256(wif3).digest()
wif5 = wif4[:4]
wif6 = wif2 + wif5
wif = b58encode(wif6)
#print wif
### Save address and private key in priv.txt
hexsecret = hex(secret)

file_name = 'p_r_v.txt'

f = open(file_name, 'a')
f.write('\n'.join([addr_mode_str + ' Address: ' + address, 'Address hash160:    ' + address160, 'Secret wif: ' + wif, 'Secret hex: ' + hexsecret, 'PK: ' + pk, \
                   'Px: ' + px_str, 'Py: ' + py_str + '\n\n' ]))
f.close()
print '====================================================================================='
print 'Save ' + addr_mode_str + ' Address: ' + address
print 'Save Address hash160:    ' + address160
print 'Save WIF PrivKey: ' + wif
print 'Save Hex PrivKey: ' + hexsecret
print 'Save Public Key:  ' + pk
print '====================================================================================='
raw_input("... Press Enter")
raise SystemExit
Result output + write in file p_r_v.txt
Code:
Compressed Address: 18cdpW3P6imyDz6w622nYAGXvSznCM5om9
Address hash160:    53862c90c2a994c7a874bb091f9b8e51fcdaa06c
Secret wif: L3zSyzX1ky3QbEcvC6fHE9eDyuznswoDCsvGvCeiTuH2fkmN3L2G
Secret hex: 0xca0a0ca7838e9dfee4aaa0cfbee29b69a8f67dae595d993a71fdaab4a01287e2L
PK: 029c5b2d21be2b2bbeca4ac1cf1233c591e1127a355cdd564c880e88f98985efe7
Px: 9c5b2d21be2b2bbeca4ac1cf1233c591e1127a355cdd564c880e88f98985efe7
Py: 3c36a84972cbe787b26822596014625fa801981f38c56597d0c03f38f3ee93bc

Compressed Address: 16jY7qLJnxb7CHZyqBP8qca9d51gAjyXQN
Address hash160:    3ee4133d991f52fdf6a25c9834e0745ac74248a4
Secret wif: KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qZ6FxoaD5r1kYegmtbaT
Secret hex: 0xf7051f27b09112d4L
PK: 03100611c54dfef604163b8358f7b7fac13ce478e02cb224ae16d45526b25d9d4d
Px: 100611c54dfef604163b8358f7b7fac13ce478e02cb224ae16d45526b25d9d4d
Py: 5127c2d0b1c4a4d5b4996bbdf37633b86901d0303b61e2f6f0772282ae08ff95



Hello all, is there any python code for public key addition and checking it's hash ?
Yes, look at the iceland2k14/secp256k1 script and create your script to fit within his script.

Also, what do you mean by "checking it's hash"? H160?
Yes , hash160 . I saw his code , I am just good at math but very bad at programming so I couldn't understand the code honestly

Simplest

Code:
import sys, secrets, secp256k1 as ice
while True:
    dec = secrets.SystemRandom().randrange(36893488147419103231, 73786976294838206463)
    h160 = ice.privatekey_to_h160(1, True, dec).hex()
    message = "\r{}".format(h160);messages = []
    messages.append(message);output = "\033[01;33m" + ''.join(messages) + "\r"
    sys.stdout.write(output);sys.stdout.flush()
    if h160 == "20d45a6a762535700ce9e0b216e31994335db8a5":
        HEX = "%064x" % dec;wifc = ice.btc_pvk_to_wif(HEX)
        with open("KEYFOUNDKEYFOUND.txt", "a") as f:
          f.write(f'Private key (wif) Compressed : {wifc}\n')
        break

Im found ERROR. The code search address type P2SH. Still looking for a P2SH address?
For search P2PKH address replace str:
Code:
h160 = ice.privatekey_to_h160(1, True, dec).hex()
to str:
Code:
h160 = ice.privatekey_to_h160(0, True, dec).hex()

Code:
def _privatekey_to_h160(addr_type, iscompressed, pvk_int):
    # type = 0 [p2pkh],  1 [p2sh],  2 [bech32]

I don’t want to upset anyone, but many people make similar mistakes when they are in a hurry. To be honest, I only noticed the error myself.
The main thing is that 1000 kW hours of energy were not wasted. Please Smiley
Pages: [1] 2 3 4 5 »
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!