Bitcoin Forum
July 31, 2024, 08:03:32 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: BitCrack - A tool for brute-forcing private keys on: December 25, 2022, 08:18:44 PM

https://github.com/AlexCurl/bitcoin_tools/blob/main/secp256k1/secp256k1.py

Could numba be inserted into this code? I have not yet seen secp256k1 that the calculations go through @jit - that it has full GPU support.

if you are on python just use this library: https://github.com/iceland2k14/secp256k1
fastest out there for python since .dll(Windows) and .so(Linux) are shared libraries containing compiled functions written in C++ ready to load and use.
Most my codes that are there just good for testing and research. That is what I do mostly.
For CPU best option is VanitySearch code base it is the fastest.
It is in C++ and easy to understand and use.


I want to make one that will do 300Miilion Key/s from python. One or more GPUs....The only way is through numba and jit.
https://numba.pydata.org/
And there is nowhere an example of how to calculate secp256k1 through @jit . These are simple mathematical formulas, not rocket science.
It's as if someone doesn't want this to speed up on purpose. Grin
2  Bitcoin / Development & Technical Discussion / Re: BitCrack - A tool for brute-forcing private keys on: December 25, 2022, 04:42:12 PM
Why BitCrack doesn't support new types of adress? (from '3' or 'bc' starting)?

And another quesion. Is this adresses also generating from the same space of numbers as P2PKH keys? I mean, that for example I have a private key
 
Code:
36a9e7f1c95b82ffb99743e0c5c4ce95d83c9a430aac59f84ef3cbfab6145068

For this key I have two P2PKH adresses  1AxSQFHqQ2nFUbZwcWSmHYrYumuQnK2nYG 12b9TofPY9R5gtKRUHBWjQrNP6mBYZuFqr. Can I generate also P2SH adress using this key?

Private key: 36a9e7f1c95b82ffb99743e0c5c4ce95d83c9a430aac59f84ef3cbfab6145068
WIF_U: 5JEMthkwtXqFvRkMbDMPDV7ghskD6ikM59ZQRoFEzXDAoDUq7qz
WIF_C: Ky3yDCtyGT5zrpEMt1Wy476WFQyiQFGKbJn2QT7rktLiEz1dN1nj
X:e589eea87b3f9f14384e32a0036c0f3b41fd071fbaaa37e07196a9acfd8e68b7 Y:1808b5a13bf67ed98145b9c1338ef176131620cfc4503def199364906bbbcc4f
Hash160_U: 6d3536a61d6308915bcc3b72476b7e40d27b08ce
Hash160_C: 116d5513840ce377f0a76a64ed247f34e3bbdf0f
Address_U: 1AxSQFHqQ2nFUbZwcWSmHYrYumuQnK2nYG
Address_C: 12b9TofPY9R5gtKRUHBWjQrNP6mBYZuFqr
Address_P2SH: 31iwoQNky2ZMHEgYnTnARVmHEHArTqwLUq
Address_Bech32_P2WPKH: bc1qz9k42yuypn3h0u98dfjw6frlxn3mhhc07pwhqg
Address_Bech32_P2WSH: bc1qmvkw2tle32krer6qxc906zanccl9lmrhx0nzh3yharyeaavwxjwsqcyayx
Address_Bech32m_P2TR: bc1pq7ypqza85dqdywnrsmkwy8pvyypysu6gq5gzqeepr4ngg0ru5ulqfz886e
Taproot Tweaked privkey: 9ac5d0501220a1d462bc021f3e03264232dfc05e03bee4745f6f8e59d67bc161
Taproot Tweaked pubkey: 0788100ba7a340d23a6386ece21c2c210248734805102067211d66843c7ca73e


Did You create them manually or using bitcrack?
Using secp256k1 library: https://github.com/AlexCurl/bitcoin_tools/blob/main/ecc_gmp_C/main.c

https://github.com/AlexCurl/bitcoin_tools/blob/main/secp256k1/secp256k1.py

Could numba be inserted into this code? I have not yet seen secp256k1 that the calculations go through @jit - that it has full GPU support.
3  Bitcoin / Development & Technical Discussion / Re: Is there a way to use Python GPU for ECC speed up? on: December 11, 2022, 04:30:13 PM
I had driver problems on Debian 11

Code:
sudo nano  /etc/modprobe.d/blacklist-nouveau.conf
blacklist-nouveau.conf :

Code:
blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off

Then reboot and reinstall
Code:
sudo apt -y install  nvidia-cuda-toolkit nvidia-cuda-dev nvidia-driver

It works like this. GPU must be specified as  "0" . Or who has more than one of them in the same command.
Code:
import os
os.environ['CUDA_VISIBLE_DEVICES'] = "0"
import numpy as np
import numba
from numba import cuda, jit
from timeit import default_timer as timer
from fastecdsa import keys, curve
import secp256k1 as ice
# Run on CPU
def cpu(a):
    for i in range(100000):
        dec   = keys.gen_private_key(curve.P256)
        HEX   = "%064x" % dec
        wifc  = ice.btc_pvk_to_wif(HEX)
        wifu  = ice.btc_pvk_to_wif(HEX, False)
        uaddr = ice.privatekey_to_address(0, False, dec)
        caddr = ice.privatekey_to_address(0, True, dec)
        a[i]+= 1
# Run on GPU
numba.jit()
def gpu(x):
    dec   = keys.gen_private_key(curve.P256)
    HEX   = "%064x" % dec
    wifc  = ice.btc_pvk_to_wif(HEX)
    wifu  = ice.btc_pvk_to_wif(HEX, False)
    uaddr = ice.privatekey_to_address(0, False, dec)
    caddr = ice.privatekey_to_address(0, True, dec)
    return x+1
