<p>You can use <code>cardano-cli query utxo --address &lt;ADDRESS&gt; --mainnet</code> to check all UTXO's sitting at <code>ADDRESS</code>. ADA balances and policy/asset IDs will be output to STDOUT in the command line.</p>

CC BY-SA 4.0
2022-05-11T23:33:01.803Z
`cardano-cli: Network.Socket.connect: <socket: 11>: does not exist (Connection refused)% ` This is what it says when I do it in a terminal on a fresh start.

If I start cardano-node in another terminal it outputs : `Command failed: query utxo  Error: This query cannot be used for the Byron era
`

I'm using this address: `addr1q9klhtnsdqfmpfcdwxt426s2m489alzj8p55z8lq5p9a8e6uqudkzzl0x4pq0q79tx9ghxgcfkjtkugcx7qs0j445fpseuuu33`

I run cardano-node with the following command:
`sudo docker run -e NETWORK=mainnet -v cardano-node-ipc:/ipc -v cardano-node-data:/data inputoutput/cardano-node`
KatsuroDev
CC BY-SA 4.0
2022-05-11T23:48:39.133Z
Run `cardano-cli query tip --mainnet` and please comment whatever the terminal outputs. If you get an error, comment the error.
zhekson
CC BY-SA 4.0
2022-05-12T00:04:04.803Z
`{
    "era": "Byron",
    "syncProgress": "32.67",
    "hash": "7149c856efa86edf5c8059fdf27fb81e2c77d53e62b2ad3357e3678566615a8f",
    "epoch": 110,
    "slot": 2386495,
    "block": 2384996
}
`

Thanks for your help by the way! Appreciate it
KatsuroDev
CC BY-SA 4.0
2022-05-12T00:55:08.963Z
Your node is still syncing, and it is in the Byron era. In Byron there were no shelley-format addresses (ones that begin with `addr1`), so you can't query them because they don't yet exist in your local copy of the chain. Wait till the node is fully synced and then try the `query utxo` command again.
zhekson
CC BY-SA 4.0
2022-05-13T03:08:58.637Z
Thanks that worked! Now I'm getting this: `query utxo --address addr1q9klhtnsdqfmpfcdwxt426s2m489alzj8p55z8lq5p9a8e6uqudkzzl0x4pq0q79tx9ghxgcfkjtkugcx7qs0j445fpseuuu33 --mainnet
                           TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
