<blockquote>
  <p>I understand that the default setting in bitcoin core is that non-wallet transaction data is not stored on your harddrive in the blockchain data</p>
</blockquote>

<p>Actually the default is that it is stored, in the blk.dat files. There is another database for unspent outputs, in the <code>chainstate</code> folder. Your wallet will also index transactions for which you have imported the keys to either spend, or just watch.</p>

<blockquote>
  <p>Is transaction specific data (ie: bitcoin address, time, inputs/outpus, etc...) stored in any of my raw data (eg: blk.dat file)?</p>
</blockquote>

<p>Yes. Except that addresses are not stored, as addresses are an external format for specific types of <code>scriptPubkeys</code>, and timestamps are only in blocks, not transactions.</p>

<blockquote>
  <p>How does my node verify/validate the past blocks without knowing the transactions from that block? I'm assuming other nodes don't store the transaction data so how is it that my node obtains the transactions to do a full validation of the particular block?</p>
</blockquote>

<p>It does know the transactions from that block because it downloads the blocks from other nodes. The blocks contain the transactions.</p>

<blockquote>
  <p>If the transactions are not stored on my computer, how do I have a full copy of the blockchain? I thought this was one of the points of running a node - you have a full backup of the entire blockchain. How could I reproduce the entire blockchain (if needed) without having the transaction data within each block?</p>
</blockquote>

<p>They are, see above</p>

<blockquote>
  <p>If transaction are not stored, what exactly is stored in the block data and how is that useful? Is there a way to decode or use a mechanism to obtain the transaction information from the raw block data files?</p>
</blockquote>

<p>They are, see above. You can get the information with <a href="https://bitcoincore.org/en/doc/0.17.0/rpc/blockchain/getblock/" rel="nofollow noreferrer">RPC commands</a> using the cli such as:</p>



<pre><code>$ bitcoin-cli getblock
$ bitcoin-cli getrawtransaction &lt;tx-id&gt;
</code></pre>

<blockquote>
  <p>If transaction data is not stored in the block data of your computer (ie: txindex=0), how can you reproduce all the transactions if needed without having to download anything or connect to intenet to get it from other nodes if say you were the last node with a copy of the blockchain (eg: in case of an emergency if say, theoretically, all blockchains were somehow deleted and mine was the only one left)?</p>
</blockquote>

<p><code>txindex=0</code> does not mean that the transaction data is not stored, it only means that it is not indexed. This means you can only get raw transactions by txid using the <code>getrawtransaction</code> command for transactions in the mempool, see <a href="https://bitcoincore.org/en/doc/0.17.0/rpc/rawtransactions/getrawtransaction/" rel="nofollow noreferrer">getrawtransactions</a></p>

<blockquote>
  <p>Do I need to enable txindex=1 to have raw transaction data stored on my node? Or is it stored and accessible if needed without this enabled?</p>
</blockquote>

<p>Only to index the transactions, see above</p>

CC BY-SA 4.0
2019-03-29T16:08:52.077Z
Thank you so much, very helpful. Two follow ups:

1. So basically, if I ever needed to, I could use the raw data saved on my hard drive (with txindex=0) and (with tools mentioned above) create my own blockchain explorer detailing every transaction (inputs, outputs, etc...) without needing to obtain that information from any other nodes? I'm just thinking the hypothetical/theoretical situation where my computer has the only copy of the blockchain left and people rely on me to propagate all the transaction information.

2. Related to the above, isn't not having timesamps per tx an issue?
leafsfan1967
CC BY-SA 4.0
2019-03-29T16:17:19.187Z
1. yes you can.
2. no because all transactions are included in a block, which is timestamped
JBaczuk
CC BY-SA 4.0
2019-03-29T16:35:19.830Z
Thank you. Ok one final question re: #1. You mentioned above the bitcoin addresses aren’t stored so how do you recreate the transactions without the bitcoin addresses?
leafsfan1967
CC BY-SA 4.0
2019-03-29T16:42:02.157Z
My pleasure. There are only a few types of addresses, and they are just encoded versions of `scriptPubkeys` in each transaction output, so you can detect these `scriptPubkeys` and encode them into addresses for the explorer. I suggest reading up on what an address is.
JBaczuk
CC BY-SA 4.0
2019-03-29T15:58:18.977Z
2019-03-29T15:58:18.977Z
JBaczuk
<p>I had a few questions. I've looked extensively online and can't seem to get answers right on point.</p>

<p>I just started a full node using bitcoin core and it is currently syncing/validating the past blockchain and catching up. I understand that the default setting in bitcoin core is that non-wallet transaction data is not stored on your harddrive in the blockchain data. My questions are then:</p>

<ol>
<li><p>Is transaction specific data (ie: bitcoin address, time, inputs/outpus, etc...) stored in any of my raw data (eg: blk.dat file)? </p></li>
<li><p>How does my node verify/validate the past blocks without knowing the transactions from that block? I'm assuming other nodes don't store the transaction data so how is it that my node obtains the transactions to do a full validation of the particular block?</p></li>
<li><p>If the transactions are not stored on my computer, how do I have a full copy of the blockchain? I thought this was one of the points of running a node - you have a full backup of the entire blockchain. How could I reproduce the entire blockchain (if needed) without having the transaction data within each block?</p></li>
<li><p>If transaction are not stored, what exactly is stored in the block data and how is that useful? Is there a way to decode or use a mechanism to obtain the transaction information from the raw block data files?</p></li>
<li><p>If transaction data is not stored in the block data of your computer (ie: txindex=0), how can you reproduce all the transactions if needed without having to download anything or connect to intenet to get it from other nodes if say you were the last node with a copy of the blockchain (eg: in case of an emergency if say, theoretically, all blockchains were somehow deleted and mine was the only one left)?</p></li>
<li><p>Do I need to enable txindex=1 to have raw transaction data stored on my node? Or is it stored and accessible if needed without this enabled?</p></li>
</ol>