if __name__=="__main__":
    n = 100000
    a = np.ones(n, dtype = np.float64)
    start = timer()
    cpu(a)
    print("without GPU:", timer()-start)
    start = timer()
    gpu(a)
    numba.cuda.profile_stop()
    print("with GPU:", timer()-start)


Result
without GPU: 10.30411118400002
with GPU: 0.2935101880000275

 Grin


p.s.
 tried using following decorators:

Code:
@numba.jit(target='cuda')
@numba.jit(target='gpu')
@numba.cuda.jit

It is even faster without anything as a signature argument.
Code:
@numba.jit()
without GPU: 8.928111962999992
with GPU: 0.06683745000009367



4  Bitcoin / Development & Technical Discussion / Re: Is there a way to use Python GPU for ECC speed up? on: December 11, 2022, 06:15:33 AM
I have no idea how secp256k1 as ice & fastecdsa  optimized for GPU jit, (maybe not at all) but we can test this anyway...Without experimentation there is no progress.

You have to install the CUDA Toolkit for this & numba on Linux....
Code:
conda install numba & conda install cudatoolkit
or
Code:
pip3 install numba numpy fastecdsa
(etc...)

Code:
import numpy as np 
import numba
from numba import cuda, jit
from timeit import default_timer as timer
from fastecdsa import keys, curve
import secp256k1 as ice
# Run on CPU
def cpu(a):
    for i in range(100000):
        dec   = keys.gen_private_key(curve.P256)
        HEX   = "%064x" % dec
        wifc  = ice.btc_pvk_to_wif(HEX)
        wifu  = ice.btc_pvk_to_wif(HEX, False)
        uaddr = ice.privatekey_to_address(0, False, dec)
        caddr = ice.privatekey_to_address(0, True, dec)
        a[i]+= 1
# Run on GPU
@numba.jit(forceobj=True)
def gpu(x):
    dec   = keys.gen_private_key(curve.P256)
    HEX   = "%064x" % dec
    wifc  = ice.btc_pvk_to_wif(HEX)
    wifu  = ice.btc_pvk_to_wif(HEX, False)
    uaddr = ice.privatekey_to_address(0, False, dec)
    caddr = ice.privatekey_to_address(0, True, dec)
    return x+1
if __name__=="__main__":
    n = 100000
    a = np.ones(n, dtype = np.float64)
    start = timer()
    cpu(a)
    print("without GPU:", timer()-start)
    start = timer()
    gpu(a)
    numba.cuda.profile_stop()
    print("with GPU:", timer()-start)

p.s.
It is a bad idea to start this test with the print command. So I removed the command...
result

without GPU: 8.594641929998033

-----------

It throws errors here
Code:
.local/lib/python3.10/site-packages/numba/cuda/cudadrv/devices.py", line 231, in _require_cuda_context
    with _runtime.ensure_context():
  File "/usr/lib/python3.10/contextlib.py", line 135, in __enter__
    return next(self.gen)


 even with the option
Code:
 @numba.jit(forceobj=True)
I'll try again later...maybe it's my system and drivers - and maybe it's not.
5  Bitcoin / Development & Technical Discussion / Re: Is there a way to use Python GPU for ECC speed up? on: December 10, 2022, 09:40:58 PM


I know that in C++, you could use Boost library/dependency to have bigger integer variables. Is there a way to do the same in Python GPU?


There is a way, but there are many readings until the final implementation.

https://documen.tician.de/pycuda/array.html
6  Bitcoin / Development & Technical Discussion / Re: Is there a way to use Python GPU for ECC speed up? on: December 10, 2022, 08:27:30 PM
https://github.com/iceland2k14/secp256k1 fastest library for python.

And fastecdsa......
https://github.com/AntonKueltz/fastecdsa

Code:
from fastecdsa import keys, curve
import secp256k1 as ice

while True:
           dec   = keys.gen_private_key(curve.P256)
           HEX   = "%064x" % dec
           wifc  = ice.btc_pvk_to_wif(HEX)
           wifu  = ice.btc_pvk_to_wif(HEX, False)
           uaddr = ice.privatekey_to_address(0, False, dec)
           caddr = ice.privatekey_to_address(0, True, dec)
           print(wifu, uaddr)

Check how fast this simple generator is....Zillions per second. Grin
7  Economy / Games and rounds / Re: Bitcoin Alpha Challenge 815.85631744 BTC on: November 29, 2022, 10:56:23 AM
And let's imagine that NO.1 and NO.159 is the stupidest possible solution.

NO.1=0000001
NO.159=00009F

Code:
9F73E7200810000001B6E10CF00009F18C25AB770232B39B027XXXXB750F237A

How to brute-force last XXXX or XXXXB750F237A? Grin
8  Economy / Games and rounds / Re: Bitcoin Alpha Challenge 815.85631744 BTC on: November 29, 2022, 09:27:06 AM
very weird, what can VISION 313 be?

pdftotext bitcoin.pdf
Code:
311 A block header with no transactions would be about 80 bytes. If we suppose blocks are
312 generated every 10 minutes, 80 bytes * 6 * 24 * 365 = 4.2MB per year. With computer systems
313 typically selling with 2GB of RAM as of 2008, and Moore's Law predicting current growth of
314 1.2GB per year, storage should not be a problem even if the block headers must be kept in
315 memory.

It is a VISION. - line 313.  Number 2008 and 02
But this does not mean that this whole story is not a scam. Grin
9  Bitcoin / Bitcoin Discussion / Re: Will Crypto survive? on: November 28, 2022, 12:14:50 PM
Or Will Winter Last Forever?  Grin
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!