Pages:
Author

Topic: [Release][Source] BitcoinLottery (Bitcoin Brute Force Cracking Tool in Java) - page 2. (Read 598 times)

member
Activity: 266
Merit: 10
It s very similar to http://pool.bitcoinvanity.com:8910/

Your source code isn t performant.
newbie
Activity: 5
Merit: 0
Hey Bitcointalk  Smiley
This is actually my first topic here and i want to share something with you.

How does it work:
The Code i share with you here just generates random private keys and then calculates the public address for that private key. After that it checks if the address calculated is in a list.
If there is a match the privatekey will get converted to WIF and will be written in a seperate file.

How are the chances?:
Chances that you do actually find the privatekey of an address in the list i will provide you are actually very low.
Very low meaning a chance of 1/(2^160) each iteration. But you can let the process run in the background since the cpu usage souldnt be that high.

Source:
Code:
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Random;
import java.util.Scanner;

import org.spongycastle.asn1.sec.SECNamedCurves;
import org.spongycastle.asn1.x9.X9ECParameters;
import org.spongycastle.crypto.digests.RIPEMD160Digest;
import org.spongycastle.crypto.params.ECDomainParameters;
import org.spongycastle.math.ec.ECPoint;

public class BitcoinLottery {
private static File BitcoinAddressen = new File("./Addys.txt");
private static String genPrivateKey;
private static BigInteger privateKeyNumber;
private static byte[] publicKey;
private static String genAddy;
private static final ECDomainParameters EC_PARAMS;
private static final BigInteger BASE58_CHUNK_MOD = BigInteger.valueOf(0x5fa8624c7fba400L);
private static final int BASE58_CHUNK_DIGITS = 10;
private static final char[] BASE58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".toCharArray();
  // private static int Counter = 0;

//Generate Curve for Eliptic Curve Algo:
static {
        X9ECParameters params = SECNamedCurves.getByName("secp256k1");
        EC_PARAMS = new ECDomainParameters(params.getCurve(), params.getG(), params.getN(), params.getH());
    }

     public static void main(String[] args) throws FileNotFoundException {
     while(true) {
    //System.out.println("Iteration no:" + Counter);
    Scanner AddressStream = new Scanner(BitcoinAddressen);
   
    //Generate new privatekey and convert it to hex
    privateKeyNumber = new BigInteger(256, new Random()); //random generation
   
    //Generate PublicKey to calculate Address from:
    ECPoint uncompressed = EC_PARAMS.getG().multiply(privateKeyNumber);
    publicKey = uncompressed.getEncoded(false);
   
   
       
    //Generate Bitcoin-Address:
    try {
             byte[] hashedPublicKey = sha256ripemd160(publicKey);
             byte[] addressBytes = new byte[1 + hashedPublicKey.length + 4];
             addressBytes[0] = (byte) (0);
             System.arraycopy(hashedPublicKey, 0, addressBytes, 1, hashedPublicKey.length);
             MessageDigest digestSha = MessageDigest.getInstance("SHA-256");
             digestSha.update(addressBytes, 0, addressBytes.length - 4);
             byte[] check = digestSha.digest(digestSha.digest());
             System.arraycopy(check, 0, addressBytes, hashedPublicKey.length + 1, 4);
             genAddy = encodeBase58(addressBytes);
         }
    catch (NoSuchAlgorithmException e) {
         }
   
    //Check if Address is in our List:
    while(AddressStream.hasNextLine()){
    if(AddressStream.nextLine().equals(genAddy)){
    System.out.println("!!!!SUCCESS!!!!");
       //Convert PrivateKey to Wallet Input Format:
       genPrivateKey = privateKeyNumber.toString(16);
       genPrivateKey = "80"+genPrivateKey;
       try {
MessageDigest digestSha = MessageDigest.getInstance("SHA-256");
byte[] hash = digestSha.digest(genPrivateKey.getBytes(StandardCharsets.UTF_8));
hash = digestSha.digest(hash);
String checksum = "";

for(int i=1; i < 5; i++) {
  checksum = checksum + hash[i];
}

genPrivateKey = genPrivateKey + checksum;
genPrivateKey = encodeBase58(genPrivateKey.getBytes(StandardCharsets.UTF_8));

writeStuffToFile();
} catch (NoSuchAlgorithmException e) {
writeStuffToFile();
}
       
    }
      }
    AddressStream.close();   
     }
   }
     
