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
22 changes: 18 additions & 4 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ Although the API is changing, binary packages are available on https://gitlab.co

=== Nix Package

An experimental Nix Package which includes the `jrpc` JSON-RPC tool is now available. You can install a native-image of the tool with Nix, via:
An experimental Nix Package which includes:

1. A natively-compiled binary `jrpc` JSON-RPC tool.
2. A JVM-based `jrpc-echod` tool.
3. A JVM-based `walletd` tool.

You can install these tools with Nix, via:

----
nix profile install github:ConsensusJ/consensusj#consensusj-tools
Expand Down Expand Up @@ -92,6 +98,7 @@ jrpc help # Get RPC help from default server
jrpc -c btcmain help # Get RPC help from 'btcmain' in 'config.toml'
----

The `jrpc-echod` and `walletd` tools do not currently have help and are mainly used for integration testing.

==== Maven

Expand Down Expand Up @@ -478,6 +485,11 @@ To build and run from Gradle:

./gradlew :consensusj-jrpc-echod:run

To build an "installable" JVM application and run:

./gradlew :consensusj-jrpc-echod:installDist
./consensusj-jrpc-echod/build/install/jrpc-echod/bin/jrpc-echod

To build a native image and run:

./gradlew :consensusj-jrpc-echod:nativeCompile
Expand All @@ -489,7 +501,9 @@ To build and run from Gradle:

./gradlew :cj-btc-walletd:run --args="-walletd.config.network-id=testnet"

To build a native image and run:
To build an "installable" JVM application and run:

./gradlew :cj-btc-walletd:installDist
./cj-btc-walletd/build/install/walletd/bin/walletd -walletd.config.network-id=testnet

./gradlew :cj-btc-walletd:nativeCompile
./cj-btc-walletd/build/native/nativeCompile/walletd -walletd.config.network-id=testnet
(The native-image build of `walletd` is still in need of fine-tuning.)
1 change: 1 addition & 0 deletions cj-btc-walletd/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ dependencies {

application {
mainClass.set("org.consensusj.daemon.micronaut.Application")
applicationName = 'walletd'
}

dockerBuild {
Expand Down
22 changes: 20 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
inherit system;
};
mainProgram = "jrpc";
jdk = pkgs.jdk25;
echodProgram = "jrpc-echod";
walletdProgram = "walletd";
jdk = pkgs.jdk25_headless;
graalvm = pkgs.graalvmPackages.graalvm-ce;
gradle = pkgs.gradle_9.override {
java = jdk; # Run Gradle with this JDK
Expand All @@ -76,7 +78,7 @@
preBuild = ''
export GRAALVM_HOME=${graalvm}
'';
gradleBuildTask = "consensusj-jrpc:nativeCompile";
gradleBuildTask = "consensusj-jrpc:nativeCompile consensusj-jrpc-echod:installDist cj-btc-walletd:installDist";

gradleFlags = [ "--info --stacktrace" ];

Expand All @@ -87,6 +89,22 @@
mkdir -p $out/bin
cp consensusj-jrpc/build/${mainProgram} $out/bin/${mainProgram}
wrapProgram $out/bin/${mainProgram}

# Package `jrpc-echod` as JARs and a JDK
mkdir -p $out/{bin,share/${echodProgram}/lib}
cp consensusj-jrpc-echod/build/install/${echodProgram}/lib/*.jar $out/share/${echodProgram}/lib
# Compute CLASSPATH: all .jar files in $out/share/${echodProgram}/lib
export ECHOD_PATH=$(find $out/share/${echodProgram}/lib -name "*.jar" -printf ':%p' | sed 's|^:||') # Colon-separated, no leading :
makeWrapper ${jdk}/bin/java $out/bin/${echodProgram} \
--add-flags "-cp $ECHOD_PATH org.consensusj.jsonrpc.daemon.Application"

# Package `walletd` as JARs and a JDK
mkdir -p $out/{bin,share/${walletdProgram}/lib}
cp cj-btc-walletd/build/install/${walletdProgram}/lib/*.jar $out/share/${walletdProgram}/lib
# Compute CLASSPATH: all .jar files in $out/share/${walletdProgram}/lib
export WALLETD_PATH=$(find $out/share/${walletdProgram}/lib -name "*.jar" -printf ':%p' | sed 's|^:||') # Colon-separated, no leading :
makeWrapper ${jdk}/bin/java $out/bin/${walletdProgram} \
--add-flags "-cp $WALLETD_PATH org.consensusj.daemon.micronaut.Application"
'';
});
in
Expand Down
Loading