0

Hitting the chain index endpoint to query utxo just gives Bad Request as response. Tried this on testnet where txOutRefId is the tx hash of a testnet transaction. Screenshot is attached.

curl -X 'POST' \
  'http://localhost:9083/unspent-tx-out' \
  -H 'accept: application/json;charset=utf-8' \
  -H 'Content-Type: application/json;charset=utf-8' \
  -d '{
  "txOutRefId": "32178b5f5af6c2ac963adef07284f35cb7a86ff1cdd18e119007631607a28b84",
  "txOutRefIdx": 0
}'

enter image description here

Unable to figure out what I am doing wrong here. Has anyone been able to use this endpoint?

Note: Chain index is synced and /tip endpoint works.

Update: This seems to be required format for the endpoint

curl -X 'POST' \
  'http://localhost:9083/unspent-tx-out' \
  -H 'accept: application/json;charset=utf-8' \
  -H 'Content-Type: application/json;charset=utf-8' \
  -d '{
  "txOutRefId": {"getTxId":"3961a841f5af32d3878cd816a23c9da7b3c3bb586e3b3db5fba1579bd1408a20"},
  "txOutRefIdx": 0
}'

Howeve my chain-index responded with this

Delete your chain index database and resync.
CallStack (from HasCallStack):
  error, called at src/Plutus/ChainIndex/DbSchema.hs:232:22 in plutus-chain-index-core-0.1.0.0-inplace:Plutus.ChainIndex.DbSchema

Beats me why it asks for a resync. Resyncing chain index will take days, so I have not gone ahead to try that :)

2
  • 1
    What error does curl return when run in the terminal?
    – waalge
    May 21, 2022 at 8:29
  • @waalge: Thanks for that comment. Terminal gives. Error in $.txOutRefId: parsing Plutus.V1.Ledger.TxId.TxId(TxId) failed, expected Object, but encountered String Seems it expects the TxId object defined in Plutus as TxId { getTxId :: PlutusTx.BuiltinByteString }. Will try it out
    – lambda
    May 21, 2022 at 8:44

1 Answer 1

0

how to query the chain index tx endpoint?

I think you are probably still seeing this. This happens on a number of the apis. Shame swagger doesn't return the actual error. It would save some time.

2
  • I changed the object in the payload and got a response, not the one I expected though. I have added the info as updates to the question.
    – lambda
    May 22, 2022 at 2:07
  • the chain-index is such a headache that I gave up. Bon courage.
    – waalge
    May 22, 2022 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.