Commit graph

41 commits

Author SHA1 Message Date
Tomás Senart
9f4bfeb056 Throttle RPC and WS concurrent active clients
This change set implements tunable concurrent active clients throttling.
2014-07-03 13:12:37 -05:00
Tomás Senart
def3543ba6 goimports -w . 2014-07-03 13:45:40 +02:00
Josh Rickmar
d75a3fc4e7 Fix logdir config struct tag. 2014-06-20 08:29:54 -05:00
Josh Rickmar
ad72d3a400 Add basic transaction store logging.
The info log level (default) will produce output about confirmed and
unconfirmed transactions being inserted into the store, as well as
unconfirmed transactions which have been mined into blocks.  By
enabling the debug log level (-d TXST=debug), additional information
about transaction inputs and outputs is logged.  This includes the
total amount of previously-unspent outputs which have been marked
spent by the inserted transaction, and the output indexes and amounts
for each spendable output.  Additionally, the debug log level will log
whenever transactions are removed due to being a double spend of
another inserted transaction.
2014-06-19 18:16:13 -05:00
Josh Rickmar
12c50f9611 Fix typo. 2014-06-02 11:15:27 -05:00
Josh Rickmar
55564dc31f Fix simnet RPC port.
18555 is the network port, and wallet cannot listen on this port.
Instead, follow the pattern laid out by mainnet, testnet3, and regtest
by listening on 18554 (one less than the network port).
2014-05-29 16:32:30 -05:00
Josh Rickmar
6398dc098e Add support for the simulation test network. 2014-05-29 16:15:32 -05:00
Josh Rickmar
04338d31c9 Handle alternate data directories.
If the data directory is modified on the command line or from the
config file, all paths relative to the directory, if unmodified, must
be changed to reference it.
2014-05-28 12:55:37 -05:00
Josh Rickmar
c3224f4fbc Begin update to use btcnet.Params.
This is an intial pass at converting the btcwallet and deps codebases
to pass a network by their parameters, rather than by a magic number
to identify the network.  The parameters in params.go have been
updated to embed a *btcnet.Params, and all previous uses of cfg.Net()
have been replaced with activeNet.{Params,Net} (where activeNet is
the global var for the active network).

Although dependancy packages have not yet been updated from using
btcwire.BitcoinNet to btcnet.Params, the parameters are now accessible
at all callsites, and individual packages can be updated to use btcnet
without requiring updates in each external btc* package at once.

While here, the exported API for btcwallet internal library packages
(txstore and wallet) have been updated to pass full network parameters
rather than the btcwire definition of a network.
2014-05-22 21:24:08 -05:00
Josh Rickmar
461111cadf Allow alternative btcd RPC server auth.
This change adds the new btcdusername and btcdpassword options which,
if set, are used instead of the username and password when
authenticating to a btcd RPC server.  If these new options are unset,
the btcd user and password settings are shared with the client auth
settings.
2014-05-16 12:58:33 -05:00
Josh Rickmar
17ebf9461f Rename connect option to rpcconnect.
The connect option is already used by btcd to force a connection to
other full node peers.  Wallet does not talk directly with these
peers, so the connect option is being renamed to something unique for
an RPC client connection.
2014-05-06 13:25:56 -05:00
Josh Rickmar
361a74fcaf Rename listen option to rpclisten.
This matches the use of the rpclisten option in btcd to specify the
listening interfaces and ports for an RPC server.
2014-05-06 12:50:39 -05:00
Josh Rickmar
00403c7839 Use []Type{} instead of make([]Type, 0). 2014-04-11 13:58:04 -05:00
Josh Rickmar
0d903a5a29 Invert allowfree option.
Boolean options cannot be unset from a default true value on the
command line, so invert the allowfree option, renaming it
disallowfree, so attaching fees may always be forced by specifying
disallowfree = true in the configuration file, or --disallowfree on
the command line.
2014-01-28 12:55:42 -05:00
Josh Rickmar
845d54da55 Add allowfree configuration option.
It may be desirable to never allow free transactions, even if the
calculated priority is high enough that a fee would not be required,
so this change adds a global configuration option to remove this check
and always attach a fee.
2014-01-27 16:58:49 -05:00
Josh Rickmar
f0c649b7ac Make maximum keypool size a config option. 2014-01-15 17:29:01 -05:00
Josh Rickmar
ebcaa95b35 Use smarter btcd cert path logic.
If ~/.btcwallet/btcd.cert does not exist and the CA file has not been
explicitly set using the config file or command line flags, it's
possible that the cert can be found in ~/.btcd.  If connecting to a
localhost btcd and the previous statements are true, the default CA
file config option is updated for the certificate in them btcd
homedir.

If ~/.btcwallet/btcd.cert does exist and the CA file has not been set,
it is used without checking for a cert in the btcd homedir.
2014-01-10 11:39:03 -05:00
Josh Rickmar
a6e0f3bc2a Update copyright years on remaining files. 2014-01-09 14:13:26 -05:00
Josh Rickmar
42055d5b7c Fix sample listen address in config. 2014-01-09 10:51:33 -05:00
Josh Rickmar
5f1fb8b874 Enable --mainnet flag.
This change enables the --mainnet flag to connect to a mainnet btcd
instance and open and create mainnet wallets.  Attempting to connect
to a testnet btcd, or opening a testnet wallet when running in mainnet
mode will result in an error printed to the logging output.

Testnet (version 3) remains the default network for now.  btcwallet
will continue to receive fixes and new features, but at the moment we
believe that early adopters familar with using btcwallet on testnet
can safely use it for mainnet now as well.

Reminder: when dealing with mainnet coins, it is always a good idea to
keep backups of your wallet.  btcwallet uses a deterministic wallet,
and any later addresses for an account can be recreated with just the
account's original wallet file (this does *not* include imported
addresses).  Might we recommend Cyphertite for a backup solution?
2013-12-09 17:44:19 -05:00
Josh Rickmar
9be84e3489 Set connect option based on active net params. 2013-12-09 16:46:38 -05:00
Josh Rickmar
8669129917 Copy btcd RPC listening behavior.
This change copies the listening behavior of btcd by replacing the
--serverport option with --listen.  By default, btcwallet will only
listen for localhost connections, but with this change it will be
possible to add listeners for remote connections.

This was added due to finding a bug with updateConfigWithActiveParams.
After consulting the btcd source code, the bug was fixed by replacing
the function (as it was no longer needed) when the new listening code
was introduced.

While here, mask out the password flag from being shown in the help
message.
2013-12-05 17:25:36 -05:00
Josh Rickmar
ce23523ed7 Introduce new account file structure.
This changes the locations that account files (wallet.bin, utxo.bin,
and tx.bin) are searched for when opening or disk syncing accounts.
Previously, files were saved in the following layout:

  ~/.btcwallet/
    - btcwallet/
      - wallet.bin
      - tx.bin
      - utxo.bin
    - btcwallet-AccountA/
      - wallet.bin
      - tx.bin
      - utxo.bin

This format had two issues.  First, each account would require its own
directory, causing a scalability issue on unix (and perhaps other)
platforms.  Second, there was no distinction between testnet and
mainnet wallets, and if mainnet support was enabled, btcwallet would
attempt to open accounts with testnet wallets.

Instead, the following file structure is now used:

  ~/.btcwallet/
    - testnet/
      - wallet.bin
      - tx.bin
      - utxo.bin
      - AccountA-wallet.bin
      - AccountA-tx.bin
      - AccountA-utxo.bin

This solves both of the previously-mentioned issues by requiring only
two subdirectories (one each for the testnet and mainnet bitcoin
networks), and by separating the locations to open and save testnet
and mainnet account files.

At startup, a check for the old account file structure is performed.
If found, files are moved to the new locations, and the old account
directories are removed.  Account files are moved to the testnet
directory, as only testnet support is currently enabled.

The version has been bumped to 0.1.1 to reflect this change.

Fixes #16.
2013-12-04 20:25:13 -05:00
Josh Rickmar
eeb72db8b5 Change default CA file location.
This changes the default CA filename from 'cert.pem' to 'btcd.cert' to
reflect the fact that this cert is used for securely connecting to
btcd.  With the introduction of autogenerated btcwallet certs (saved
to rpc.cert and rpc.key) this change was made to better differentiate
the two cert files.

