Skip to content

Commit 4fb503c

Browse files
Improve logLMDBStats. Improve README.md
1 parent 17447df commit 4fb503c

File tree

6 files changed

+85
-48
lines changed

6 files changed

+85
-48
lines changed

README.md

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# BitcoinAddressFinder
22
A high performance bitcoin address finder.
3-
The main goal is to generate as fast as possible (Bitcoin/Altcoin) addresses using the JVM and OpenCL and check if the address was used/not used before.
3+
The main goal is to generate as fast as possible (Bitcoin/Altcoin) addresses using the JVM and OpenCL and check if the address (RIPEMD160 hash) was used/not used before. This includes possible collisions.
44

55
Copyright (c) 2017-2021 Bernard Ladenthin.
66

@@ -52,27 +52,26 @@ The exporter writes all addresses in different formats:
5252
* DynamicWidthBase58BitcoinAddressWithAmount: The addresses will be written with amount.
5353

5454
### Use my prepared database
55-
Last update: February 2, 2021
56-
* Light (3GB)
55+
* Light (3GiB), Last update: February 10, 2021
5756
* Contains Bitcoin addresses whith amount and many altcoin addresses with amount.
58-
* Unique entries: 64152698
59-
* Link (1.5GB packed): http://ladenthin.net/lmdb_light.zip
57+
* Unique entries: 65170711
58+
* Link (1.8GiB packed): http://ladenthin.net/lmdb_light.zip
6059
* Checksums:
61-
* CRC32: F105D7D2
62-
* MD5: 67205F0663C1704A9718E04763547003
63-
* RIPEMD-160: 105123329E19E42317873D5DFCEB99B089983CE0
64-
* SHA-1: 65BE8590B525339192683AD0123F5CEADE8408FA
65-
* SHA-256: C9EE740E8AADFB89DAB5B009792FDA8A880241D2A689FC31E461B78D0E198575
66-
* SHA3-224: B28D4499F5A2CFA2424243BC01E2DFE9C57D38ABDB841E9872674899
67-
* SHA3-256: B1C491D8E2111DB654632A20CE4D90F0CB6BB5B839AD57B8B9F34C4A38D5C610
68-
* SHA3-384: C28AF0ECE7A4A4CCBA3804954B72023E1598BB7D584D203AD54827148FAD7FD959F46AF2B652530219CD1530D71E9271
69-
* SHA3-512: 495264374AC4AA3E4A360D23650E31CF2CF3FD39C13AFF3BB1AF413029FBFC8C1D355D6BDD38DA47212A2C392190D06F44716F1F2A667FFF6D7C6BB9EE382E29
70-
* Mapsize: 2944 MiB
71-
* Static amount of 1 is used to allow better compression.
72-
* Full (41GB)
60+
* CRC32: 7195F4B7
61+
* MD5: 7D30D0589FE36AD1688118D3DA7F02F7
62+
* RIPEMD-160: FF8C8D925E48A740A044A511E973450EC2E4F285
63+
* SHA-1: FF471DF78C8A6555E70BB89B0AC66345181CCABE
64+
* SHA-256: 7AE7B71986D6267523A48E831AA00538E40A985AD415ADB7D5803084F5C6351C
65+
* SHA3-224: 5D00BE0AC0B1DCC40EC890E63ADB7DB74122E4E5FCAE45AF52ACC391
66+
* SHA3-256: A0E39E8CC7A9B1D6AFE961515A54ECF510F9412A58C6F0E5774D71241D94A7A5
67+
* SHA3-384: B8DCC266E8E5F7776DC93A65BA8B5C9CD383E78F445D5A09B395EB1BB5B5F8D555945CA6807769BF22F8925957EE99F0
68+
* SHA3-512: 92F8AF64BAFAB5556D0569F3AD30718258C5EA3E15CE9AF054C419A398A0494A3E3F21BBB9A8C21C9D29294B4EF5DE3D98B0851392D28DCD4FA5F6CC59C4424C
69+
* Mapsize: 2752 MiB
70+
* Static amount of 0 is used to allow better compression.
71+
* Full (41GiB), Last update: February 2, 2021
7372
* Contains all Bitcoin addresses which are ever used and many altcoin addresses with and without amount.
7473
* Unique entries: 769941703
75-
* Link (18.9GB packed): http://ladenthin.net/lmdb_full.zip
74+
* Link (18.9GiB packed): http://ladenthin.net/lmdb_full.zip
7675
* Checksums:
7776
* CRC32: E7301034
7877
* MD5: 9FCFA57CEA79EDFE7D2A6614E03CD3B2
@@ -98,7 +97,8 @@ Last update: February 2, 2021
9897
Find personal vanity addresses and check if addresses already exists in the lmdb can be used together.
9998

