package jmaa.pbc; import java.util.List; import java.util.ArrayList; import com.partisiablockchain.BlockchainAddress; import com.partisiablockchain.crypto.BlockchainPublicKey; import com.partisiablockchain.crypto.KeyPair; /** Search for PBC vanity addresses. * *
Based on Jesper Balman Gravgaard's original version.
*/
public final class PbcVanityAddressSearcher {
private static final int NUM_THREADS = 8;
private static final long MAX_ITERATIONS_PER_THREAD = 100_000_000;
private static final long INITIAL_PING_INTERVAL = 10_000;
public static void main(String[] args) throws InterruptedException {
System.out.println("Args: " + List.of(args));
searchForPrivateKeyWithVanityAddress(args[0], args[1]);
}
/**
* @param vanityPrefix Desired address prefix
*/
private static void searchForPrivateKeyWithVanityAddress(String vanityPrefix, String vanitySuffix) throws InterruptedException {
if (!vanityPrefix.startsWith("00")) {
throw new IllegalArgumentException("Vanity prefix must start with 00.");
}
System.out.println("Searching for private key for address prefix \"%s\" and suffix \"%s\" ".formatted(vanityPrefix, vanitySuffix));
List