<p>There is no way to export all of the transactions to a csv. However you can get the transaction in JSON using the <code>listtransactions</code> RPC.</p>
<p>Bitcoin Core will always rescan when a wallet is loaded because it must be sure that it has seen all of the wallet's transactions so that the user does not appear to have lost any funds. For old wallets, it ends up having to rescan a significant portion of the blockchain. There is no way to disable this behavior.</p>
<p>However, if you are sure that no rescan is necessary, it is possible to force Bitcoin Core to not have any blockchain data so that the rescan completes quickly and does not do anything. You can do this by removing all blockchain data from the datadir and starting Bitcoin Core with <code>-connect=0</code>. This will force Bitcoin Core to not connect to the network so it will not be able to download the blockchain. Additionally, because you have removed any previous blockchain data, Bitcoin Core will be reset to the genesis block as the only block in the blockchain. Loading a wallet at this point will result in no rescan.</p>
<p>Lastly, to speed things up, instead of constantly stopping and starting Bitcoin Core to load new wallets, you can use the <code>loadwallet</code> RPC to load a wallet, and <code>unloadwallet</code> to unload the wallet when you are done with it.</p>
<p>Some python-like pseudocode that shows what this would look like:</p>
<pre><code>for wallet in wallets:
    rpc.loadwallet(wallet)
    print(rpc.listtransactions())
    rpc.unloadwallet(wallet)
</code></pre>

CC BY-SA 4.0
2021-10-07T15:58:38.243Z
2021-10-07T15:58:38.243Z
Ava Chow
<p>I have a ton of old backed up <code>wallet.dat</code> files with zero BTC in them, but (probably) the records of my old Bitcoin transactions in them, which I'm trying to extract as CSV data.</p>
<p>I already looked at the command line options and found no instance of &quot;extract&quot; or &quot;CSV&quot;, but is there some way to do something simple on the command line such as:</p>
<pre><code>bitcoincore.exe --extract-csv-transactions-from-wallet=wallet1.dat -o wallet1.csv
bitcoincore.exe --extract-csv-transactions-from-wallet=wallet2.dat -o wallet2.csv
bitcoincore.exe --extract-csv-transactions-from-wallet=wallet3.dat -o wallet3.csv
...
</code></pre>
<p>?</p>
<p>My current method of manually loading four of them in at a time, manually adding them to the config file and starting Bitcoin Core, is a nightmare. It has been saying &quot;Rescanning&quot; for an hour now with no sign of it ever stopping and that's just for the first batch of four wallets... out of tons.</p>
<p>This is going to be a multi-weeker nightmare project, isn't it?</p>

