/*
- Copyright 2011 Google Inc.
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*/
package org.bitcoinj.examples;
import java.io.File;
import org.bitcoinj.wallet.Wallet;
/**
- DumpWallet loads a serialized wallet and prints information about what it contains.
*/
public class DumpWallet {
public static void main(String[] args) throws Exception {
// if (args.length != 1) {
// System.out.println("Usage: java DumpWallet <filename>");
// return;
// }
// Wallet wallet = Wallet.loadFromFile(new File(args[0]));
Wallet wallet = Wallet.loadFromFile(new File("test.wallet"));
System.out.println(wallet.toString());
}
}
问题 https://bitcoin.stackexchange.com/questions/72010/bitcoinj-unable-to-load-wallet
以上的坑,在1-1中解决。
执行Main函数的显示的钱包内容结果如下:
Wallet
Balances:
0.00 BTC ESTIMATED
0.00 BTC AVAILABLE
0.00 BTC ESTIMATED_SPENDABLE
0.00 BTC AVAILABLE_SPENDABLE
Transactions:
0 pending
0 unspent
0 spent
0 dead
Last seen best block: -1 (time unknown): null
Keys:
Earliest creation time: 2019-07-03T15:55:57Z
Seed birthday: 1562169357 [2019-07-03T15:55:57Z]
Ouput script type: P2PKH
Key to watch: tpubDA3BwiN8mouY7WvSHZPdUwGYnvdTeuysG3DBuqBKCq3fTVaigtcPYaekpb1nbtFj4bKKnLZVVd3GfGFXUhBzVqU7Am5afcpixjw6iRidayC
Lookahead siz/thr: 100/33
addr:n3ZE8cynFMRNiLiGMcFzLyYQE354RwBdod hash160:f1c0d1cce256e4c96cd16b9318a0b69680b28105 (M, root)
addr:mpKnCqnrfLUZiZXfeYSBoX8pqMGtjaERYx hash160:609c224614124cc2d8635796d1aa0d431e4449c5 (M/0H, account)
addr:n2sR5J6hebKoXjCQyiLHEJ5XuuNCfN9dnt hash160:ea3950c6fc324976e3326c80c8ee0e202e585fbc (M/0H/0, external)
addr:mfqUVq6YkA17zNfRfTQey8fjaRtM7ANV63 hash160:0380b314cd3b50ad6110d0f7d395d2fdc2bf3c6e (M/0H/1, internal)