<p>You are trying to use a mainnet encoded address on testnet. That is not valid. You need to use a testnet encoded address.</p>

<p>The testnet form of the address you are trying to use is <code>2MvX28fMpoipKxqaxo6pN1CH4QjB5t9qpr8</code>.</p>

CC BY-SA 4.0
2019-08-04T16:50:22.240Z
2019-08-04T16:50:22.240Z
Ava Chow
<p>I resolved this.</p>

<p>Here is the functional command: </p>

<pre><code>client.command('scantxoutset', 'start' ['addr(mfe87Qheq7SSveCDedyDUBEjMD9tgzRiU7)']) &lt;!-- Address is valid. This address: '34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo' is invalid
</code></pre>

<p>The issue is that the address was invalid. Using a valid address, I can ensure that this works.</p>

CC BY-SA 4.0
2019-08-04T16:50:57.203Z
2019-08-04T16:50:57.203Z
Michael
<p>when using bitcoin-cli on command line, a syntax that works is</p>
<p><code>scantxoutset start  &quot;[\&quot;addr(37HyJsnuP5zWTuhJFvrGNYojtmBFnZYoFR)\&quot;]&quot;</code></p>

CC BY-SA 4.0
2023-07-17T20:20:39.067Z
Thanks, that looks right and may help some people. At least on my Linux box here, I can also get away without escaping the inner double-quotes by using single-quotes around the scanobjects: `scantxoutset start '["addr(37HyJsnuP5zWTuhJFvrGNYojtmBFnZYoFR)"]'`.
Murch
CC BY-SA 4.0
2023-07-22T11:36:39.070Z
Uh, thanks for downvoting but I jsut tried your answer and it didn't work, whereas my answer does work Murch. Your answer gives the error: `error: Error parsing JSON: '[addr(37HyJsnuP5zWTuhJFvrGNYojtmBFnZYoFR)]'`
Captain Fantastic
CC BY-SA 4.0
2023-07-22T11:37:22.220Z
Murch, maybe go on strike like your name suggests because your downvote is downright WRONG
Captain Fantastic
CC BY-SA 4.0
2023-07-22T13:04:20.493Z
I was in fact not one of the users that downvoted your answer, but the one that upvoted it, because it looked right to me… I was merely suggesting another avenue that may work without the escaping (which appears in the rpc doc, and works on my machine). For what it’s worth, the input requirements on RPC commands are pretty confusing. Either way, I think people are downvoting this answer because it’s attacking people instead of ideas, not because it’s incorrect.
Murch
CC BY-SA 4.0
2023-09-22T22:24:05.453Z
Well thanks for upvoting the only answer that worked for me. Yes people don't want to know ideas, they want a belief in authority so they don't have to think.. anyway for anyone that wants an answer that works, there it is.  just had to use this again yesterday.. even chatGPT gives a bunch of wrong answers
Captain Fantastic
CC BY-SA 4.0
2023-09-22T23:13:56.523Z
I guess I Alex Jones'd the truth..  post real truth and then insult people or say it in a nasty way, and people will downvote it. This is great.. great way to cover up real answers, but that wasn't my goal. my goal was to help real programmers, not snowflake posers.
Captain Fantastic
CC BY-SA 4.0
2023-09-26T14:46:25.353Z
Thank you for posting the answer that worked for you. You could improve your answer post by mentioning _in your answer post_ what shell or operating system you were using when you found that the syntax proposed in the RPC docs does not work for you, so that other users that encounter the same problem would more easily find your answer or someone could amend the RPC docs.—We expect users on our platform to [be nice](https://bitcoin.stackexchange.com/conduct). If you feel that posts are improved by gratuitous insults, another platform may be a better fit.
Murch
CC BY-SA 4.0
2023-10-28T16:11:53.127Z
@Murch does the same thing on Linux, Mac OS, and Windows 10, including Ubuntu Linux, and some other variants.  I think what is key is the version of the Bitcoin node you are running.  As for being nice, you are not being nice by saying I am not being nice. We expect users to provide answers to questions, be those answers distasteful or not, anyone could be offended by anything these days, but if you get the correct answer that works, that's why WE use this website, not because we are easily offended. If you are easily offended and will downvote a correct answer because of it, go somewhere else
Captain Fantastic
CC BY-SA 4.0
2023-10-28T16:15:11.357Z
Murch if you are going to censor answers based on your distaste of how they are presented or who says them, there is already a website for that, it is called Wikipedia
Captain Fantastic
CC BY-SA 4.0
2023-10-28T19:54:59.787Z
I've already explained the rules of our site to you.
Murch
CC BY-SA 4.0
2023-07-17T13:45:27.557Z
2023-07-25T13:15:54.713Z
2023-07-25T13:15:54.713Z
Captain Fantastic
<p>Looking to fetch the UTXOs for a given address and can't seem to find the correct command syntax.</p>

<p>Here is an implementation in bitcoin-core via javascript, but I also experience the same on bitcoin-cli</p>

<pre><code>const descriptorAttempts = [
    '{ desc: addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo) }', 
    '{ "desc": "addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)" }', 
    '"desc": "addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)"', 
    "addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)", 
    "addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)", 
    "addr=34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo", 
    "34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo", 
    "{ addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo) }", 
    "{ addr: 34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo }",
    "{\"desc\": \"addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)\"}",
    '\"{\"desc": \"addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)\"}\"',
    '"{"desc": "addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)"}"',
    '"{"desc": "addr("34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo")"}"',
    '\"{\"desc": \"addr(\"34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo\")\"}\"',
    '"desc" =&gt; "addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)"',
    '[ "desc" =&gt; "addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)" ]',
    { "desc" : "addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)" },
    { desc : "addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)" }
]

descriptorAttempts.forEach(attempt =&gt; {
    client.command('scantxoutset', 'start', [ attempt ])
    .then((res) =&gt; {
        console.log("Success! ")
        console.log(res)
    })
    .catch((error) =&gt; {
        console.log("Failed attempt of -&gt; " + attempt)
        // console.log(error)
    })
})
</code></pre>

<p>All result in <code>RpcError: Invalid descriptor</code></p>

CC BY-SA 4.0
2019-08-04T04:26:56.900Z
Does `client.command('scantxoutset', 'start', [[ "desc" => "addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)" ]])` work?
Pieter Wuille
CC BY-SA 4.0
2019-08-04T04:36:22.793Z
@PieterWuille it does not :`( As you have written there would be invalid syntax as well. Updated post to include those attempts
Michael
CC BY-SA 4.0
2019-08-04T05:35:05.243Z
Oh, this is JS. Then it should be `command('scantxoutset', 'start', [{"desc":"addr(...)"}])`.
Pieter Wuille
CC BY-SA 4.0
2019-08-04T15:55:39.780Z
@PieterWuille tried a couple variations of that with not luck as well. Question is updated to include them
Michael
CC BY-SA 4.0
2019-08-04T16:42:04.540Z
Are you on mainnet or testnet?
Ava Chow
CC BY-SA 4.0
2019-08-04T16:47:37.270Z
testnet @AndrewChow
Michael
<address><json-rpc><testnet><javascript><scantxoutset>
How to use `scantxoutset`
Michael
# How to use `scantxoutset`

(Asked by: username_0 on 2019-08-04)

Looking to fetch the UTXOs for a given address and can't seem to find the correct command syntax.

Here is an implementation in bitcoin-core via javascript, but I also experience the same on bitcoin-cli

```
const descriptorAttempts = [
    '{ desc: addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo) }', 
    '{ "desc": "addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)" }', 
    '"desc": "addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)"', 
    "addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)", 
    "addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)", 
    "addr=34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo", 
    "34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo", 
    "{ addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo) }", 
    "{ addr: 34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo }",
    "{\"desc\": \"addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)\"}",
    '\"{\"desc": \"addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)\"}\"',
    '"{"desc": "addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)"}"',
    '"{"desc": "addr("34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo")"}"',
    '\"{\"desc": \"addr(\"34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo\")\"}\"',
    '"desc" => "addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)"',
    '[ "desc" => "addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)" ]',
    { "desc" : "addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)" },
    { desc : "addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)" }
]

descriptorAttempts.forEach(attempt => {
    client.command('scantxoutset', 'start', [ attempt ])
    .then((res) => {
        console.log("Success! ")
        console.log(res)
    })
    .catch((error) => {
        console.log("Failed attempt of -> " + attempt)
        // console.log(error)
    })
})

```

All result in `RpcError: Invalid descriptor`

**Tags:** address, json-rpc, testnet, javascript, scantxoutset

> **Comments:**
> **username_1**: Does `client.command('scantxoutset', 'start', [[ "desc" => "addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)" ]])` work?  
> **username_0**: @username_1 it does not :`( As you have written there would be invalid syntax as well. Updated post to include those attempts  
> **username_1**: Oh, this is JS. Then it should be `command('scantxoutset', 'start', [{"desc":"addr(...)"}])`.  
> **username_0**: @username_1 tried a couple variations of that with not luck as well. Question is updated to include them  
> **username_2**: Are you on mainnet or testnet?  
> **username_0**: testnet @AndrewChow  

---

## 3 answers

### Answer by username_2 on 2019-08-04. Score: 4

You are trying to use a mainnet encoded address on testnet. That is not valid. You need to use a testnet encoded address.

The testnet form of the address you are trying to use is `2MvX28fMpoipKxqaxo6pN1CH4QjB5t9qpr8`.


---

### Answer by username_0 on 2019-08-04. Score: 3

I resolved this.

Here is the functional command:

```
client.command('scantxoutset', 'start' ['addr(mfe87Qheq7SSveCDedyDUBEjMD9tgzRiU7)']) <!-- Address is valid. This address: '34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo' is invalid

```

The issue is that the address was invalid. Using a valid address, I can ensure that this works.


---

### Answer by username_3 on 2023-07-17. Score: -1

when using bitcoin-cli on command line, a syntax that works is

`scantxoutset start "[\"addr(37HyJsnuP5zWTuhJFvrGNYojtmBFnZYoFR)\"]"`

> **Comments:**
> **username_4**: Thanks, that looks right and may help some people. At least on my Linux box here, I can also get away without escaping the inner double-quotes by using single-quotes around the scanobjects: `scantxoutset start '["addr(37HyJsnuP5zWTuhJFvrGNYojtmBFnZYoFR)"]'`.  
> **username_3**: Uh, thanks for downvoting but I jsut tried your answer and it didn't work, whereas my answer does work username_4. Your answer gives the error: `error: Error parsing JSON: '[addr(37HyJsnuP5zWTuhJFvrGNYojtmBFnZYoFR)]'`  
> **username_3**: username_4, maybe go on strike like your name suggests because your downvote is downright WRONG  
> **username_4**: I was in fact not one of the users that downvoted your answer, but the one that upvoted it, because it looked right to me… I was merely suggesting another avenue that may work without the escaping (which appears in the rpc doc, and works on my machine). For what it’s worth, the input requirements on RPC commands are pretty confusing. Either way, I think people are downvoting this answer because it’s attacking people instead of ideas, not because it’s incorrect.  
> **username_3**: Well thanks for upvoting the only answer that worked for me. Yes people don't want to know ideas, they want a belief in authority so they don't have to think.. anyway for anyone that wants an answer that works, there it is.  just had to use this again yesterday.. even chatGPT gives a bunch of wrong answers  
> **username_3**: I guess I Alex Jones'd the truth..  post real truth and then insult people or say it in a nasty way, and people will downvote it. This is great.. great way to cover up real answers, but that wasn't my goal. my goal was to help real programmers, not snowflake posers.  
> **username_4**: Thank you for posting the answer that worked for you. You could improve your answer post by mentioning _in your answer post_ what shell or operating system you were using when you found that the syntax proposed in the RPC docs does not work for you, so that other users that encounter the same problem would more easily find your answer or someone could amend the RPC docs.—We expect users on our platform to [be nice](https://bitcoin.stackexchange.com/conduct). If you feel that posts are improved by gratuitous insults, another platform may be a better fit.  
> **username_3**: @username_4 does the same thing on Linux, Mac OS, and Windows 10, including Ubuntu Linux, and some other variants.  I think what is key is the version of the Bitcoin node you are running.  As for being nice, you are not being nice by saying I am not being nice. We expect users to provide answers to questions, be those answers distasteful or not, anyone could be offended by anything these days, but if you get the correct answer that works, that's why WE use this website, not because we are easily offended. If you are easily offended and will downvote a correct answer because of it, go somewhere else  
> **username_3**: username_4 if you are going to censor answers based on your distaste of how they are presented or who says them, there is already a website for that, it is called Wikipedia  
> **username_4**: I've already explained the rules of our site to you.  

---

