<blockquote>
  <p>I am wonder why this works.</p>
</blockquote>

<p>Because all options have the default value.</p>

<blockquote>
  <p>The question is what txindex=1 do.</p>
</blockquote>

<p><sub>I can't find this option in the documentation</sub></p>

<p>From the <a href="https://en.bitcoin.it/wiki/Running_Bitcoin" rel="nofollow noreferrer"><code>documentation</code></a></p>

<blockquote>
  <p><code>-txindex</code> Maintain a full transaction index, used by the <code>getrawtransaction</code> rpc
  call <strong>(default: 0)</strong></p>
</blockquote>

<p>If you're using Bitcoin Core just for your own personal use, you probably don't need the <code>-txindex=1</code> option. But, if you're using Bitcoin core for development or blockchain analysis of some sort, you will need to set <code>-txindex=1</code> to be able <em>to get transactions data for any transaction in the blockchain.</em></p>

CC BY-SA 3.0
2017-09-06T09:26:45.157Z
ok, but isn't the default value is 0 ? then why it works? in conf file I have # in front. Even this is not considered as comment, it changes the option
Nick
CC BY-SA 3.0
2017-09-06T09:28:55.917Z
AFAIK  there is no such option `txindex=1` for `bitcoin.conf`(check the [documentation](https://en.bitcoin.it/wiki/Running_Bitcoin)) this option is only for bitcoind, so when it does nothing then you add it ti the `bitcoin.conf`, any kind of unknow options must be ignored, I assume.
Roman Kiselenko
CC BY-SA 3.0
2017-09-06T09:32:05.283Z
ok, but i never started bitcond with -txindex=1, i did it with just -daemon
Nick
CC BY-SA 3.0
2017-09-06T09:33:15.600Z
@Nick no matter 1 or 0, only with `-txindex` or without, just like with `-daemon` or without.
Roman Kiselenko
CC BY-SA 3.0
2017-09-06T09:46:52.377Z
I found something strange, I did found a transaction I can not access. then restarted with txindex and now it is accessible. So generally without txindex, some tx are accessible, some are not.
Nick
CC BY-SA 3.0
2017-09-06T09:48:39.090Z
@Nick txindex its for `utxo`  for unspent transactions.
Roman Kiselenko
CC BY-SA 3.0
2017-09-06T10:44:24.173Z
is this because unspent transactions are important in case their coins come to our own address in the future?
Nick
CC BY-SA 3.0
2017-09-06T10:51:22.143Z
can't get what you're asking. utxo it's a just unspent bitcoins, txindex mostly used to check the transactions input or output. I'm also a crypto-noob, so something I dont understand.
Roman Kiselenko
CC BY-SA 3.0
2017-09-06T08:59:31.383Z
2017-09-06T09:33:01.110Z
2017-09-06T09:33:01.110Z
Roman Kiselenko
<p>It works because your transaction is still in mempool. Once transaction leaves the mempool when confirmed you need <code>txindex=1</code> to query it from the disk.</p>

CC BY-SA 3.0
2017-09-06T13:20:06.303Z
It seems kind of unlikely that a transaction with 71681 confirmations would be in the mempool...
Nate Eldredge
CC BY-SA 3.0
2017-09-06T13:56:25.930Z
not true, I tried with transactions from 2009 and early 2010
Nick
CC BY-SA 3.0
2017-09-06T11:25:47.087Z
2017-09-06T11:25:47.087Z
dark knight
<p>I am currently running bitcoind with empty bitcoin.conf:</p>

<pre><code>[root@nas .bitcoin]# cat bitcoin.conf 

#txindex=1
</code></pre>

<p>I am wonder why this works:</p>

<pre><code>[root@nas .bitcoin]# bitcoin-cli getrawtransaction 1ea2a83c8e418fde3f512b67bb9db1e52e690a143430c813d152a5b7fe125cf1 1
{
  "hex": "010000000115fc42901b6f0a3f4a34d506b807ebf03d97f017782a794d7301125f880dbe25000000008c493046022100f34f800f9abaf3c67435d1693cbb10732b506fb5fa792de10bcd6eed0449d56c02210083f392d6e3ce6a5ceafc01482339e022a37b54285561463b88cbc18cd8ab5e5c014104a41046648e01774cb2ce9c6bf27e1f9a64e89a95f26218cacf0ee0bb52ba479a11c5b77b8834235bb73fea84ccf899c9f266a0430871a8149a1b7f6ac1c41033ffffffff02c057d069080000001976a914a6e842531b39d49d89570bcd01ddb92dec87cc1188ac404b4c00000000001976a914951ffc558ffbf20d47f96a06df69a369e244c78288ac00000000",
  "txid": "1ea2a83c8e418fde3f512b67bb9db1e52e690a143430c813d152a5b7fe125cf1",
  "hash": "1ea2a83c8e418fde3f512b67bb9db1e52e690a143430c813d152a5b7fe125cf1",
  "size": 259,
  "vsize": 259,
  "version": 1,
  "locktime": 0,
  "vin": [
    {
      "txid": "25be0d885f1201734d792a7817f0973df0eb07b806d5344a3f0a6f1b9042fc15",
      "vout": 0,
      "scriptSig": {
        "asm": "3046022100f34f800f9abaf3c67435d1693cbb10732b506fb5fa792de10bcd6eed0449d56c02210083f392d6e3ce6a5ceafc01482339e022a37b54285561463b88cbc18cd8ab5e5c[ALL] 04a41046648e01774cb2ce9c6bf27e1f9a64e89a95f26218cacf0ee0bb52ba479a11c5b77b8834235bb73fea84ccf899c9f266a0430871a8149a1b7f6ac1c41033",
        "hex": "493046022100f34f800f9abaf3c67435d1693cbb10732b506fb5fa792de10bcd6eed0449d56c02210083f392d6e3ce6a5ceafc01482339e022a37b54285561463b88cbc18cd8ab5e5c014104a41046648e01774cb2ce9c6bf27e1f9a64e89a95f26218cacf0ee0bb52ba479a11c5b77b8834235bb73fea84ccf899c9f266a0430871a8149a1b7f6ac1c41033"
      },
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 361.35000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 a6e842531b39d49d89570bcd01ddb92dec87cc11 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914a6e842531b39d49d89570bcd01ddb92dec87cc1188ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "1GDXQVHZaDVxGXqyXdS9yMCsDYKdE5x7rS"
        ]
      }
    }, 
    {
      "value": 0.05000000,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 951ffc558ffbf20d47f96a06df69a369e244c782 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914951ffc558ffbf20d47f96a06df69a369e244c78288ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "1EbVzzEXiuK4Y7xStsfTEHrGeNj3aoeEfZ"
        ]
      }
    }
  ],
  "blockhash": "000000000000a08eb97316b473e6c55e61ac1899471e24ec040899898bf5da00",
  "confirmations": 71681,
  "time": 1297408136,
  "blocktime": 1297408136
}
</code></pre>

