4

How do I extract the storage data of a deployed smart contract? I am trying to read the storage data from the "free Ledger Nano S" contract KT1BRudFZEXLYANgmZTka1xCDN5nWTMWY7SZ from the Tezos Foundation, because I am interested in how it works. The contract code is pretty straight forward. TzScan for example doesn't show the storage data, all it shows is Unit which in this case is not useful. The solution from an old question How to get smart-contract storage data? doesn't work anymore.

2 Answers 2

7

In the command line

./tezos-client get contract storage for KT1BRudFZEXLYANgmZTka1xCDN5nWTMWY7SZ

You could also just call the RPC

curl http://localhost:8732/chains/main/blocks/head/context/contracts/KT1BRudFZEXLYANgmZTka1xCDN5nWTMWY7SZ/storage

1
  • This is of course assuming you are running a node by yourself. But this is what I was looking for. Thx 👍🏻
    – XTZST2O
    Jun 24, 2019 at 12:52
2

Let's find the contract on Arronax and look at its code...

storage unit;
code { CDR ;
       NIL operation ;
       AMOUNT ;
       PUSH mutez 0 ;
       { COMPARE ; EQ ; IF {} { SOURCE ; CONTRACT unit ; { IF_NONE { { UNIT ; FAILWITH } } {} } ; AMOUNT ; UNIT ; TRANSFER_TOKENS ; CONS } } ;
       PAIR }

..you will see that nothing is effectively being stored in the contract, which is why you're just getting Unit.

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.