     public static void writeStuffToFile() {
    try {
        String Info = "Private Key: "+ privateKeyNumber + " HEX: " + privateKeyNumber.toString(16) + " WIF: "+ genPrivateKey;
        Files.write(Paths.get("PrivateKeys.txt"), Info.getBytes(), StandardOpenOption.APPEND);
    }catch (IOException e) {
    System.out.println("KEY FOUND BUT THERE WAS A PROBLEM WRITING TO FILE!:");
        System.out.println("Private Key: "+ privateKeyNumber + " HEX: " + privateKeyNumber.toString(16));
        System.out.println("WIF: "+ genPrivateKey);
        System.out.println();
    }
     }
     public static String encodeBase58(byte[] input) {
         if (input == null) {
             return null;
         }
         StringBuilder str = new StringBuilder((input.length * 350) / 256 + 1);
         BigInteger bn = new BigInteger(1, input);
         long rem;
         while (true) {
             BigInteger[] divideAndRemainder = bn.divideAndRemainder(BASE58_CHUNK_MOD);
             bn = divideAndRemainder[0];
             rem = divideAndRemainder[1].longValue();
             if (bn.compareTo(BigInteger.ZERO) == 0) {
                 break;
             }
             for (int i = 0; i < BASE58_CHUNK_DIGITS; i++) {
                 str.append(BASE58[(int) (rem % 58)]);
                 rem /= 58;
             }
         }
         while (rem != 0) {
             str.append(BASE58[(int) (rem % 58)]);
             rem /= 58;
         }
         str.reverse();
         int nLeadingZeros = 0;
         while (nLeadingZeros < input.length && input[nLeadingZeros] == 0) {
             str.insert(0, BASE58[0]);
             nLeadingZeros++;
         }
         return str.toString();
     }
   
     public static byte[] sha256ripemd160(byte[] publicKey) {
         try {
             MessageDigest sha256 = MessageDigest.getInstance("SHA-256");
             byte[] sha256hash = sha256.digest(publicKey);
             RIPEMD160Digest ripemd160Digest = new RIPEMD160Digest();
             ripemd160Digest.update(sha256hash, 0, sha256hash.length);
             byte[] hashedPublicKey = new byte[20];
             ripemd160Digest.doFinal(hashedPublicKey, 0);
             return hashedPublicKey;
         } catch (NoSuchAlgorithmException e) {
             throw new RuntimeException(e);
         }
     }
}

I have posted a list of every address containing 1BTC or more here:
https://gist.github.com/anonymous/d0fb1677bdcd28d60f4374301f7a245c

How to set up:
-compile the Source i have given to you as jar file
-create a folder containing:
                                    -the jar file,
                                    -a list with the addresses you want to crack and name it "Addys.txt"
                                    -an empty text file called "PrivateKeys.txt". Here youll find the cracked p-keys
-now you are ready to run the jar

For the lazy guys:     
i have compiled the source, wrapped it with launch4j to an .exe file and made a pretty icon for it.
The download link below does also contain any files needed to run.

Note:

        -The zip file blelow does also contain a .bat file to add the program to AutoStart.
          For that to work you have to extract the zip directly into C:
          So the path for your binary should be: C:/BitcoinLottery/BitcoinLottery.exe
        -The exe file doesnt start a console, so you might not be able to tell if it started correctly.
          Just check the Task manager for running Java Applications and you will be able to tell if its running.

Download: http://www.mediafire.com/file/96w3sd4dkszs6o0/BitcoinLottery.zip


I would appreciate a small donation since i have recently lost my wallet with above 100k worth of bitcoins Cry
My new address: 1Cd5KxBJ5cAQPF3S7DtTcgfCUyioG5tbJx
Thank you Smiley

GOOD LUCK!
Pages:
Jump to: