btcsuite / btcwallet Goto Github PK
View Code? Open in Web Editor NEWA secure bitcoin wallet daemon written in Go (golang)
License: ISC License
A secure bitcoin wallet daemon written in Go (golang)
License: ISC License
btcwallet should respond to the importprivkey command before initiating a rescan request to btcd. this would stop the client, such as btcctl, from waiting for rescan to finish.
On initial startup (with a new, empty wallet), btcwallet gives the following errors:
10:41:48 2014-01-08 [ERR] BTCW: cannot open tx file: open /home/john/.btcwallet/mainnet/tx.bin: no such file or directory
10:41:48 2014-01-08 [ERR] BTCW: cannot open utxo file: open /home/john/.btcwallet/mainnet/utxo.bin: no such file or directory
Those files should not be there initially, so rather than an error, btcwallet should just write the empty files.
Installed btcd and btcwallet according to the instuctions. Trying to run btcwallet
results in:
18:38:14 2013-11-20 [ERR] BTCW: cannot open wallet: wallet file does not exist
18:38:14 2013-11-20 [ERR] BTCW: cannot open CA file: open /Users/alexanderhanhikoski/Library/Application Support/Btcwallet/cert.pem: no such file or directory
/Library/Application Support/Btcwallet/btcwallet/
is empty. Is btcwallet failing to create a default empty wallet or should this be done explicitly by the user? How?
implement dumpwallet
implement getunconfirmedbalance which does what it says.
The standard RPC call for importing private keys, importprivkey, has a number of issues. Namely:
An extension RPC command should be added which resolves these issues.
implement listlockunspent
Fired {"id":"createencryptedwallet", "method":"createencryptedwallet", "params": ["testwallet", "bananas", "testpassphrase"] }
, but btcwallet keeps giving the following output:
[ERR] BTCW: cannot sync dirty wallet: open /Users/alexanderhanhikoski/Library/Application Support/Btcwallet/btcwallet-testwallet/wallet.bin-1384986032: no such file or directory
Once I created btcwallet-testwallet
directory, it was able to sync.
writeDirtyToDisk is extremely slow. Look at improving the performance.
implement getrawchangeaddress
Before:
$ btcwallet --cafile=~/.btcd/rpc.cert -d=debug
08:25:43 2013-11-21 [ERR] BTCW: cannot open CA file: open ~/.btcd/rpc.cert: no such file or directory
After:
$ ./btcwallet --cafile=~/.btcd/rpc.cert
08:26:01 2013-11-21 [INF] BTCW: RPCS: RPC server listening on 127.0.0.1:18332
08:26:01 2013-11-21 [INF] BTCW: RPCS: RPC server listening on [::1]:18332
08:26:02 2013-11-21 [INF] BTCW: Established connection to btcd.
The sendmany RPC command is great because it is flexible enough to create a single tx with multiple outputs, however the resulting tx may include a greater fee than the user is willing to pay. An extension RPC command should be added which takes the same parameters as the sendmany command, but instead of sending the raw tx to btcd to relay to the network, the rawtx and included fee should be returned to the caller. This will allow a frontend to present a user with a message of whether the included fee is acceptable or not, and if so, the returned raw tx may be sent.
Currently, change addresses do not receive any notifications of transactions sent to them, causing the change UTXO to never move from unconfirmed to the confirmed balance.
implement getreceivedbyaddress
using btcgui to connect to a new btcwallet, it correctly prompts for a passphrase to create a new wallet.
However, if you kill btcgui and reconnect before doing so, it doesn't prompt again until you restart btcwallet.
implement gettxout
Myself and others have been able to reproduce an issue where wallet funds are not correctly received and a manual rescan has to be performed.
This needs to be fixed before next release.
I know we are very early into the development and I apologize if this premature.
btcwallet creates a new wallet for each account into a new directory. The number of sub-directories is limited in *nix file systems (seems like under 50k). Quite a few services have over 50k accounts, so it's not very difficult to hit this limit.
Am I thinking about this the wrong way and is it advisable simply to use a single account/wallet for everything and handle accounts in the application layer?
implement listaddressgroupings
support import private key
Currently the registered notifications only support pay-to-pubkey-hash. Support for detecting pay-to-script-hash still needs to be added.
implement backupwallet
support dumpprivkey for paper backups and importing into bitcoind if need be.
add support for addmultisigaddress
In the case where a frontend must know details of transactions to or from either a single or group of addresses, rather than caring about details for all addresses in a wallet, with the standard API it must use a listtransactions request and filter out transactions that don't matter to it. An extension request should be added to handle this case. The extension should be generic enough to query btcwallet for all or a range of transactions to or from one or more addresses. Write an extension request which meets these requirements
We have had a few requests for miner support. Please add support for getblocktemplate.
btcwallet doesn't make it obvious which network it is running on. bitcoin-qt shows [testnet] in the title bar and uses a different color icon. It would be good if btcgui also did some really obvious things to make this clear.
implement keypoolrefill
We have had a few requests for miner support. Please add support for getwork.
Logging output does not currently match btcd, causing issues with timestamps not being printed in a human readable format, and debugging output being printed when info should be the default level.
This code can be mostly copied as is from btcd.
In wallet.go is this comment:
// This is a perfect example of YOLO crypto. Armory claims this XORing
// with the SHA256 hash of the pubkey is done to add extra entropy (why
// you'd want to add entropy to a deterministic function, I don't know),
// even though the pubkey is generated directly from the privkey. In
// terms of security or privacy, this is a complete waste of CPU cycles,
// but we do the same because we want to keep compatibility with
// Armory's chained address generation.
I think without the entropy you would be able to look at public keys on the blockchain and calculate the next deterministic public key, thus allows anyone to figure out that a chain of addresses (as long as they were used at least once, thereby revealing the public keys) belong to the same wallet. This is a privacy concern.
currently the port but not the host can be configured
I understand this will get looked at after the tls bits are in place to secure connections to other hosts
implement importwallet
GetReceivedByAddressCmd would be very helpful in wallet (I know all the standard commands will eventually be implemented, but I'd vote for this being one of the next ones to go in).
Currently, and funds sent to a btcwallet addresses while wallet is not connected to a running btcd instance will miss the notification as the new block is processed. Rescanning must be used to catch up to a more recent btcd and save unspent transaction outputs from missed block notifications.
These are a couple things that must be done in btcwallet first before a proper rescan is implemented. Each address saved in the wallet has fields for when it was first created and last used. Additionally, btcwallet must save the last seen block to disk, so on a later open, all rescanning before that block can be avoided.
This change can also hugely benefit from btcd keeping a seperate store of all UTXOs at the current block height. If so, this smaller data set (bitcoind uses similar, and is currently ~200-300MB total) can be checked for any unspent transactions outputs to a btcwallet address, instead of querying the database for each transaction in each block that was missed. Before a proper redesign of rescan is implemented, this btcd design should be debated and used if chosen.
implement getreceivedbyaccount
implement gettransaction
add an api to backup the wallet.
Currently, newly-requested addresses (such as through a getnewaddress request) and addresses created for transaction change do not appear immediately in frontends. Make this a notification so all frontends are aware of any new addresses.
All standard rpc calls need a handler, even if all it does is reply back with "this is currently unimplemented". Otherwise, unrecognized commands will be passed to btcd and btcd will respond with "please ask wallet", which wallet will return to the caller.
After launching btcdsuite, the following error messages appear in the btcws console window on Win7x64:
02:33:28 2013-12-05 [ERR] BTCW: cannot open utxo file: open C:\Users\L\
AppData\Roaming\btcwallet\btcwallet\utxo.bin: The system cannot find the file sp
ecified.
02:33:29 2013-12-05 [INF] BTCW: Established connection to btcd.
02:33:37 2013-12-05 [ERR] BTCW: cannot sync dirty wallet: rename C:\Users\Lr\AppData\Roaming\btcwallet\btcwallet\wallet.bin-1386232417 C:\Users\L\AppData\Roaming\btcwallet\btcwallet\wallet.bin: Cannot create a file when tha
t file already exists.
02:33:48 2013-12-05 [ERR] BTCW: cannot sync dirty wallet: rename C:\Users\L\AppData\Roaming\btcwallet\btcwallet\wallet.bin-1386232428 C:\Users\L\AppData\Roaming\btcwallet\btcwallet\wallet.bin: Cannot create a file when tha
t file already exists.
02:33:58 2013-12-05 [ERR] BTCW: cannot sync dirty wallet: rename C:\Users\L\AppData\Roaming\btcwallet\btcwallet\wallet.bin-1386232438 C:\Users\L\AppData\Roaming\btcwallet\btcwallet\wallet.bin: Cannot create a file when tha
t file already exists.
02:34:08 2013-12-05 [ERR] BTCW: cannot sync dirty wallet: rename C:\Users\L\AppData\Roaming\btcwallet\btcwallet\wallet.bin-1386232448 C:\Users\L\AppData\Roaming\btcwallet\btcwallet\wallet.bin: Cannot create a file when tha
t file already exists.
And continues to appear until the program is terminated.
implement gettxoutsetinfo
implement createmultisig
importprivkey doesn't reject duplicates, so btcwallet could have multiple entries for the same address.
Currently, the account type relies on sync.Mutex for correct concurrent access to the wallet, utxo, and tx structures. This should be changed to use a Go channel to serialize requests to access and modify the structures.
Currently, if the unused addresses in the initial keypool created with the wallet are all used up, the keypool is not refilled, and no new addresses are created.
It would be nice to have multiple btcd server support for, at minimum, failover. You would need to specify multiple connection properties for each server, (ip, port, user, pass, certificate). Upon disconnect, btcwallet would cycle through the list of servers until it has connected again.
Currently, when you connect to btcwallet with a websocket as a frontend, it sends the info btcgui wants (account info) and then keeps sending blockheight as that changes. It would be nice if the frontend actually had some say in the info it recieved rather than always being spammed with things it did not ask for.
Currently the registered notifications only support pay-to-pubkey-hash. Support for detecting compressed and uncompressed keys still needs to be added.
just a placeholder to state interest in this feature above the rest of the missing rpc's as discussed on irc
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.