<p>would really appreciate your help!!</p>

<bitcoin-core><bitcoind>
How does bitcoin core save raw transaction data?
leafsfan1967
# How does bitcoin core save raw transaction data?

(Asked by: username_0 on 2019-03-29)

I had a few questions. I've looked extensively online and can't seem to get answers right on point.

I just started a full node using bitcoin core and it is currently syncing/validating the past blockchain and catching up. I understand that the default setting in bitcoin core is that non-wallet transaction data is not stored on your harddrive in the blockchain data. My questions are then:

1. Is transaction specific data (ie: bitcoin address, time, inputs/outpus, etc...) stored in any of my raw data (eg: blk.dat file)?
2. How does my node verify/validate the past blocks without knowing the transactions from that block? I'm assuming other nodes don't store the transaction data so how is it that my node obtains the transactions to do a full validation of the particular block?
3. If the transactions are not stored on my computer, how do I have a full copy of the blockchain? I thought this was one of the points of running a node - you have a full backup of the entire blockchain. How could I reproduce the entire blockchain (if needed) without having the transaction data within each block?
4. If transaction are not stored, what exactly is stored in the block data and how is that useful? Is there a way to decode or use a mechanism to obtain the transaction information from the raw block data files?
5. If transaction data is not stored in the block data of your computer (ie: txindex=0), how can you reproduce all the transactions if needed without having to download anything or connect to intenet to get it from other nodes if say you were the last node with a copy of the blockchain (eg: in case of an emergency if say, theoretically, all blockchains were somehow deleted and mine was the only one left)?
6. Do I need to enable txindex=1 to have raw transaction data stored on my node? Or is it stored and accessible if needed without this enabled?

would really appreciate your help!!

**Tags:** bitcoin-core, bitcoind


---

## 1 answers

### Answer by username_1 on 2019-03-29. Score: 1

> I understand that the default setting in bitcoin core is that non-wallet transaction data is not stored on your harddrive in the blockchain data

Actually the default is that it is stored, in the blk.dat files. There is another database for unspent outputs, in the `chainstate` folder. Your wallet will also index transactions for which you have imported the keys to either spend, or just watch.

> Is transaction specific data (ie: bitcoin address, time, inputs/outpus, etc...) stored in any of my raw data (eg: blk.dat file)?

Yes. Except that addresses are not stored, as addresses are an external format for specific types of `scriptPubkeys`, and timestamps are only in blocks, not transactions.

> How does my node verify/validate the past blocks without knowing the transactions from that block? I'm assuming other nodes don't store the transaction data so how is it that my node obtains the transactions to do a full validation of the particular block?

It does know the transactions from that block because it downloads the blocks from other nodes. The blocks contain the transactions.

> If the transactions are not stored on my computer, how do I have a full copy of the blockchain? I thought this was one of the points of running a node - you have a full backup of the entire blockchain. How could I reproduce the entire blockchain (if needed) without having the transaction data within each block?

They are, see above

> If transaction are not stored, what exactly is stored in the block data and how is that useful? Is there a way to decode or use a mechanism to obtain the transaction information from the raw block data files?

They are, see above. You can get the information with [RPC commands](https://bitcoincore.org/en/doc/0.17.0/rpc/blockchain/getblock/) using the cli such as:

```
$ bitcoin-cli getblock
$ bitcoin-cli getrawtransaction <tx-id>

```

> If transaction data is not stored in the block data of your computer (ie: txindex=0), how can you reproduce all the transactions if needed without having to download anything or connect to intenet to get it from other nodes if say you were the last node with a copy of the blockchain (eg: in case of an emergency if say, theoretically, all blockchains were somehow deleted and mine was the only one left)?

`txindex=0` does not mean that the transaction data is not stored, it only means that it is not indexed. This means you can only get raw transactions by txid using the `getrawtransaction` command for transactions in the mempool, see [getrawtransactions](https://bitcoincore.org/en/doc/0.17.0/rpc/rawtransactions/getrawtransaction/)

> Do I need to enable txindex=1 to have raw transaction data stored on my node? Or is it stored and accessible if needed without this enabled?

Only to index the transactions, see above

> **Comments:**
> **username_0**: Thank you so much, very helpful. Two follow ups:  1. So basically, if I ever needed to, I could use the raw data saved on my hard drive (with txindex=0) and (with tools mentioned above) create my own blockchain explorer detailing every transaction (inputs, outputs, etc...) without needing to obtain that information from any other nodes? I'm just thinking the hypothetical/theoretical situation where my computer has the only copy of the blockchain left and people rely on me to propagate all the transaction information.  2. Related to the above, isn't not having timesamps per tx an issue?  
> **username_1**: 1. yes you can. 2. no because all transactions are included in a block, which is timestamped  
> **username_0**: Thank you. Ok one final question re: #1. You mentioned above the bitcoin addresses aren’t stored so how do you recreate the transactions without the bitcoin addresses?  
> **username_1**: My pleasure. There are only a few types of addresses, and they are just encoded versions of `scriptPubkeys` in each transaction output, so you can detect these `scriptPubkeys` and encode them into addresses for the explorer. I suggest reading up on what an address is.  

---

