Today we are releasing btcwallet 0.6.0, along with a minor release to btcd (0.11.1) which is required to build the new btcwallet. This wallet release primarily focuses on adding account support, integrating transaction history in the new database, and making wallet an importable package for reuse in other binaries. As always, general fixes and improvements all around are included. See the release notes for the full details.
Accounts
btcwallet takes a different approach to accounts compared to Bitcoin Core wallet, and it’s important to understand why this is done and how it affects usage. In Bitcoin Core, account balances and the addresses used to receive outputs are separate concepts, and balances can be moved across accounts without an on-chain transaction. While this model certainly has its uses, we feel that it comes with disadvantageous privacy implications as well, since outputs received by an address of one account can be spent when debiting a balance from an unrelated account.
In contrast, every generated btcwallet address belongs to some BIP0032 HD path. Each account is assigned its own account branch (at the path m/44'/<coin type>'/<account>') from which external (receiving) and internal (change) addresses are created. Transaction outputs paying to these addresses are grouped to the account the address belongs to, and the total sums of these output amounts create the account balance. There is therefore a one-to-one relationship between which address was used to receive an output and the account’s balance. Moving a balance from one account to another requires creating and broadcasting a new on-chain transaction. You can think of btcwallet accounts as more of a “sub-wallet”. Similar behavior can be modeled using many Bitcoin Core wallets.
Because account support is so different than Core’s, this is one area where we can not remain API compatible. At the moment, there are several places in the JSON-RPC API where accounts are either missing or unset in results. Consult the request documentation using the new help RPC for specific details about where account fields may differ. A newer RPC API is currently being developed which will, among other improvements, allow for btcwallet-style accounts by making a clean break from what existing Bitcoin Core clients may expect.
It’s also important to note that per-account output tagging can be added in a later btcwallet release to regain much of the same flexibility that Bitcoin Core accounts currently provide. If you are currently depending on Core’s accounts in this way, similar behavior is not impossible for btcwallet, but it will require interfacing using a different API.
Upcoming changes
Preliminary work has started on a new RPC API and server. We are currently experimenting with grpc for the RPC implementation. grpc can be used from many languages, including those commonly used for developing native graphical applications (C++, C#, and Obj-C), so it’s expected that this API will be used for both official (btcsuite) and 3rd party Windows and OS X clients. See the Github issue for more details.
The peer code in btcd is also currently being refactored in to an importable package. This is important for btcwallet, as it will be used to eventually implement an SPV mode. Subscribe to the SPV and peer refactor issues for updates!