As per the conversation started in #3383, I am submitting a feature proposal for bitcoind
.
The proposal is pretty straightforward (to describe, anyways): Implement an unspent transaction outputs index, and allow users to query it via the RPC API.
This is very similar in design to the txindex
. It would be disabled by default, and enabled via the config file with something like utxoindex=1
.
Then the user could query the daemon for all the unspent transactions available on any address at any time, on demand:
0getutxo [minconf=1] [maxconf=9999999] ["address",...]
And receive an array response of the utxo objects (perhaps with a few more niceties for people building wallets, such as the date the utxo was received):
0[
1 {
2 "txid" : "00003b2f320f9618162d209c67d2c29a812a8644f321093adc6b8f4a925f430e",
3 "vout" : 0,
4 "address" : "mhZFsQJddG5jGNEmwQgwzeKeiqVT2XgX84",
5 "scriptPubKey" : "2102224f4fd0ce5aeb19b7212218f6fdf86f6cd0cef870537294d277014bcc4bcf09ac",
6 "amount" : 50.00000000,
7 "confirmations" : 5332
8 }
9]
I have spent a lot of time promoting the adoption of the watchonly address patch, but I believe this would provide essentially the same resource that don’t-trust-the-server wallet developers need to implement. The transaction information can easily be stored in a ledger on the wallet developer’s end, and this complements the goal of separating bitcoind from the wallet code so that it can focus on its primary goal as a listener node that provides information to developers from the network.
I think this is potentially a very important feature to add. Right now, developers solve this by building their own custom blockchain parser, that duplicates (often poorly) a lot of the same business logic that’s already in bitcoind. It’s really slow to have to do this, it’s easy to screw things up, and it’s more stuff you need to install/manage.
With this functionality, developers could easily spawn a pool of bitcoind servers to request data and not have to worry about “priming” the daemons with the needed addresses to listen on. It also (relatively) increases privacy/security, because an attacker cannot use bitcoind to find which addresses are associated with it (sans a packet sniffer or something like that).