10099
### Key range
101-
A key range can be defined (e.g. 64-bit) whereas the first 192-bit (256-bit - 64-bit) are zeroed. This can be used to creaty keys in a specific range to find keys in a known range (e.g. [Bitcoin Puzzle Transaction](https://privatekeys.pw/puzzles/bitcoin-puzzle-tx)).
100+
A key range can be defined (e.g. 64-bit) whereas the first (e.g. 192-bit (256-bit - 64-bit)) are zeroed. This can be used to creaty keys in a specific range to find keys in a known range (e.g. [Bitcoin Puzzle Transaction](https://privatekeys.pw/puzzles/bitcoin-puzzle-tx)).
101+
This can be also used to proof that the software works.
102102

103103
### OpenCL
104104
To increase the performance of the EC-key generation OpenCL can be used.
@@ -132,6 +132,10 @@ Please find the answear for vulnerability questions somewhere else:
132132
* https://allprivatekeys.com/get-lucky
133133
* https://allprivatekeys.com/vanity-address
134134
* https://github.com/treyyoder/bitcoin-wallet-finder
135+
* https://github.com/albertobsd/keyhunt
136+
* https://github.com/mvrc42/bitp0wn
137+
* https://github.com/JeanLucPons/BTCCollider
138+
* https://github.com/JeanLucPons/VanitySearch
135139

136140
-----
137141
## Legal

src/main/java/net/ladenthin/bitcoinaddressfinder/AddressFilesToLMDB.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ public void run() {
6262
persistence.init();
6363
logger.info("Init done.");
6464

65-
logLMDBStats();
66-
6765
try {
6866
logger.info("check if all configured address files exists");
6967
for (String addressesFilePath : addressFilesToLMDB.addressesFiles) {
@@ -107,28 +105,13 @@ public void run() {
107105
for (String error : readStatistic.errors) {
108106
logger.info("Error in line: " + error);
109107
}
110-
111-
logLMDBStats();
112-
113108
} catch (IOException e) {
114109
throw new RuntimeException(e);
115110
} finally {
116111
persistence.close();
117112
}
118113
}
119114

120-
private void logLMDBStats() {
121-
logger.info("##### BEGIN: LMDB stats #####");
122-
logger.info("... this may take a lot of time ...");
123-
logger.info("DatabaseSize: " + new ByteConversion().bytesToMib(persistence.getDatabaseSize()) + " MiB");
124-
logger.info("IncreasedCounter: " + persistence.getIncreasedCounter());
125-
logger.info("IncreasedSum: " + new ByteConversion().bytesToMib(persistence.getIncreasedSum()) + " MiB");
126-
// Attention: slow!
127-
long count = persistence.count();
128-
logger.info("LMDB contains " + count + " unique entries.");
129-
logger.info("##### END: LMDB stats #####");
130-
}
131-
132115
private void logProgress() {
133116
logger.info("Progress: " + addressCounter.get() + " addresses. Unsupported: " + readStatistic.unsupported + ". Errors: " + readStatistic.errors.size() + ". Current File progress: " + String.format("%.2f", readStatistic.currentFileProgress) + "%.");
134117
}

src/main/java/net/ladenthin/bitcoinaddressfinder/ConsumerJava.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ protected void initLMDB() {
9999
PersistenceUtils persistenceUtils = new PersistenceUtils(networkParameters);
100100
persistence = new LMDBPersistence(consumerJava.lmdbConfigurationReadOnly, persistenceUtils);
101101
persistence.init();
102-
logger.info("Stats: " + persistence.getStatsAsString());
103102
}
104103

105104
private String createStatisticsMessage(long uptime, long keys, long keysSumOfTimeToCheckContains, long emptyConsumer, long hits) {

src/main/java/net/ladenthin/bitcoinaddressfinder/configuration/CLMDBConfigurationReadOnly.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,14 @@ public class CLMDBConfigurationReadOnly {
2828
* The LMDB proxy (see {@link org.lmdbjava.ByteBufferProxy}).
2929
*/
3030
public boolean useProxyOptimal = true;
31+
32+
/**
33+
* Log the lmdb stats on init. This enforces a read of the whole database. It's in memory afterwards. This option may take a
34+
*/
35+
public boolean logStatsOnInit = false;
36+
37+
/**
38+
* Log the lmdb stats on close.
39+
*/
40+
public boolean logStatsOnClose = false;
3141
}

src/main/java/net/ladenthin/bitcoinaddressfinder/persistence/Persistence.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ public interface Persistence {
5454

5555
Coin getAllAmountsFromAddresses(List<ByteBuffer> hash160s);
5656

57-
String getStatsAsString();
58-
5957
long getDatabaseSize();
6058

6159
void increaseDatabaseSize(long toIncrease);
@@ -71,4 +69,9 @@ public interface Persistence {
7169
* @return
7270
*/
7371
long getIncreasedSum();
72+
73+
/**
74+
* Attention: This method might me take a lot of time.
75+
*/
76+
void logStats();
7477
}

src/main/java/net/ladenthin/bitcoinaddressfinder/persistence/lmdb/LMDBPersistence.java

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,15 @@
5050
import static org.lmdbjava.DbiFlags.MDB_CREATE;
5151
import static org.lmdbjava.Env.create;
5252
import org.lmdbjava.EnvInfo;
53+
import org.slf4j.Logger;
54+
import org.slf4j.LoggerFactory;
5355

5456
public class LMDBPersistence implements Persistence {
5557

5658
private static final String DB_NAME_HASH160_TO_COINT = "hash160toCoin";
5759
private static final int DB_COUNT = 1;
60+
61+
private final Logger logger = LoggerFactory.getLogger(LMDBPersistence.class);
5862

5963
private final PersistenceUtils persistenceUtils;
6064
private final CLMDBConfigurationWrite lmdbConfigurationWrite;
@@ -111,6 +115,8 @@ public void init() {
111115
} else {
112116
throw new IllegalArgumentException();
113117
}
118+
119+
logStatsOnInitByConfig();
114120
}
115121

116122
/**
@@ -126,9 +132,36 @@ private BufferProxy<ByteBuffer> getBufferProxyByUseProxyOptimal(boolean useProxy
126132
return ByteBufferProxy.PROXY_SAFE;
127133
}
128134
}
135+
136+
private void logStatsOnInitByConfig() {
137+
if (lmdbConfigurationWrite != null) {
138+
if (lmdbConfigurationWrite.logStatsOnInit) {
139+
logStats();
140+
}
141+
}
142+
if (lmdbConfigurationReadOnly != null) {
143+
if (lmdbConfigurationReadOnly.logStatsOnInit) {
144+
logStats();
145+
}
146+
}
147+
}
148+
149+
private void logStatsOnCloseByConfig() {
150+
if (lmdbConfigurationWrite != null) {
151+
if (lmdbConfigurationWrite.logStatsOnClose) {
152+
logStats();
153+
}
154+
}
155+
if (lmdbConfigurationReadOnly != null) {
156+
if (lmdbConfigurationReadOnly.logStatsOnClose) {
157+
logStats();
158+
}
159+
}
160+
}
129161

130162
@Override
131163
public void close() {
164+
logStatsOnCloseByConfig();
132165
lmdb_h160ToAmount.close();
133166
}
134167

@@ -261,15 +294,6 @@ public Coin getAllAmountsFromAddresses(List<ByteBuffer> hash160s) {
261294
return allAmounts;
262295
}
263296

264-
@Override
265-
public String getStatsAsString() {
266-
return getStats().toString();
267-
}
268-
269-
public Stat getStats() {
270-
return env.stat();
271-
}
272-
273297
@Override
274298
public long count() {
275299
long count = 0;
@@ -306,4 +330,18 @@ public long getIncreasedCounter() {
306330
public long getIncreasedSum() {
307331
return increasedSum;
308332
}
333+
334+
@Override
335+
public void logStats() {
336+
logger.info("##### BEGIN: LMDB stats #####");
337+
logger.info("... this may take a lot of time ...");
338+
logger.info("DatabaseSize: " + new ByteConversion().bytesToMib(getDatabaseSize()) + " MiB");
339+
logger.info("IncreasedCounter: " + getIncreasedCounter());
340+
logger.info("IncreasedSum: " + new ByteConversion().bytesToMib(getIncreasedSum()) + " MiB");
341+
logger.info("Stat: " + env.stat());
342+
// Attention: slow!
343+
long count = count();
344+
logger.info("LMDB contains " + count + " unique entries.");
345+
logger.info("##### END: LMDB stats #####");
346+
}
309347
}

0 commit comments

Comments
 (0)