Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: jon_smark on October 15, 2012, 05:37:43 PM



Title: Determining the account associated with a given txid+vout
Post by: jon_smark on October 15, 2012, 05:37:43 PM
Calling listunspent gives me a list of {txid,vout,spk,amount,conf}.  I also want to determine the account associated with each item in that list.  This can be done in two steps: 1) calling getrawtransaction txid will get me the address associated with a txid+vout combination; 2) calling getaccount addr will finally get me the associated account.

This works, but is awfully convoluted.  Is there a more straightforward way?  I thought about calling gettransaction txid, which does provide account information associated with each "receive" address, but I'm not sure whether I can rely on the array order being exactly the same as the original vout.


Title: Re: Determining the account associated with a given txid+vout
Post by: kjj on October 16, 2012, 01:04:25 PM
Why do you want to know?


Title: Re: Determining the account associated with a given txid+vout
Post by: jon_smark on October 17, 2012, 01:14:39 PM
Why do you want to know?

Because I want to forward unspent transactions to a cold-wallet, and knowing the account would let me know immediately which cold-wallet to use.  Though I can derive this information by going through my databases, if Bitcoin were to tell me the associated account that would save me the costly database access...


Title: Re: Determining the account associated with a given txid+vout
Post by: kjj on October 17, 2012, 06:33:34 PM
The database is going to be your best bet.

Also, you might want to consider using the cold wallet to protect the hot wallet, not to protect individual accounts.


Title: Re: Determining the account associated with a given txid+vout
Post by: jon_smark on October 17, 2012, 08:47:43 PM
The database is going to be your best bet.

Way too expensive.  I reckon my original plan might be the cheapest option yet, even if convoluted.

Also, you might want to consider using the cold wallet to protect the hot wallet, not to protect individual accounts.

I may be missing what you intended to say, but the cold wallet is used to protect the hot wallet, which happens to have several accounts.  Note that these accounts are not associated with external users; they all belong to me, and are just separate for administrative/accounting purposes.


Title: Re: Determining the account associated with a given txid+vout
Post by: kjj on October 18, 2012, 04:37:47 AM
The database is going to be your best bet.

Way too expensive.  I reckon my original plan might be the cheapest option yet, even if convoluted.

Also, you might want to consider using the cold wallet to protect the hot wallet, not to protect individual accounts.

I may be missing what you intended to say, but the cold wallet is used to protect the hot wallet, which happens to have several accounts.  Note that these accounts are not associated with external users; they all belong to me, and are just separate for administrative/accounting purposes.

I can't imagine any possible database where a single query is going to be more expensive than a RPC call to bitcoind.

Change your administrative plan.  :)  What you are trying to do isn't worth it.  Set your policies based on the wallets, not the accounts.