<p><strike>
Seeing as this question remains unanswered after a few months...</p>

<p>You will need to enable <code>txindex = 1</code> in your <code>bitcoin.conf</code> per @Jannes' suggestion. If you want to scan <strong>your</strong> downloaded blockchain for <strong>another wallet's</strong> address transaction history, then you have to build the <strong>entire blockchain index</strong> on your machine.</p>

<p>Whether it's a watch-only address or not should be irrelevant.</p>

<p><a href="https://bitcoin.stackexchange.com/questions/35707/what-are-pros-and-cons-of-txindex-option">What are pros and cons of txindex option?</a></p>

<p><a href="https://bitcoin.stackexchange.com/questions/11759/get-non-wallet-transactions-using-bitcoin-rpc-gettransaction">Get non-wallet transactions using bitcoin rpc (gettransaction)</a>
</strike></p>

<p><strong>UPDATE</strong></p>

<p>I think I may have solved your problem</p>

<p>This is my Bitcoin info</p>

<pre><code>$ bitcoin-cli getinfo
{
    "version" : 110200,
    "protocolversion" : 70002,
    "walletversion" : 60000,
    "balance" : 0.00000000,
    "blocks" : 353776,
    "timeoffset" : -1,
    "connections" : 55,
    "proxy" : "",
    "difficulty" : 47610564513.47126007,
    "testnet" : false,
    "keypoololdest" : 1449210293,
    "keypoolsize" : 101,
    "paytxfee" : 0.00000000,
    "relayfee" : 0.00005000,
    "errors" : ""
}
</code></pre>

<p>My blockchain isn't quite as up-to-date as yours, so I gathered <a href="https://blockchain.info/tx/64540e42ec96118d11168d954641dd5390f4a46ba795c7b7588d38141e66117a" rel="nofollow noreferrer">this transaction</a> (within block 353776) and used the Bitcoin address of <code>1CTVqQSSVTjun32gRxmhJHhVYzzXpR894z</code> from that transaction for my example.</p>

<pre><code># Import address WITHOUT rescan; we'll do this later
bitcoin-cli importaddress 1CTVqQSSVTjun32gRxmhJHhVYzzXpR894z "Index Test" false

# Stop Bitcoin
$ bitcoin-cli stop

# Verify Bitcoin is stopped, then run:
$ bitcoind -rescan

# Wait for rescan... mine took 15-20 minutes

# Once 'bitcoin-cli getinfo' returns valid info, run:
$ bitcoin-cli listtransactions "Index Test" 10 0 true

# Result:

[
    {
        "involvesWatchonly" : true,
        "account" : "Index Test",
        "address" : "1CTVqQSSVTjun32gRxmhJHhVYzzXpR894z",
        "category" : "receive",
        "amount" : 3.50000000,
        "vout" : 0,
        "confirmations" : 22539,
        "blockhash" : "00000000000000000548d8ef9a7d14c75b7b18ae5b792d520f44cc5ddd25adfe",
        "blockindex" : 536,
        "blocktime" : 1416848183,
        "txid" : "1db7b0703f441d4cea63a298131f8e766b557329f44c30898847d0fc23573606",
        "walletconflicts" : [
        ],
        "time" : 1452652576,
        "timereceived" : 1453438387
    },
    {
        "involvesWatchonly" : true,
        "account" : "Index Test",
        "address" : "1CTVqQSSVTjun32gRxmhJHhVYzzXpR894z",
        "category" : "receive",
        "amount" : 1.89990000,
        "vout" : 1,
        "confirmations" : 19031,
        "blockhash" : "0000000000000000134345f88fb68550d2102d392be6e1635eaa6fb50c37a2cc",
        "blockindex" : 15,
        "blocktime" : 1418994502,
        "txid" : "4cc761b286c23dab5dd07c260726d79e4baee88778a402e36c82a6b9e6ac757f",
        "walletconflicts" : [
        ],
        "time" : 1452652576,
        "timereceived" : 1453438430
    },
    ...
    snip
    ...
    {
        "involvesWatchonly" : true,
        "account" : "Index Test",
        "address" : "1CTVqQSSVTjun32gRxmhJHhVYzzXpR894z",
        "category" : "receive",
        "amount" : 13.63000000,
        "vout" : 0,
        "confirmations" : 211,
        "blockhash" : "0000000000000000021df02390f30985f34d871e4cc93c4e349cd3b23574bf76",
        "blockindex" : 1,
        "blocktime" : 1430041109,
        "txid" : "64540e42ec96118d11168d954641dd5390f4a46ba795c7b7588d38141e66117a",
        "walletconflicts" : [
        ],
        "time" : 1452652576,
        "timereceived" : 1453438694
    }
]
</code></pre>