`
Am I doing something wrong? I know the address has something, I've checked on pool.pm
KatsuroDev
CC BY-SA 4.0
2022-05-13T12:14:40.563Z
I'd recommend understanding how Hierarchical Deterministic (HD) wallets work in Cardano. Originally introduced in BIP-32, HD wallets allow for a virtually infinite number of addresses to be created from a single wallet/account. Cardano wallet software like Daedalus/Yoroi automatically link these addresses with a single stake key, which is what pool.pm queries. Check the UTXO distribution of your wallet here: https://cardanoscan.io/address/016dfbae706813b0a70d7197556a0add4e5efc523869411fe0a04bd3e75c071b610bef35420783c5598a8b99184da4bb7118378107cab5a243
zhekson
CC BY-SA 4.0
2022-05-14T05:24:10.497Z
So how do I do to link these addresses? I'm very confused.
With a single stake key I should be able to query one's wallets?
Why would that specific wallet be empty?
KatsuroDev
CC BY-SA 4.0
2022-05-14T12:52:14.313Z
The address you are querying in your example is *one* of the addresses in your wallet that was used at some point in the past. Now, that address is empty (no UTXOs in that address), but other addresses in your wallet (all linked to the same stake key) or not empty. When you use wallet software like `cardabno-wallet` or Daedalus to send assets, it automatically selects non-empty addresses for you, but when you query them manually with `cardano-cli`, you must do so for each individual address.
zhekson
CC BY-SA 4.0
2022-05-14T19:34:34.703Z
How can I get all the adresses from a stake key then?
KatsuroDev
CC BY-SA 4.0
2022-05-14T19:36:08.783Z
Also, can assets with the same policy id be spread into different wallet addresses within the same stake key?
KatsuroDev
CC BY-SA 4.0
2022-05-14T19:49:04.087Z
I'd recommend refining your understanding of how addresses and wallets work in Cardano using this resource: https://input-output-hk.github.io/cardano-wallet/concepts

Start with "Key Concepts", and use other sections as needed. After working through these docs you should have a better understanding of how things work and what/how can be done. Lmk if you have questions
zhekson
CC BY-SA 4.0
2022-05-26T20:19:40.883Z
I have read Key Concepts, and some article about Stake key and Stakes/Stake holders. I'm still very confused with the Stake concept.

For context, what I wanna do is to be able to query something that a user give me, to get all the asset of one policy id from that.
So what should the user give me to query, and how should I query that? Should he give me a Stake key of some kind?
KatsuroDev
CC BY-SA 4.0
2022-05-10T22:05:41.367Z
2022-05-10T22:05:41.367Z
zhekson
<p>So as the title says, I really need some help to query all the assets from a wallet address with the help of the cardano-cli.</p>
<p>So far I've got the cardano-node running with docker.</p>

<cardano-cli><wallet><cardano-node><nft>
Query assets with cardano-cli
# Query assets with cardano-cli

(Asked by: username_0 on 2022-05-10)

So as the title says, I really need some help to query all the assets from a wallet address with the help of the cardano-cli.

So far I've got the cardano-node running with docker.

**Tags:** cardano-cli, wallet, cardano-node, nft

---

## 1 answers

### Answer by username_1 on 2022-05-10. Score: 1

You can use `cardano-cli query utxo --address  --mainnet` to check all UTXO's sitting at `ADDRESS`. ADA balances and policy/asset IDs will be output to STDOUT in the command line.

> **Comments:**
> **username_0**: `cardano-cli: Network.Socket.connect: <socket: 11>: does not exist (Connection refused)% ` This is what it says when I do it in a terminal on a fresh start.  If I start cardano-node in another terminal it outputs : `Command failed: query utxo  Error: This query cannot be used for the Byron era `  I'm using this address: `addr1q9klhtnsdqfmpfcdwxt426s2m489alzj8p55z8lq5p9a8e6uqudkzzl0x4pq0q79tx9ghxgcfkjtkugcx7qs0j445fpseuuu33`  I run cardano-node with the following command: `sudo docker run -e NETWORK=mainnet -v cardano-node-ipc:/ipc -v cardano-node-data:/data inputoutput/cardano-node`  
> **username_1**: Run `cardano-cli query tip --mainnet` and please comment whatever the terminal outputs. If you get an error, comment the error.  
> **username_0**: `{     "era": "Byron",     "syncProgress": "32.67",     "hash": "7149c856efa86edf5c8059fdf27fb81e2c77d53e62b2ad3357e3678566615a8f",     "epoch": 110,     "slot": 2386495,     "block": 2384996 } `  Thanks for your help by the way! Appreciate it  
> **username_1**: Your node is still syncing, and it is in the Byron era. In Byron there were no shelley-format addresses (ones that begin with `addr1`), so you can't query them because they don't yet exist in your local copy of the chain. Wait till the node is fully synced and then try the `query utxo` command again.  
> **username_0**: Thanks that worked! Now I'm getting this: `query utxo --address addr1q9klhtnsdqfmpfcdwxt426s2m489alzj8p55z8lq5p9a8e6uqudkzzl0x4pq0q79tx9ghxgcfkjtkugcx7qs0j445fpseuuu33 --mainnet                            TxHash                                 TxIx        Amount -------------------------------------------------------------------------------------- ` Am I doing something wrong? I know the address has something, I've checked on pool.pm  
> **username_1**: I'd recommend understanding how Hierarchical Deterministic (HD) wallets work in Cardano. Originally introduced in BIP-32, HD wallets allow for a virtually infinite number of addresses to be created from a single wallet/account. Cardano wallet software like Daedalus/Yoroi automatically link these addresses with a single stake key, which is what pool.pm queries. Check the UTXO distribution of your wallet here: https://cardanoscan.io/address/016dfbae706813b0a70d7197556a0add4e5efc523869411fe0a04bd3e75c071b610bef35420783c5598a8b99184da4bb7118378107cab5a243  
> **username_0**: So how do I do to link these addresses? I'm very confused. With a single stake key I should be able to query one's wallets? Why would that specific wallet be empty?  
> **username_1**: The address you are querying in your example is *one* of the addresses in your wallet that was used at some point in the past. Now, that address is empty (no UTXOs in that address), but other addresses in your wallet (all linked to the same stake key) or not empty. When you use wallet software like `cardabno-wallet` or Daedalus to send assets, it automatically selects non-empty addresses for you, but when you query them manually with `cardano-cli`, you must do so for each individual address.  
> **username_0**: How can I get all the adresses from a stake key then?  
> **username_0**: Also, can assets with the same policy id be spread into different wallet addresses within the same stake key?  
> **username_1**: I'd recommend refining your understanding of how addresses and wallets work in Cardano using this resource: https://input-output-hk.github.io/cardano-wallet/concepts  Start with "Key Concepts", and use other sections as needed. After working through these docs you should have a better understanding of how things work and what/how can be done. Lmk if you have questions  
> **username_0**: I have read Key Concepts, and some article about Stake key and Stakes/Stake holders. I'm still very confused with the Stake concept.  For context, what I wanna do is to be able to query something that a user give me, to get all the asset of one policy id from that. So what should the user give me to query, and how should I query that? Should he give me a Stake key of some kind?  

---

