<p>If you used some python scripts to generate a new wallet file and want to use it with bitcoind or bitcoin-qt, you will probably need to rescan the whole blockchain via running <code>bitcoind -rescan</code> (it may take much time).</p>

<p>After that you can use <code>bitcoind listaccounts</code> to get balances of all your accounts (or <code>bitcoind getbalance</code> to get the total amount).</p>

<p>Not sure if it answers your question though, since not sure what you mean under 'account' and 'CWallet'.</p>

CC BY-SA 3.0
2013-04-22T21:23:59.883Z
2013-04-22T21:23:59.883Z
arsenische
<p>I'm attempting to clarify a few things in my mind. The wallet.dat file contains (amongst other things) my transaction history alongside the private keys associated with each address in use in the wallet. </p>

<p>Let's say I'm one of those open source weirdos and I use PyWallet to open the wallet.dat and pull the private keys and addresses out of my wallet. Now say my goal is to create a new wallet (called it Cwallet). Now CWallet can sign transactions for my bitcoins from bitcoin-qt, but how would it actually get an account balance?</p>

<p>Does CWallet have to search through the entire blockchain and find my address and then follow it to the most current block? Or is there an optimized way of determining the balance?</p>

<wallet><bitcoin-core>
Account Balance and Bitcoin-QT
Charles Hoskinson
# Account Balance and Bitcoin-QT

(Asked by: username_0 on 2013-04-22)

I'm attempting to clarify a few things in my mind. The wallet.dat file contains (amongst other things) my transaction history alongside the private keys associated with each address in use in the wallet.

Let's say I'm one of those open source weirdos and I use PyWallet to open the wallet.dat and pull the private keys and addresses out of my wallet. Now say my goal is to create a new wallet (called it Cwallet). Now CWallet can sign transactions for my bitcoins from bitcoin-qt, but how would it actually get an account balance?

Does CWallet have to search through the entire blockchain and find my address and then follow it to the most current block? Or is there an optimized way of determining the balance?

**Tags:** wallet, bitcoin-core


---

## 1 answers

### Answer by username_1 on 2013-04-22. Score: 1

If you used some python scripts to generate a new wallet file and want to use it with bitcoind or bitcoin-qt, you will probably need to rescan the whole blockchain via running `bitcoind -rescan` (it may take much time).

After that you can use `bitcoind listaccounts` to get balances of all your accounts (or `bitcoind getbalance` to get the total amount).

Not sure if it answers your question though, since not sure what you mean under 'account' and 'CWallet'.


---

