0

How can I get human-readable contract storage data with tezos-node?

If I run a command like curl -s http://localhost:8732/chains/main/blocks/head/context/contracts/KT1BGQR7t4izzKZ7eRodKWTodAsM23P38v7N/storage | jq then I'll get something back like:

{
  "prim": "Pair",
  "args": [
    {
      "int": "541"
    },
    {
      "prim": "Pair",
      "args": [
        {
          "prim": "False"
        },
        {
          "prim": "False"
        },
        {
          "int": "2053016532"
        }
      ]
    },
    {
      "prim": "Pair",
      "args": [
        {
          "string": "KT1B5VTw8ZSMnrjhy337CEvAm4tnT8Gu8Geu"
        },
        {
          "string": "KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn"
        }
      ]
    },
    {
      "int": "21326637"
    },
    {
      "int": "1535368503"
    }
  ]
}

Unfortunately, none of these fields are labeled with human-readable names.

However, if you look at this contract on TzKT, TzKT has somehow inferred human-readable names for all the fields. Taquito is also able to infer human-readable names. Is there some way to do the same using tezos-node?

Thanks!

1 Answer 1

1

If you like the way tzkt displays the storage of contracts, you should probably use their API instead of trying to get the information from a node.

If you want to redo the same work, the human-readable names used for the fields very probably come from the field annotations in the type of the storage. To get this type you can do curl -s http://localhost:8732/chains/main/blocks/head/context/contracts/KT1BGQR7t4izzKZ7eRodKWTodAsM23P38v7N/ | jq .script.code[1].args.

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.