Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions .github/workflows/build-gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,16 @@ jobs:
os: [ubuntu-24.04, macOS-15, macOS-15-intel, windows-2022]
java: ['17', '21', '25']
distribution: ['temurin']
gradle: ['8.5', '8.14.3', '9.2.1']
gradle: ['8.14.3', '9.2.1']
exclude:
# Java 25+ requires Gradle 9.1+
- java: '25'
gradle: '8.5'
- java: '25'
gradle: '8.14.3'
# Exclude older versions of Gradle on macOS and Windows
- os: macOS-15
gradle: '8.5'
- os: macOS-15
gradle: '8.14.3'
- os: macOS-15-intel
gradle: '8.5'
- os: macOS-15-intel
gradle: '8.14.3'
- os: windows-2022
gradle: '8.5'
- os: windows-2022
gradle: '8.14.3'
fail-fast: false
Expand Down
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The bitcoinj library is a Java implementation of the Bitcoin protocol, which all
* Java 17+ for `tools`, `wallettool`, `examples`
* Java 25+ for the JavaFX-based `wallettemplate`
* https://gradle.org/[Gradle]
** Gradle 8.5+ for building the whole project or
** Gradle 9.1+ for building the whole project or
** Debian Gradle 4.4 for just the `base`, `core`, `tools`, `wallettool` and `examples` modules (see "reference build" below)
* https://github.com/google/protobuf[Google Protocol Buffers] - for use with serialization and hardware communications

Expand Down
7 changes: 6 additions & 1 deletion core/src/main/java/org/bitcoinj/core/CheckpointManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.Arrays;
import java.util.Base64;
import java.util.Map;
import java.util.Objects;
import java.util.TreeMap;
Expand Down Expand Up @@ -84,6 +85,10 @@ public class CheckpointManager {
protected final NetworkParameters params;
protected final Sha256Hash dataHash;

/**
* @deprecated Use {@link java.util.Base64} or a 3rd-party Base64 implementation.
*/
@Deprecated
public static final BaseEncoding BASE64 = BaseEncoding.base64().omitPadding();

/** Loads the default checkpoints bundled with bitcoinj */
Expand Down Expand Up @@ -128,7 +133,7 @@ private Sha256Hash readTextual(InputStream inputStream) throws IOException {
// Hash numCheckpoints in a way compatible to the binary format.
digest.update(ByteBuffer.allocate(4).order(ByteOrder.BIG_ENDIAN).putInt(numCheckpoints).array());
for (int i = 0; i < numCheckpoints; i++) {
byte[] bytes = BASE64.decode(reader.readLine());
byte[] bytes = Base64.getDecoder().decode(reader.readLine());
digest.update(bytes);
ByteBuffer buffer = ByteBuffer.wrap(bytes);
StoredBlock block;
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/org/bitcoinj/crypto/ECKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
import org.bouncycastle.math.ec.FixedPointUtil;
import org.bouncycastle.math.ec.custom.sec.SecP256K1Curve;
import org.bouncycastle.util.Properties;
import org.bouncycastle.util.encoders.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -77,6 +76,7 @@
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.Arrays;
import java.util.Base64;
import java.util.Comparator;
import java.util.Objects;
import java.util.Optional;
Expand Down Expand Up @@ -869,7 +869,7 @@ public String signMessage(String message, @Nullable AesKey aesKey, ScriptType sc
sigData[0] = (byte)headerByte;
System.arraycopy(ByteUtils.bigIntegerToBytes(sig.r, 32), 0, sigData, 1, 32);
System.arraycopy(ByteUtils.bigIntegerToBytes(sig.s, 32), 0, sigData, 33, 32);
return new String(Base64.encode(sigData), StandardCharsets.UTF_8);
return new String(Base64.getEncoder().encode(sigData), StandardCharsets.UTF_8);
}

/**
Expand All @@ -886,7 +886,7 @@ public String signMessage(String message, @Nullable AesKey aesKey, ScriptType sc
public static ECKey signedMessageToKey(String message, String signatureBase64) throws SignatureException {
byte[] signatureEncoded;
try {
signatureEncoded = Base64.decode(signatureBase64);
signatureEncoded = Base64.getDecoder().decode(signatureBase64);
} catch (RuntimeException e) {
// This is what you get back from Bouncy Castle if base64 doesn't decode :(
throw new SignatureException("Could not decode base64", e);
Expand Down
5 changes: 3 additions & 2 deletions tools/src/main/java/org/bitcoinj/tools/BuildCheckpoints.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.Base64;
import java.util.List;
import java.util.TreeMap;
import java.util.concurrent.Callable;
Expand Down Expand Up @@ -197,11 +198,11 @@ private static void writeTextualCheckpoints(TreeMap<Integer, StoredBlock> checkp
if (block.getChainWork().compareTo(MAX_WORK_V1) <= 0) {
((Buffer) bufferV1).rewind();
block.serializeCompact(bufferV1);
writer.println(CheckpointManager.BASE64.encode(bufferV1.array()));
writer.println(Base64.getEncoder().encodeToString(bufferV1.array()));
} else {
((Buffer) bufferV2).rewind();
block.serializeCompactV2(bufferV2);
writer.println(CheckpointManager.BASE64.encode(bufferV2.array()));
writer.println(Base64.getEncoder().encodeToString(bufferV2.array()));
}
}
System.out.println("Checkpoints written to '" + file.getCanonicalPath() + "'.");
Expand Down
Loading