CC BY-SA 4.0
2021-10-06T10:00:00.563Z
I would instead look at other utilities or libraries such as btcutils or pywallet.
RedGrittyBrick
CC BY-SA 4.0
2021-10-06T10:02:15.113Z
Does this answer your question? [Dumping private keys from wallet.dat from command line (pywallet.py alternatives)](https://bitcoin.stackexchange.com/questions/9127/dumping-private-keys-from-wallet-dat-from-command-line-pywallet-py-alternatives) (note the answers cover dumping all wallet data, not just keys)
RedGrittyBrick
CC BY-SA 4.0
2021-10-06T10:03:25.810Z
@RedGrittyBrick I don't trust anything but Bitcoin Core. And I'm not trying to dump any private keys.
Matoshi Sakabloto
CC BY-SA 4.0
2021-10-06T10:08:55.037Z
Why does it have to "Rescan"? Can't this be skipped?
Matoshi Sakabloto
CC BY-SA 4.0
2021-10-06T10:15:08.803Z
From [elsewhere](https://github.com/bitcoin/bitcoin/issues/6514): *'The wallet file stores up to which block it has "seen" the chain. At
startup, an automatic rescan happens for exactly the missing part.'*  I guess this is because the prime purpose of Bitcoin core is to function as a wallet, not to export CSV data from multiple wallet.dat files. It is presumably optimised for the former task, not the latter.
RedGrittyBrick
CC BY-SA 4.0
2021-10-06T18:41:37.603Z
You can load wallets without restarting Bitcoin Core by using the `loadwallet` and `unloadwallet` RPCs. You can use the `listtransactions` RPC to get all of the transactions in JSON form and convert that into whatever format you want.
Ava Chow
CC BY-SA 4.0
2021-10-06T18:43:35.380Z
Rescan is required in order for the wallets to have gotten any transactions that were made during the time the wallet was offline. A workaround to avoid that is to remove all blockchain data and then start Bitcoin Core with `-connect=0`. This will force it to not make any network connections so that it doesn't sync the blockchain, and hence any loaded wallets will not have anything to rescan. However this may miss some transactions, and some functionality may be disabled as it will not be synced.
Ava Chow
CC BY-SA 4.0
2021-10-09T00:52:38.317Z
Some reviewers supposed that this is a duplicate of a question about getting the private keys, but that is not the asker's goal.  @AndrewChow provided good and helpful answers which the asker could work into a helpful answer to his own question.  I vote to keep it open in the hope that one of them will do that.
Dave Scotese
<bitcoin-core>
Is there some way to use Bitcoin Core to "batch-extract" CSV data from a bunch of wallet.dats?
Matoshi Sakabloto
# Is there some way to use Bitcoin Core to "batch-extract" CSV data from a bunch of wallet.dats?

(Asked by: username_0 on 2021-10-06)

I have a ton of old backed up `wallet.dat` files with zero BTC in them, but (probably) the records of my old Bitcoin transactions in them, which I'm trying to extract as CSV data.

I already looked at the command line options and found no instance of "extract" or "CSV", but is there some way to do something simple on the command line such as:

```
bitcoincore.exe --extract-csv-transactions-from-wallet=wallet1.dat -o wallet1.csv
bitcoincore.exe --extract-csv-transactions-from-wallet=wallet2.dat -o wallet2.csv
bitcoincore.exe --extract-csv-transactions-from-wallet=wallet3.dat -o wallet3.csv
...

```

?

My current method of manually loading four of them in at a time, manually adding them to the config file and starting Bitcoin Core, is a nightmare. It has been saying "Rescanning" for an hour now with no sign of it ever stopping and that's just for the first batch of four wallets... out of tons.

This is going to be a multi-weeker nightmare project, isn't it?

**Tags:** bitcoin-core

> **Comments:**
> **username_1**: I would instead look at other utilities or libraries such as btcutils or pywallet.  
> **username_1**: Does this answer your question? [Dumping private keys from wallet.dat from command line (pywallet.py alternatives)](https://bitcoin.stackexchange.com/questions/9127/dumping-private-keys-from-wallet-dat-from-command-line-pywallet-py-alternatives) (note the answers cover dumping all wallet data, not just keys)  
> **username_0**: @username_1 I don't trust anything but Bitcoin Core. And I'm not trying to dump any private keys.  
> **username_0**: Why does it have to "Rescan"? Can't this be skipped?  
> **username_1**: From [elsewhere](https://github.com/bitcoin/bitcoin/issues/6514): *'The wallet file stores up to which block it has "seen" the chain. At startup, an automatic rescan happens for exactly the missing part.'*  I guess this is because the prime purpose of Bitcoin core is to function as a wallet, not to export CSV data from multiple wallet.dat files. It is presumably optimised for the former task, not the latter.  
> **username_2**: You can load wallets without restarting Bitcoin Core by using the `loadwallet` and `unloadwallet` RPCs. You can use the `listtransactions` RPC to get all of the transactions in JSON form and convert that into whatever format you want.  
> **username_2**: Rescan is required in order for the wallets to have gotten any transactions that were made during the time the wallet was offline. A workaround to avoid that is to remove all blockchain data and then start Bitcoin Core with `-connect=0`. This will force it to not make any network connections so that it doesn't sync the blockchain, and hence any loaded wallets will not have anything to rescan. However this may miss some transactions, and some functionality may be disabled as it will not be synced.  
> **username_3**: Some reviewers supposed that this is a duplicate of a question about getting the private keys, but that is not the asker's goal.  @AndrewChow provided good and helpful answers which the asker could work into a helpful answer to his own question.  I vote to keep it open in the hope that one of them will do that.  

---

## 1 answers

### Answer by username_2 on 2021-10-07. Score: 2

There is no way to export all of the transactions to a csv. However you can get the transaction in JSON using the `listtransactions` RPC.

Bitcoin Core will always rescan when a wallet is loaded because it must be sure that it has seen all of the wallet's transactions so that the user does not appear to have lost any funds. For old wallets, it ends up having to rescan a significant portion of the blockchain. There is no way to disable this behavior.

However, if you are sure that no rescan is necessary, it is possible to force Bitcoin Core to not have any blockchain data so that the rescan completes quickly and does not do anything. You can do this by removing all blockchain data from the datadir and starting Bitcoin Core with `-connect=0`. This will force Bitcoin Core to not connect to the network so it will not be able to download the blockchain. Additionally, because you have removed any previous blockchain data, Bitcoin Core will be reset to the genesis block as the only block in the blockchain. Loading a wallet at this point will result in no rescan.

Lastly, to speed things up, instead of constantly stopping and starting Bitcoin Core to load new wallets, you can use the `loadwallet` RPC to load a wallet, and `unloadwallet` to unload the wallet when you are done with it.

Some python-like pseudocode that shows what this would look like:

```
for wallet in wallets:
    rpc.loadwallet(wallet)
    print(rpc.listtransactions())
    rpc.unloadwallet(wallet)

```


---

