Initial commit
This commit is contained in:
commit
1ddde97548
54
pom.xml
Normal file
54
pom.xml
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>jmaa</groupId>
|
||||
<artifactId>pbc-vanity-address</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>4.0.0</version>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>AGPL-3.0-or-later</name>
|
||||
<url>https://www.gnu.org/licenses/agpl.txt</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>gitlab-partisiablockchain</id>
|
||||
<url>https://gitlab.com/api/v4/groups/12499775/-/packages/maven/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<parent>
|
||||
<groupId>com.partisiablockchain</groupId>
|
||||
<artifactId>pom</artifactId>
|
||||
<version>4.57.0</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.secata.tools</groupId>
|
||||
<artifactId>coverage</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.partisiablockchain.core</groupId>
|
||||
<artifactId>blockchain</artifactId>
|
||||
<version>4.74.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.4.12</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
52
src/main/jmaa/pbc/PbcVanityAddressSearcher.java
Normal file
52
src/main/jmaa/pbc/PbcVanityAddressSearcher.java
Normal file
|
@ -0,0 +1,52 @@
|
|||
package jmaa.pbc;
|
||||
|
||||
/** Search for PBC vanity addresses.
|
||||
*
|
||||
* <p>Based on Jesper Balman Gravgaard's original version.
|
||||
*/
|
||||
public final class PbcVanityAddressSearcher {
|
||||
|
||||
/** The vanity prefix to hunt for. */
|
||||
public static final String VANITY_PREFIX = "00badc0de";
|
||||
|
||||
@Test
|
||||
void randomKeys() throws InterruptedException {
|
||||
List<Thread> searchers = new ArrayList<>();
|
||||
for(int i=0;i<8;i++) {
|
||||
final Thread searcher = new Thread(new KeySearcher(i));
|
||||
searcher.start();
|
||||
searchers.add(searcher);
|
||||
}
|
||||
|
||||
for (Thread searcher : searchers) {
|
||||
searcher.join();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
record KeySearcher(int id) implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
long start = System.nanoTime();
|
||||
for(int i=0;i<100_000_000;i++) {
|
||||
final KeyPair keyPair = new KeyPair();
|
||||
final BlockchainPublicKey publicKey = keyPair.getPublic();
|
||||
final BlockchainAddress address = publicKey.createAddress();
|
||||
if(address.writeAsString().startsWith(VANITY_PREFIX)) {
|
||||
System.out.println("["+id+"] match: "+address.writeAsString()+ " - "+keyPair.getPrivateKey().toString(16));
|
||||
}
|
||||
if (i % 1_000_000 == 0) {
|
||||
final long now = System.nanoTime();
|
||||
final long duration = (now - start) / 1_000_000;
|
||||
System.out.print("["+id+":"+i+"] "+duration+" ");
|
||||
start = now;
|
||||
}
|
||||
if ((id==0) && (i % 1_000_000 == 10_000)) {
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user