1

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!!

1 Answer 1

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 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

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

4
  • 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? Commented Mar 29, 2019 at 16:08
  • 1. yes you can. 2. no because all transactions are included in a block, which is timestamped
    – JBaczuk
    Commented Mar 29, 2019 at 16:17
  • 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? Commented Mar 29, 2019 at 16:35
  • 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
    Commented Mar 29, 2019 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.