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
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
-
This is of course assuming you are running a node by yourself. But this is what I was looking for. Thx 👍🏻– XTZST2OJun 24, 2019 at 12:52
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
.