<p>As you can see, the last transaction to show in the output is the one I grabbed from block 353776, with all of the correct details as displayed on blockchain.info, indicating a successful transaction listing for the imported address (account containing the address, actually).</p>

<p>As for why your rescan didn't work when you initially imported the address, I can't really say. Perhaps a more seasoned Bitcoin user could shed some light on that. </p>

<p>At this point, I recommend you stop your Bitcoin daemon and run <code>bitcoind -rescan</code> and wait for it to do its magic. Afterwards try your <code>listtransactions</code> again. I'm interested in finding out if it works for you.</p>

<p><strong>Keep in mind</strong> that attempting to import a Bitcoin address that already exists within your wallet will <strong>not</strong> initiate a rescan, even if specified to do so on the command line. --- <a href="https://bitcoin.org/en/developer-reference#importaddress" rel="nofollow noreferrer">https://bitcoin.org/en/developer-reference#importaddress</a></p>

CC BY-SA 3.0
2016-01-21T05:54:41.887Z
`txindex=1` is already the case for me. for example `bitcoin-cli getrawtransaction 0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098` works fine, though i obviously this transaction is not relevant to my personal wallet.
mulllhausen
CC BY-SA 3.0
2016-01-21T06:05:34.183Z
also please see the discussion below the question. this solution has already been proposed and did not work.
mulllhausen
CC BY-SA 3.0
2016-01-21T14:44:19.350Z
My apologies, I understand your dilemma now.

When you run `bitcoin-cli listaccounts`, is the address you imported displayed in the output?
maff1989
CC BY-SA 3.0
2016-01-22T01:36:45.670Z
no worries. no it is not. if you could try doing the import and letting me know if you see it in yours that would be very helpful.
mulllhausen
CC BY-SA 3.0
2016-01-22T20:07:33.860Z
I have provided an update to my answer. Please let me know if that helps in resolving your issue.
maff1989
CC BY-SA 3.0
2016-01-23T03:23:44.407Z
looks promising. i'll give it a go...
mulllhausen
CC BY-SA 3.0
2016-01-21T01:07:31.950Z
2016-01-22T20:11:40.147Z
2017-04-13T12:47:33.660Z
maff1989
<p>I also encountered the same problem, I don't know if the landlord has solved this problem. I do the operations in litecoin-cli, but I think they should be implemented in the same way. Do not add any parameters, execute the following command directly.I got the relevant transaction information of the observer address.</p>



<pre><code>litecoin-cli listtransactions "" 10 0 true
</code></pre>

<p>Once I added the address for query, it returned an empty list. I think this may be an implementation bug of listtransactions.</p>

<p>I declare my configuration.</p>



<pre><code>txindex = 1
and importaddress $address complete.
</code></pre>

<p>Hope it could help everyone.</p>

CC BY-SA 4.0
2020-03-19T03:51:10.357Z
2020-03-19T03:51:10.357Z
hu wentao
<p>does bitcoin-cli have any functionality to get all tx hashes for a given address (ie the txs that either send or receive funds from the given address). <code>listtransactions</code> sounds like it should do what i want, but when i run it like so then i get no results:</p>
<pre><code># pick a random address to watch from blockchain.info:
$ addr=1GkktBuJ6Pr51WEJe5ZzyNvMYaMDFjwyDk
# create a watch-only account for this address, with the account name
# being the address itself, for convenience:
$ time bitcoin-cli importaddress $addr &quot;$addr&quot; true
real    41m59.505s
user    0m0.004s
sys 0m0.004s
$ bitcoin-cli listtransactions &quot;$addr&quot; 100 0 true
[
]
$ bitcoin-cli getinfo
{
    &quot;version&quot; : 100200,
    &quot;protocolversion&quot; : 70002,
    &quot;walletversion&quot; : 60000,
    &quot;balance&quot; : 0.00000000,
    &quot;blocks&quot; : 384809,
    &quot;timeoffset&quot; : 0,
    &quot;connections&quot; : 8,
    &quot;proxy&quot; : &quot;&quot;,
    &quot;difficulty&quot; : 65848255179.70261383,
    &quot;testnet&quot; : false,
    &quot;keypoololdest&quot; : 1381701523,
    &quot;keypoolsize&quot; : 101,
    &quot;paytxfee&quot; : 0.00000000,
    &quot;relayfee&quot; : 0.00001000,
    &quot;errors&quot; : &quot;&quot;
}
</code></pre>
<p>as you can see, it takes 42 minutes to scan the blockchain for this watch-only address, so its not something i want to do often. and its only producing an empty list, <a href="https://blockchain.info/address/1GkktBuJ6Pr51WEJe5ZzyNvMYaMDFjwyDk" rel="noreferrer">whereas blockchain.info shows there are 6 transactions</a>.</p>
<p>why is this not working? is this not the intended functionality of <code>bitcoin-cli listtransactions</code>?</p>
<h2>update</h2>
<p><code>listtransactions</code> is supposed to display transactions from watch-only addresses:</p>
<pre><code>$ bitcoin-cli help listtransactions
listtransactions ( &quot;account&quot; count from includeWatchonly)

