Skip to content

Commit 8b6897a

Browse files
committed
Add application plugin to tools subproject
* Enable and configure Gradle application plugin * Add wallet_tool instructions in project README
1 parent 73fe6a1 commit 8b6897a

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,38 @@ gradle clean assemble
3737

3838
Alternatively, just import the project using your IDE. [IntelliJ](http://www.jetbrains.com/idea/download/) has Gradle integration built-in and has a free Community Edition. Simply use `File | New | Project from Existing Sources` and locate the `build.gradle` in the root of the cloned project source tree.
3939

40+
### Building and Using the Wallet Tool
41+
42+
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**.
43+
44+
To build an executable shell script that runs the command-line Wallet Tool, use:
45+
```
46+
gradle bitcoinj-tools:installDist
47+
```
48+
49+
You can now run the `wallet_tool` without parameters to get help on its operation:
50+
```
51+
./tools/build/install/wallet_tool/bin/wallet_tool
52+
```
53+
54+
To create a test net wallet file in `~/bitcoinj/bitcoinj-test.wallet`, you would use:
55+
```
56+
mkdir ~/bitcoinj
57+
./tools/build/install/wallet_tool/bin/wallet_tool --net=TEST --wallet=$HOME/bitcoinj/bitcoinj-test.wallet create
58+
```
59+
60+
To sync the newly created wallet in `~/bitcoinj/bitcoinj-test.wallet` with the test net, you would use:
61+
```
62+
./tools/build/install/wallet_tool/bin/wallet_tool --net=TEST --wallet=$HOME/bitcoinj/bitcoinj-test.wallet sync
63+
```
64+
65+
To dump the state of the wallet in `~/bitcoinj/bitcoinj-test.wallet` with the test net, you would use:
66+
```
67+
./tools/build/install/wallet_tool/bin/wallet_tool --net=TEST --wallet=$HOME/bitcoinj/bitcoinj-test.wallet dump
68+
```
69+
70+
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.
71+
4072
### Example applications
4173

4274
These are found in the `examples` module.

tools/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
id 'java'
3+
id 'application'
34
id 'eclipse'
45
}
56

@@ -17,7 +18,8 @@ compileJava.options.encoding = 'UTF-8'
1718
compileTestJava.options.encoding = 'UTF-8'
1819
javadoc.options.encoding = 'UTF-8'
1920

20-
def mainClassName = "org.bitcoinj.tools.WalletTool"
21+
mainClassName = "org.bitcoinj.tools.WalletTool"
22+
applicationName = "wallet_tool"
2123
ext.moduleName = 'org.bitcoinj.tools'
2224

2325
jar {

0 commit comments

Comments
 (0)