WalletTool: Move to its own wallettool submodule

This commit is contained in:
Sean Gilligan 2022-01-03 20:36:12 -08:00 committed by Andreas Schildbach
parent 0d67977ca1
commit da6d6be288
5 changed files with 35 additions and 13 deletions

View File

@ -11,7 +11,7 @@ The bitcoinj library is a Java implementation of the Bitcoin protocol, which all
### Technologies
* Java 8+ (needs Java 8 API or Android 7.0 API, compiles to Java 8 bytecode) and Gradle 4.4+ for the `core` module
* Java 11+ and Gradle 4.4+ for `tools` and `examples`
* Java 11+ and Gradle 4.4+ for `tools`, `wallettool` and `examples`
* Java 11+ and Gradle 4.10+ for the JavaFX-based `wallettemplate`
* [Gradle](https://gradle.org/) - for building the project
* [Google Protocol Buffers](https://github.com/google/protobuf) - for use with serialization and hardware communications
@ -41,16 +41,16 @@ Alternatively, just import the project using your IDE. [IntelliJ](http://www.jet
### Building and Using the Wallet Tool
The **bitcoinj** `tools` subproject includes a command-line Wallet Tool (`wallet-tool`) that can be used to create and manage **bitcoinj**-based wallets (both the HD keychain and SPV blockchain state.) Using `wallet-tool` on Bitcoin's test net is a great way to learn about Bitcoin and **bitcoinj**.
The **bitcoinj** `wallettool` subproject includes a command-line Wallet Tool (`wallet-tool`) that can be used to create and manage **bitcoinj**-based wallets (both the HD keychain and SPV blockchain state.) Using `wallet-tool` on Bitcoin's test net is a great way to learn about Bitcoin and **bitcoinj**.
To build an executable shell script that runs the command-line Wallet Tool, use:
```
gradle bitcoinj-tools:installDist
gradle bitcoinj-wallettool:installDist
```
You can now run the `wallet-tool` without parameters to get help on its operation:
```
./tools/build/install/wallet-tool/bin/wallet-tool
./wallettool/build/install/wallet-tool/bin/wallet-tool
```
To create a test net wallet file in `~/bitcoinj/bitcoinj-test.wallet`, you would use:
@ -58,20 +58,20 @@ To create a test net wallet file in `~/bitcoinj/bitcoinj-test.wallet`, you would
mkdir ~/bitcoinj
```
```
./tools/build/install/wallet-tool/bin/wallet-tool --net=TEST --wallet=$HOME/bitcoinj/bitcoinj-test.wallet create
./wallettool/build/install/wallet-tool/bin/wallet-tool --net=TEST --wallet=$HOME/bitcoinj/bitcoinj-test.wallet create
```
To sync the newly created wallet in `~/bitcoinj/bitcoinj-test.wallet` with the test net, you would use:
```
./tools/build/install/wallet-tool/bin/wallet-tool --net=TEST --wallet=$HOME/bitcoinj/bitcoinj-test.wallet sync
./wallettool/build/install/wallet-tool/bin/wallet-tool --net=TEST --wallet=$HOME/bitcoinj/bitcoinj-test.wallet sync
```
To dump the state of the wallet in `~/bitcoinj/bitcoinj-test.wallet` with the test net, you would use:
```
./tools/build/install/wallet-tool/bin/wallet-tool --net=TEST --wallet=$HOME/bitcoinj/bitcoinj-test.wallet dump
./wallettool/build/install/wallet-tool/bin/wallet-tool --net=TEST --wallet=$HOME/bitcoinj/bitcoinj-test.wallet dump
```
Note: These instructions are for macOS/Linux, for Windows use the `tools/build/install/wallet-tool/bin/wallet-tool.bat` batch file with the equivalent Windows command-line commands and options.
Note: These instructions are for macOS/Linux, for Windows use the `wallettool/build/install/wallet-tool/bin/wallet-tool.bat` batch file with the equivalent Windows command-line commands and options.
### Example applications

View File

@ -22,6 +22,9 @@ project(':core').name = 'bitcoinj-core'
include 'tools'
project(':tools').name = 'bitcoinj-tools'
include 'wallettool'
project(':wallettool').name = 'bitcoinj-wallettool'
include 'examples'
project(':examples').name = 'bitcoinj-examples'

View File

@ -1,6 +1,5 @@
plugins {
id 'java'
id 'application'
id 'eclipse'
}
@ -19,9 +18,6 @@ compileJava {
options.compilerArgs.addAll(['--release', '11'])
}
mainClassName = "org.bitcoinj.tools.WalletTool"
applicationName = "wallet-tool"
task build_checkpoints(type: JavaExec) {
description = 'Create checkpoint files to use with CheckpointManager.'
main = 'org.bitcoinj.tools.BuildCheckpoints'

23
wallettool/build.gradle Normal file
View File

@ -0,0 +1,23 @@
plugins {
id 'java'
id 'application'
id 'eclipse'
}
dependencies {
implementation project(':bitcoinj-core')
implementation 'info.picocli:picocli:4.6.1'
implementation 'org.slf4j:slf4j-jdk14:1.7.32'
}
sourceCompatibility = 11
compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'
javadoc.options.encoding = 'UTF-8'
compileJava {
options.compilerArgs.addAll(['--release', '11'])
}
mainClassName = "org.bitcoinj.wallettool.WalletTool"
applicationName = "wallet-tool"

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.bitcoinj.tools;
package org.bitcoinj.wallettool;
import org.bitcoinj.core.Sha256Hash;
import org.bitcoinj.core.TransactionOutput;