To upgrade across this change, simply move the btcd cert.  On unix,
use the command:

$ mv ~/.btcwallet/cert.pem ~/.btcwallet/btcd.cert
2013-12-03 11:00:26 -05:00
Josh Rickmar
3b04e3a4bc Use TLS+auth for frontend connections.
This change is mostly a copy paste job from the TLS listeners and
autogenerated cert code from btcd.
2013-12-03 10:52:09 -05:00
Josh Rickmar
e3e8a06661 Update for recent go-flags API changes. 2013-11-25 12:20:37 -05:00
David Hill
6558986cc5 Add --profile to enable live profiling 2013-11-21 11:35:40 -05:00
Josh Rickmar
5efbcecb53 Support UNIX ~ homedir expansion.
Patch from jolan, closes issue #17.
2013-11-21 10:02:27 -05:00
David Hill
89e3054bc5 socks5/tor proxy support 2013-11-19 20:54:48 -05:00
Josh Rickmar
5dbf69d23e Enable TLS support for btcd websocket connections.
This adds an additional config option, -cafile, to specify the root
certificates checked when verifying a btcd TLC connection.  btcd will
now automatically generate certs in
~/.btcd/data/{main,test}net/rpc.cert, and this file should be copied
to ~/.btcwallet/cert.pem.

The -btcdport option is also gone now, and replaced with -connect (or
-c), to specify both the hostname/ip and port of the server running
btcd.
2013-11-19 12:21:54 -05:00
Josh Rickmar
1ddd9c38dc Use btcutil.AppDataDir for data dir. 2013-11-12 15:25:56 -05:00
Josh Rickmar
91b4a5711c Fix logger formatting.
This change copies the behavior of btcd for using seelog for logging,
including making timestamps human readable, and setting the default
logging level to info.

Fixes #8.
2013-10-29 10:38:51 -04:00
Josh Rickmar
310dc010ac Choose correct ports for testnet and mainnet.
This copies the functionality of btcd for choosing the ports for the
HTTP client (for btcd) and server (for frontends).  On testnet, the
following ports are used as default:

 - btcd: 18334
 - frontends: 18332

When running with the (currently disabled) --mainnet flag, btcwallet
will choose the following ports by default:

 - btcd: 8334
 - frontends: 8332

Both ports can be overridden no matter the chosen network using the -b
and -p flags.
2013-10-16 17:29:48 -04:00
Josh Rickmar
a5c7079fdf Disable --mainnet flag (hardcoded false). 2013-10-15 16:06:13 -04:00
Josh Rickmar
ea9ce4e0b1 Default to testnet.
Use on mainnet is not recommended until extensive testing has been
done, and should be done at your own risk. Run btcwallet with
--mainnet to operate on main Bitcoin network.
2013-10-07 13:25:05 -04:00
Josh Rickmar
3c4ff4b0f4 Add support for running wallet on testnet3.
Websocket connections to btcd will be closed if btcd and btcwallet are
running on different networks.
2013-10-07 13:09:24 -04:00
Josh Rickmar
8e9e6f6229 Handle basic auth for dialing btcd websocket connections. 2013-10-03 09:11:35 -04:00
Josh Rickmar
63686347c6 Create transactions using saved utxo data.
This is a big change that also many general fixes to problems found
when creating transactions.  In particular the Utxo and Tx formats and
serialization functions were updated with additional information that
would be necessary for rolling back old utxo and tx data data after
btcd chain switches.  This change also implements the json methods
'sendfrom' and 'sendmany' to create a new transaction based on a
frontend request.

Transactions are currently not sent to btcd since the tx relay code is
not finished yet, so a temporary error is returned back to frontends
who try to send new transactions.
2013-10-01 14:26:27 -04:00
Josh Rickmar
9eae969230 Implement new wallet and chained address creation. 2013-09-03 00:10:32 -04:00
Josh Rickmar
50b69f44b7 Add missing licenses to files 2013-08-22 12:30:38 -04:00
Josh Rickmar
a56e4e89d2 Initial commit. 2013-08-21 10:37:30 -04:00