input-output-hk/cardano-documentation

cardano-cli Error querying utxo by txId

acyuta108 opened this issue · 2 comments

Following instructions from https://docs.cardano.org/native-tokens/getting-started

Using --address works.

% cardano-cli query utxo --mainnet --address addr1qxxwkrsw3y5j5p5gm6qfc2m8tc3g6gjl2ppeukpmkrceq9nk2p4eyt7frkz70dwtj040wfyemjyrycrpwh06aece7xzqjn0m7t

Response:

                           TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
97a1b830a12510fc20bc2b778a9e0f54747c91e9d5660a1dd4c40c39c435cd5b     0        4641718 lovelace + 1 34fabf5a4e43d04d25dc1476c4b1aeb88e28d853b98b8bcd7577bd20.ZEN1

But when I use the TxHash#TxIX I get this error

% cardano-cli query utxo --mainnet --tx-in 97a1b830a12510fc20bc2b778a9e0f54747c91e9d5660a1dd4c40c39c435cd5b#0

Response:

cardano-cli: ShelleyEncoderUnsupportedQuery (SomeSecond (GetUTxOByTxIn (fromList [TxInCompact (TxId {_unTxId = SafeHash "97a1b830a12510fc20bc2b778a9e0f54747c91e9d5660a1dd4c40c39c435cd5b"}) 0]))) ShelleyNodeToClientVersion3%  

I am using the Daedalus wallet node $ export CARDANO_NODE_SOCKET_PATH="~/Library/Application Support/Daedalus Mainnet/cardano-node.socket

DAEDALUS 4.2.0
macOS build 18540, Cardano Node 1.27.0, Cardano Wallet 2021.6.11

Quick search through the repos revealed that this error is a query version mismatch and comes from here:

https://github.com/input-output-hk/ouroboros-network/blob/36cb0b9703b06b7524f9639542ce0aaab3901200/ouroboros-consensus-shelley/src/Ouroboros/Consensus/Shelley/Node/Serialisation.hs#L159

The error says that the query GetUTxOByTxIn is only supported for a version at least ShelleyNodeToClientVersion4:

https://github.com/input-output-hk/ouroboros-network/blob/b749bc878bb05478f924d6e2d4970d1bdaef94ef/ouroboros-consensus-shelley/src/Ouroboros/Consensus/Shelley/Ledger/Query.hs#L395

The query GetUTxOByTxIn (--tx-in) was added on June 18th, which was a month after the Cardano Node 1.27.0 release. So it seems cardano-cli might be newer than the cardano-node.

I suspect an upgrade to cardano-node-1.18.0 will fix this issue.

Thank you @lehins for your feedback!
@acyuta108 we hope you find it helpful! Closing this issue for now.
You can also raise issues in the cardano-node repository, please see here: https://github.com/input-output-hk/cardano-node