<p>Additionally, if my question is wrong, then question is what <code>txindex=1</code> do.</p>

CC BY-SA 3.0
2017-09-06T13:20:59.200Z
Is this a transaction that you sent, or that credits an address in your wallet?  Those are stored in wallet.dat and can always be queried, even without txindex.
Nate Eldredge
CC BY-SA 3.0
2017-09-06T13:24:47.750Z
Otherwise, did you ever have txindex enabled before?  Running with txindex adds transactions to the chainstate database, but I don't think they are removed if you disable the option, unless you `-reindex`.
Nate Eldredge
<bitcoind>
bitcoind without txindex=1
Nick
# bitcoind without txindex=1

(Asked by: username_0 on 2017-09-06)

I am currently running bitcoind with empty bitcoin.conf:
[root@nas .bitcoin]# cat bitcoin.conf 

#txindex=1

I am wonder why this works:
[root@nas .bitcoin]# bitcoin-cli getrawtransaction 1ea2a83c8e418fde3f512b67bb9db1e52e690a143430c813d152a5b7fe125cf1 1
{
  "hex": "010000000115fc42901b6f0a3f4a34d506b807ebf03d97f017782a794d7301125f880dbe25000000008c493046022100f34f800f9abaf3c67435d1693cbb10732b506fb5fa792de10bcd6eed0449d56c02210083f392d6e3ce6a5ceafc01482339e022a37b54285561463b88cbc18cd8ab5e5c014104a41046648e01774cb2ce9c6bf27e1f9a64e89a95f26218cacf0ee0bb52ba479a11c5b77b8834235bb73fea84ccf899c9f266a0430871a8149a1b7f6ac1c41033ffffffff02c057d069080000001976a914a6e842531b39d49d89570bcd01ddb92dec87cc1188ac404b4c00000000001976a914951ffc558ffbf20d47f96a06df69a369e244c78288ac00000000",
  "txid": "1ea2a83c8e418fde3f512b67bb9db1e52e690a143430c813d152a5b7fe125cf1",
  "hash": "1ea2a83c8e418fde3f512b67bb9db1e52e690a143430c813d152a5b7fe125cf1",
  "size": 259,
  "vsize": 259,
  "version": 1,
  "locktime": 0,
  "vin": [
    {
      "txid": "25be0d885f1201734d792a7817f0973df0eb07b806d5344a3f0a6f1b9042fc15",
      "vout": 0,
      "scriptSig": {
        "asm": "3046022100f34f800f9abaf3c67435d1693cbb10732b506fb5fa792de10bcd6eed0449d56c02210083f392d6e3ce6a5ceafc01482339e022a37b54285561463b88cbc18cd8ab5e5c[ALL] 04a41046648e01774cb2ce9c6bf27e1f9a64e89a95f26218cacf0ee0bb52ba479a11c5b77b8834235bb73fea84ccf899c9f266a0430871a8149a1b7f6ac1c41033",
        "hex": "493046022100f34f800f9abaf3c67435d1693cbb10732b506fb5fa792de10bcd6eed0449d56c02210083f392d6e3ce6a5ceafc01482339e022a37b54285561463b88cbc18cd8ab5e5c014104a41046648e01774cb2ce9c6bf27e1f9a64e89a95f26218cacf0ee0bb52ba479a11c5b77b8834235bb73fea84ccf899c9f266a0430871a8149a1b7f6ac1c41033"
      },
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 361.35000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 a6e842531b39d49d89570bcd01ddb92dec87cc11 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914a6e842531b39d49d89570bcd01ddb92dec87cc1188ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "1GDXQVHZaDVxGXqyXdS9yMCsDYKdE5x7rS"
        ]
      }
    }, 
    {
      "value": 0.05000000,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 951ffc558ffbf20d47f96a06df69a369e244c782 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914951ffc558ffbf20d47f96a06df69a369e244c78288ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "1EbVzzEXiuK4Y7xStsfTEHrGeNj3aoeEfZ"
        ]
      }
    }
  ],
  "blockhash": "000000000000a08eb97316b473e6c55e61ac1899471e24ec040899898bf5da00",
  "confirmations": 71681,
  "time": 1297408136,
  "blocktime": 1297408136
}

