Ah, OK, so you want something really easy.
I did something like that for myself, just a reading lines from file and checking in local database of founded addresses.
If you want to check if it was founded any time in the past, it is just a matter of DB. Take from Loyce, whatever you want
I may share the code or if you want I may modify it for you.
I have used postgresql local DB.
package wif;
import org.bitcoinj.core.Base58;
import org.bitcoinj.core.ECKey;
import org.bitcoinj.core.LegacyAddress;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.params.MainNetParams;
import java.io.*;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.sql.*;
import java.util.Arrays;
import java.util.Date;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class Brain {
static final NetworkParameters NETWORK_PARAMETERS = MainNetParams.get();
static final int STATUS_PERIOD = 1000*60*1;
static MessageDigest messageDigest;
static Statement statement;
static boolean RESULT = false;
public static void main(String[] args) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException, IOException, InterruptedException {
db();
messageDigest = MessageDigest.getInstance("SHA-256");
String filename=args[0];
int skip = 0;
if (args.length>1){
skip = Integer.valueOf(args[1]);
}
FileReader fileReader = null;
try {
fileReader = new FileReader(filename);
} catch (FileNotFoundException e) {
System.err.println("not found: " + filename);
System.exit(-1);
}
long count = 0;
long start = 0;
System.out.println("Brain start");
try {
BufferedReader bufferReader = new BufferedReader(fileReader);
String line;
//test
System.out.println(checkAddressDatabase("16jY7qLJnxb7CHZyqBP8qca9d51gAjyXQN"));
while ((line = bufferReader.readLine()) != null) {
if (line.trim().isEmpty()){
continue;
}
count++;
if (skip>0){
if (count continue;
}
skip = 0;
}
test(line);
test(line.toLowerCase());
test(line.toUpperCase());
if (line.endsWith(",")){
line=line.substring(0, line.length()-1);
test(line);
test(line.toLowerCase());
test(line.toUpperCase());
}
if (System.currentTimeMillis()-start > STATUS_PERIOD){
System.out.println("UP!"+count+" "+ line + " " + (new Date()));
start = System.currentTimeMillis();
count = 0;
}
}
}catch (Exception e){
System.err.println(e.getLocalizedMessage());
System.exit(-1);
}
System.out.println("Brain end");
}
private static void db() {
try{
Connection connection = DriverManager.getConnection("jdbc:postgresql://localhost:5433/bitcoin", "postgres", "pass1234");
System.out.println("Connected to PostgreSQL database!");
statement = connection.createStatement();
}catch (Exception e){
System.out.println(e.getMessage());
System.exit(-1);
}
}
private static void test(String text) throws IOException, SQLException {
messageDigest.update(text.getBytes("UTF-8"));
ECKey ecKey = new ECKey(messageDigest.digest(), (byte[])null);
String address = LegacyAddress.fromKey(NETWORK_PARAMETERS, ecKey).toString();
System.out.println(address+":"+ecKey.getPrivateKeyAsWiF(NETWORK_PARAMETERS));
if (1==1){
return;
}
if (checkAddressDatabase(address)){
System.out.println(address);
System.out.println(text + "|" + ecKey.getPrivateKeyAsHex()+"|"+ecKey.getPrivateKeyAsWiF(NETWORK_PARAMETERS)+"|"+address);
FileWriter myWriter = new FileWriter("brainResult.txt", true);
myWriter.write(text + "|" + ecKey.getPrivateKeyAsHex()+"|"+ecKey.getPrivateKeyAsWiF(NETWORK_PARAMETERS)+"|"+address);
myWriter.close();
}
ecKey = PrivateKey.fromBase58(NETWORK_PARAMETERS, getCompressedWif(ecKey.getPrivateKeyAsHex())).getKey();
address = LegacyAddress.fromKey(NETWORK_PARAMETERS, ecKey).toString();
if (checkAddressDatabase(address)){
System.out.println(text + "|" + ecKey.getPrivateKeyAsHex()+"|"+ecKey.getPrivateKeyAsWiF(NETWORK_PARAMETERS)+"|"+address);
FileWriter myWriter = new FileWriter("brainResult.txt", true);
myWriter.write(text + "|" + ecKey.getPrivateKeyAsHex()+"|"+ecKey.getPrivateKeyAsWiF(NETWORK_PARAMETERS)+"|"+address);
myWriter.write("\r\n");
myWriter.close();
}
}
private static String getCompressedWif(String hex){
String string = "80"+hex+"01";
byte[] digest = messageDigest.digest(hexStringToByteArray(string));
String checksum = bytesToHex(messageDigest.digest(digest)).substring(0,8);
byte[] data = hexStringToByteArray(string + checksum);
return Base58.encode(data);
}
private static boolean checkAddressDatabase(String address) throws SQLException {
ResultSet resultSet = statement.executeQuery("SELECT balance FROM public.adress WHERE address='"+address+"'");
while (resultSet.next()) {
return true;
}
return false;
}
private static String bytesToHex(byte[] bytes) {
StringBuffer result = new StringBuffer();
for (byte b : bytes) result.append(Integer.toString((b & 0xff) + 0x100, 16).substring(1));
return result.toString();
}
private static byte[] hexStringToByteArray(String s) {
int len = s.length();
byte[] data = new byte[len / 2];
for (int i = 0; i < len; i += 2) {
data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
+ Character.digit(s.charAt(i+1), 16));
}
return data;
}
}