Returns up to 'count' most recent transactions skipping the first 'from' transactions for account 'account'.

Arguments:
1. &quot;account&quot;    (string, optional) The account name. If not included, it will list all transactions for all accounts.
                                     If &quot;&quot; is set, it will list transactions for the default account.
2. count          (numeric, optional, default=10) The number of transactions to return
3. from           (numeric, optional, default=0) The number of transactions to skip
4. includeWatchonly (bool, optional, default=false) Include transactions to watchonly addresses (see 'importaddress')
...
...
...
</code></pre>

CC BY-SA 3.0
2015-11-23T03:08:13.977Z
I think you need to enable the -txindex option for this. When you first enable this bitcoind will have to re-process the entire transaction history to fill this new transaction index which will take a while. It will also cost you more disk space. ~30 GB extra I think.
Jannes
CC BY-SA 3.0
2015-11-23T03:39:24.900Z
@Jannes i compiled it from source, but i can't remember if i had this flag enabled. i know other watch-only functionality is working though. do you know if there is there any way of checking if i have this setting enabled without recompiling?
mulllhausen
CC BY-SA 3.0
2015-11-23T09:52:25.983Z
It's not a compile time setting, it's a runtime argument. `txindex 1` in the conf file. But it looks like I was wrong and you actually don't need to do that. https://github.com/bitcoin/bitcoin/pull/4045  (they mention listtransactions ignores watch only on purpose there.)
Jannes
CC BY-SA 3.0
2015-11-23T11:48:00.880Z
@Jannes but the final argument of `listtransactions` is `includeWatchonly`. please see my update in the question.
mulllhausen
CC BY-SA 3.0
2015-11-23T12:40:14.407Z
Are you sure the transactions happened AFTER you did `importaddress` ? I'm pretty sure it won't search the whole blockchain for older transactions. (It might if you had `txindex=1`, but I'm not sure if that affects this.)
Jannes
CC BY-SA 3.0
2015-11-23T13:02:30.230Z
@Jannes, no they happened before - that's what the final argument in `importaddress` is for - it scans the blockchain. and that's why it took 41 minutes and 59 seconds :p
mulllhausen
CC BY-SA 3.0
2015-11-23T15:57:56.120Z
Sorry I'm not really paying attention to what you already tried and mostly just guessing.
Jannes
CC BY-SA 3.0
2015-11-24T02:54:16.800Z
@Jannes no worries thanks anyway. if you like you could build the latest version from source and see if you can replicate the problem. its a watch-only address (i have no idea who it belongs to) so you can use all the same details as in my question here.
mulllhausen
<listtransactions><bitcoin-cli>
bitcoin-cli get all tx hashes for watch-only address
mulllhausen
# bitcoin-cli get all tx hashes for watch-only address

(Asked by: username_0 on 2015-11-22)

does bitcoin-cli have any functionality to get all tx hashes for a given address (ie the txs that either send or receive funds from the given address). `listtransactions` sounds like it should do what i want, but when i run it like so then i get no results:

```
# pick a random address to watch from blockchain.info:
$ addr=1GkktBuJ6Pr51WEJe5ZzyNvMYaMDFjwyDk
# create a watch-only account for this address, with the account name
# being the address itself, for convenience:
$ time bitcoin-cli importaddress $addr "$addr" true
real    41m59.505s
user    0m0.004s
sys 0m0.004s
$ bitcoin-cli listtransactions "$addr" 100 0 true
[
]
$ bitcoin-cli getinfo
{
    "version" : 100200,
    "protocolversion" : 70002,
    "walletversion" : 60000,
    "balance" : 0.00000000,
    "blocks" : 384809,
    "timeoffset" : 0,
    "connections" : 8,
    "proxy" : "",
    "difficulty" : 65848255179.70261383,
    "testnet" : false,
    "keypoololdest" : 1381701523,
    "keypoolsize" : 101,
    "paytxfee" : 0.00000000,
    "relayfee" : 0.00001000,
    "errors" : ""
}

```

as you can see, it takes 42 minutes to scan the blockchain for this watch-only address, so its not something i want to do often. and its only producing an empty list, [whereas blockchain.info shows there are 6 transactions](https://blockchain.info/address/1GkktBuJ6Pr51WEJe5ZzyNvMYaMDFjwyDk).

why is this not working? is this not the intended functionality of `bitcoin-cli listtransactions`?

## update

`listtransactions` is supposed to display transactions from watch-only addresses:

```
$ bitcoin-cli help listtransactions
listtransactions ( "account" count from includeWatchonly)

Returns up to 'count' most recent transactions skipping the first 'from' transactions for account 'account'.

Arguments:
1. "account"    (string, optional) The account name. If not included, it will list all transactions for all accounts.
                                     If "" is set, it will list transactions for the default account.
2. count          (numeric, optional, default=10) The number of transactions to return
3. from           (numeric, optional, default=0) The number of transactions to skip
4. includeWatchonly (bool, optional, default=false) Include transactions to watchonly addresses (see 'importaddress')
...
...
...

```

**Tags:** listtransactions, bitcoin-cli

> **Comments:**
> **username_1**: I think you need to enable the -txindex option for this. When you first enable this bitcoind will have to re-process the entire transaction history to fill this new transaction index which will take a while. It will also cost you more disk space. ~30 GB extra I think.  
> **username_0**: @username_1 i compiled it from source, but i can't remember if i had this flag enabled. i know other watch-only functionality is working though. do you know if there is there any way of checking if i have this setting enabled without recompiling?  
> **username_1**: It's not a compile time setting, it's a runtime argument. `txindex 1` in the conf file. But it looks like I was wrong and you actually don't need to do that. https://github.com/bitcoin/bitcoin/pull/4045  (they mention listtransactions ignores watch only on purpose there.)  
> **username_0**: @username_1 but the final argument of `listtransactions` is `includeWatchonly`. please see my update in the question.  
> **username_1**: Are you sure the transactions happened AFTER you did `importaddress` ? I'm pretty sure it won't search the whole blockchain for older transactions. (It might if you had `txindex=1`, but I'm not sure if that affects this.)  
> **username_0**: @username_1, no they happened before - that's what the final argument in `importaddress` is for - it scans the blockchain. and that's why it took 41 minutes and 59 seconds :p  
> **username_1**: Sorry I'm not really paying attention to what you already tried and mostly just guessing.  
> **username_0**: @username_1 no worries thanks anyway. if you like you could build the latest version from source and see if you can replicate the problem. its a watch-only address (i have no idea who it belongs to) so you can use all the same details as in my question here.  

---

## 2 answers

### Answer by username_2 on 2016-01-21. Score: 3

Seeing as this question remains unanswered after a few months...

You will need to enable `txindex = 1` in your `bitcoin.conf` per @username_1' suggestion. If you want to scan **your** downloaded blockchain for **another wallet's** address transaction history, then you have to build the **entire blockchain index** on your machine.

Whether it's a watch-only address or not should be irrelevant.

[What are pros and cons of txindex option?](https://bitcoin.stackexchange.com/questions/35707/what-are-pros-and-cons-of-txindex-option)

[Get non-wallet transactions using bitcoin rpc (gettransaction)](https://bitcoin.stackexchange.com/questions/11759/get-non-wallet-transactions-using-bitcoin-rpc-gettransaction)

**UPDATE**

I think I may have solved your problem

This is my Bitcoin info

```
$ bitcoin-cli getinfo
{
    "version" : 110200,
    "protocolversion" : 70002,
    "walletversion" : 60000,
    "balance" : 0.00000000,
    "blocks" : 353776,
    "timeoffset" : -1,
    "connections" : 55,
    "proxy" : "",
    "difficulty" : 47610564513.47126007,
    "testnet" : false,
    "keypoololdest" : 1449210293,
    "keypoolsize" : 101,
    "paytxfee" : 0.00000000,
    "relayfee" : 0.00005000,
    "errors" : ""
}

```

My blockchain isn't quite as up-to-date as yours, so I gathered [this transaction](https://blockchain.info/tx/64540e42ec96118d11168d954641dd5390f4a46ba795c7b7588d38141e66117a) (within block 353776) and used the Bitcoin address of `1CTVqQSSVTjun32gRxmhJHhVYzzXpR894z` from that transaction for my example.

```
# Import address WITHOUT rescan; we'll do this later
bitcoin-cli importaddress 1CTVqQSSVTjun32gRxmhJHhVYzzXpR894z "Index Test" false

# Stop Bitcoin
$ bitcoin-cli stop

# Verify Bitcoin is stopped, then run:
$ bitcoind -rescan

# Wait for rescan... mine took 15-20 minutes

# Once 'bitcoin-cli getinfo' returns valid info, run:
$ bitcoin-cli listtransactions "Index Test" 10 0 true

# Result:

[
    {
        "involvesWatchonly" : true,
        "account" : "Index Test",
        "address" : "1CTVqQSSVTjun32gRxmhJHhVYzzXpR894z",
        "category" : "receive",
        "amount" : 3.50000000,
        "vout" : 0,
        "confirmations" : 22539,
        "blockhash" : "00000000000000000548d8ef9a7d14c75b7b18ae5b792d520f44cc5ddd25adfe",
        "blockindex" : 536,
        "blocktime" : 1416848183,
        "txid" : "1db7b0703f441d4cea63a298131f8e766b557329f44c30898847d0fc23573606",
        "walletconflicts" : [
        ],
        "time" : 1452652576,
        "timereceived" : 1453438387
    },
    {
        "involvesWatchonly" : true,
        "account" : "Index Test",
        "address" : "1CTVqQSSVTjun32gRxmhJHhVYzzXpR894z",
        "category" : "receive",
        "amount" : 1.89990000,
        "vout" : 1,
        "confirmations" : 19031,
        "blockhash" : "0000000000000000134345f88fb68550d2102d392be6e1635eaa6fb50c37a2cc",
        "blockindex" : 15,
        "blocktime" : 1418994502,
        "txid" : "4cc761b286c23dab5dd07c260726d79e4baee88778a402e36c82a6b9e6ac757f",
        "walletconflicts" : [
        ],
        "time" : 1452652576,
        "timereceived" : 1453438430
    },
    ...
    snip
    ...
    {
        "involvesWatchonly" : true,
        "account" : "Index Test",
        "address" : "1CTVqQSSVTjun32gRxmhJHhVYzzXpR894z",
        "category" : "receive",
        "amount" : 13.63000000,
        "vout" : 0,
        "confirmations" : 211,
        "blockhash" : "0000000000000000021df02390f30985f34d871e4cc93c4e349cd3b23574bf76",
        "blockindex" : 1,
        "blocktime" : 1430041109,
        "txid" : "64540e42ec96118d11168d954641dd5390f4a46ba795c7b7588d38141e66117a",
        "walletconflicts" : [
        ],
        "time" : 1452652576,
        "timereceived" : 1453438694
    }
]

```

As you can see, the last transaction to show in the output is the one I grabbed from block 353776, with all of the correct details as displayed on blockchain.info, indicating a successful transaction listing for the imported address (account containing the address, actually).

As for why your rescan didn't work when you initially imported the address, I can't really say. Perhaps a more seasoned Bitcoin user could shed some light on that.

At this point, I recommend you stop your Bitcoin daemon and run `bitcoind -rescan` and wait for it to do its magic. Afterwards try your `listtransactions` again. I'm interested in finding out if it works for you.

**Keep in mind** that attempting to import a Bitcoin address that already exists within your wallet will **not** initiate a rescan, even if specified to do so on the command line. --- <https://bitcoin.org/en/developer-reference#importaddress>

> **Comments:**
> **username_0**: `txindex=1` is already the case for me. for example `bitcoin-cli getrawtransaction 0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098` works fine, though i obviously this transaction is not relevant to my personal wallet.  
> **username_0**: also please see the discussion below the question. this solution has already been proposed and did not work.  
> **username_2**: My apologies, I understand your dilemma now.  When you run `bitcoin-cli listaccounts`, is the address you imported displayed in the output?  
> **username_0**: no worries. no it is not. if you could try doing the import and letting me know if you see it in yours that would be very helpful.  
> **username_2**: I have provided an update to my answer. Please let me know if that helps in resolving your issue.  
> **username_0**: looks promising. i'll give it a go...  

---

### Answer by username_3 on 2020-03-19. Score: 0

I also encountered the same problem, I don't know if the landlord has solved this problem. I do the operations in litecoin-cli, but I think they should be implemented in the same way. Do not add any parameters, execute the following command directly.I got the relevant transaction information of the observer address.

```
litecoin-cli listtransactions "" 10 0 true

```

Once I added the address for query, it returned an empty list. I think this may be an implementation bug of listtransactions.

I declare my configuration.

```
txindex = 1
and importaddress $address complete.

```

Hope it could help everyone.


---