Additionally, if my question is wrong, then question is what txindex=1 do.

**Tags:** bitcoind

> **Comments:**
> **username_1**: Is this a transaction that you sent, or that credits an address in your wallet?  Those are stored in wallet.dat and can always be queried, even without txindex.  
> **username_1**: Otherwise, did you ever have txindex enabled before?  Running with txindex adds transactions to the chainstate database, but I don't think they are removed if you disable the option, unless you `-reindex`.  

---

## 2 answers

### Answer by username_2 on 2017-09-06. Score: 2 | Accepted answer

> I am wonder why this works.

Because all options have the default value.

> The question is what txindex=1 do.

I can't find this option in the documentation

From the [`documentation`](https://en.bitcoin.it/wiki/Running_Bitcoin)

> `-txindex` Maintain a full transaction index, used by the `getrawtransaction` rpc
> call **(default: 0)**

If you're using Bitcoin Core just for your own personal use, you probably don't need the `-txindex=1` option. But, if you're using Bitcoin core for development or blockchain analysis of some sort, you will need to set `-txindex=1` to be able *to get transactions data for any transaction in the blockchain.*

> **Comments:**
> **username_0**: ok, but isn't the default value is 0 ? then why it works? in conf file I have # in front. Even this is not considered as comment, it changes the option  
> **username_2**: AFAIK  there is no such option `txindex=1` for `bitcoin.conf`(check the [documentation](https://en.bitcoin.it/wiki/Running_Bitcoin)) this option is only for bitcoind, so when it does nothing then you add it ti the `bitcoin.conf`, any kind of unknow options must be ignored, I assume.  
> **username_0**: ok, but i never started bitcond with -txindex=1, i did it with just -daemon  
> **username_2**: @username_0 no matter 1 or 0, only with `-txindex` or without, just like with `-daemon` or without.  
> **username_0**: I found something strange, I did found a transaction I can not access. then restarted with txindex and now it is accessible. So generally without txindex, some tx are accessible, some are not.  
> **username_2**: @username_0 txindex its for `utxo`  for unspent transactions.  
> **username_0**: is this because unspent transactions are important in case their coins come to our own address in the future?  
> **username_2**: can't get what you're asking. utxo it's a just unspent bitcoins, txindex mostly used to check the transactions input or output. I'm also a crypto-noob, so something I dont understand.  

---

### Answer by username_3 on 2017-09-06. Score: 1

It works because your transaction is still in mempool. Once transaction leaves the mempool when confirmed you need `txindex=1` to query it from the disk.

> **Comments:**
> **username_1**: It seems kind of unlikely that a transaction with 71681 confirmations would be in the mempool...  
> **username_0**: not true, I tried with transactions from 2009 and early 2010  

---

