A secure lbry wallet daemon written in Go
Find a file
Josh Rickmar c97e0d5fc6 Detect reorgs after btcd disconnect/reconnect.
This change saves (at most) the last 20 block hashes to disk.  Upon
btcd connect, in the handshake, btcwallet checks whether btcd's best
chain still contains these blocks, starting from the most recently
added block and continuing until the earliest saved.  If any blocks
are missing, Tx history and UTXOs from any blocks no longer in the
chain are removed, and a rescan is started from after the best block
still in the main chain.

If all previous block hashes are exhausted (either due to a large
reorg, or because not enough blocks have been seen), a full rescan is
triggered (full meaning from the earliest block that matters to this
wallet) since the last synced up to point is no longer available.

The previous 20 seen block hashes are saved to the wallet file, which
required bumping the file version.  Older wallets written with lesser
versions will use the previous reading function, making this change
backwards compatible.
2013-12-09 15:19:20 -05:00
tx Send number of bitcoins, not satoshis, with listtransactions reply. 2013-11-27 13:55:14 -05:00
wallet Detect reorgs after btcd disconnect/reconnect. 2013-12-09 15:19:20 -05:00
.gitignore Initial commit. 2013-08-21 10:37:30 -04:00
.travis.yml TravisCI support 2013-12-08 22:15:16 -05:00
account.go Detect reorgs after btcd disconnect/reconnect. 2013-12-09 15:19:20 -05:00
accountstore.go Detect reorgs after btcd disconnect/reconnect. 2013-12-09 15:19:20 -05:00
CHANGES Prepare for release 0.1.0. 2013-11-13 14:08:35 -05:00
cmd.go Copy btcd RPC listening behavior. 2013-12-05 17:25:36 -05:00
cmdmgr.go Calculate the minimum tx fee when creating transactions. 2013-12-04 12:13:40 -05:00
config.go Copy btcd RPC listening behavior. 2013-12-05 17:25:36 -05:00
createtx.go Calculate the minimum tx fee when creating transactions. 2013-12-04 12:13:40 -05:00
createtx_test.go Calculate the minimum tx fee when creating transactions. 2013-12-04 12:13:40 -05:00
deps.txt Prepare for release 0.1.0. 2013-11-13 14:08:35 -05:00
disksync.go Remove some TODOs that have been finished. 2013-12-06 09:19:00 -05:00
log.go Remove unused const. 2013-10-29 11:02:30 -04:00
params.go Enable TLS support for btcd websocket connections. 2013-11-19 12:21:54 -05:00
README.md TravisCI support 2013-12-08 22:15:16 -05:00
rename_plan9.go Add atomic rename functions for Windows and Plan 9. 2013-12-05 14:06:51 -05:00
rename_unix.go Fix formatting. 2013-12-05 14:12:56 -05:00
rename_windows.go Add atomic rename functions for Windows and Plan 9. 2013-12-05 14:06:51 -05:00
sample-btcwallet.conf Copy btcd RPC listening behavior. 2013-12-05 17:25:36 -05:00
sockets.go Detect reorgs after btcd disconnect/reconnect. 2013-12-09 15:19:20 -05:00
updates.go Add atomic rename functions for Windows and Plan 9. 2013-12-05 14:06:51 -05:00
version.go Introduce new account file structure. 2013-12-04 20:25:13 -05:00

btcwallet

[Build Status] (https://travis-ci.org/conformal/btcwallet)

btcwallet is a daemon handling bitcoin wallet functions. It relies on a running btcd instance for asynchronous blockchain queries and notifications over websockets.

Full btcd installation instructions can be found here.

btcwallet runs as a daemon and provides no user interface for a wallet. A btcwallet frontend, such as btcgui, is required to use btcwallet.

In addition to the HTTP server run by btcd to provide HTTP and websocket RPC, btcwallet requires an HTTP server of its own to provide websocket connections to wallet frontends. Websockets allow for asynchronous queries, replies, and notifications between btcd and btcwallet, as well as between btcwallet and any number of frontends.

This project is currently under active development is not production ready yet. Because of this, support for using the main Bitcoin netowrk is currently disabled, and testnet must be used instead.

Installation

Windows - MSI Available

Install the btcd suite MSI here:

https://opensource.conformal.com/packages/windows/btcdsuite/

Linux/BSD/POSIX - Build from Source

  • Install Go according to the installation instructions here: http://golang.org/doc/install

  • Run the following commands to obtain btcwallet, all dependencies, and install it:

$ go get -u -v github.com/conformal/btcd/...
$ go get -u -v github.com/conformal/btcwallet/...
  • btcd and btcwallet will now be installed in either $GOROOT/bin or $GOPATH/bin depending on your configuration. If you did not already add to your system path during the installation, we recommend you do so now.

Updating

Windows

Install a newer btcd suite MSI here:

https://opensource.conformal.com/packages/windows/btcdsuite/

Linux/BSD/POSIX - Build from Source

  • Run the following commands to update btcwallet, all dependencies, and install it:
$ go get -u -v github.com/conformal/btcd/...
$ go get -u -v github.com/conformal/btcwallet/...

Getting Started

Windows (Installed from MSI)

Open Btcd Suite from the Btcd Suite menu in the Start Menu. This will also open btcgui, which can be closed if you only want btcd and btcwallet running.

Linux/BSD/POSIX/Source

  • Run the following command to start btcd:
$ btcd --testnet -u rpcuser -P rpcpass
  • Copy btcd's autogenerated rpc.cert to ~/.btcwallet/ so btcwallet can securely communicate with btcd over a TLS-encrypted websocket. This step is only necessary for the first time starting btcwallet or if btcd's autogenerated cert and key are removed and regenerated.
$ mkdir ~/.btcwallet/
$ cp ~/.btcd/rpc.cert ~/.btcwallet/btcd.cert
  • Run the following command to start btcwallet:
$ btcwallet -u rpcuser -P rpcpass

Frontend Usage

Frontends wishing to use btcwallet must connect to the websocket /frontend. Messages sent to btcwallet over this websocket are expected to follow the standard Bitcoin JSON API and replies follow the same API. The btcd package btcjson provides types and functions for creating messages that this API. However, due to taking a synchronous protocol like HTTP and using it asynchronously with websockets, it is recommend for frontends to use the JSON id field as a sequence number so replies can be mapped back to the messages they originated from.

TODO

  • Documentation (specifically the websocket API additions)
  • Code cleanup
  • Optimize
  • Much much more. Stay tuned.

GPG Verification Key

All official release tags are signed by Conformal so users can ensure the code has not been tampered with and is coming from Conformal. To verify the signature perform the following:

  • Download the public key from the Conformal website at https://opensource.conformal.com/GIT-GPG-KEY-conformal.txt

  • Import the public key into your GPG keyring:

    gpg --import GIT-GPG-KEY-conformal.txt
    
  • Verify the release tag with the following command where TAG_NAME is a placeholder for the specific tag:

    git tag -v TAG_NAME
    

License

btcwallet is licensed under the liberal ISC License.