# How to list all tables I have on main-net account, and how do I see the table keys?

I am struggling with listing all tables that exist on my account, as well as listing all the keys that I got in each table.

What would be the cleos command ? Should I need to publish a contract, which one, and what would be the cleos command to execute it ?

• Tables belong to a particular contract. A contract belongs to an account. Please clarify what you are looking for? As an end user, you can't find which contracts your user account is using/has data in the contract's table. – friedger Jul 15 '18 at 9:01
• OK then I didn't understand the architecture. I am deploying a contract and over-writing old contracts I deploy. Does it mean that tables are gone each time I over-write a contract? I don't think that is the case, so what piece of knowledge am I missing here ? -Lets say I can't find the contracts ... – Damir Olejar Jul 15 '18 at 12:07
• Tables are kept when you update your code. Your contract is associated to one account name. There is no need to look for contracts. You can just call 'cleos set contract mycontractaccount contractdirectory to deploy your contract. Inspect the code in your contractdirectory. If you can't find your source code anymore you need to decompile the code (web asembly) that was pushed to the network. Inspect the history of the contract's account to find the set contract actions. If you want that please clarify the question. – friedger Jul 15 '18 at 12:26
• You said, tables are kept when I update the code. My understanding is that table is a structure such as the ones you got in SQL. All I want to do is to see those tables, the same way you would type "show tables" in SQL. You are saying that in order to do that, I need to decompile the code... If that is the way, I will edit the question. Thanks! – Damir Olejar Jul 15 '18 at 12:41

Updated solution with cleos

Just use

cleos get code contractaccount -a contract.abi


and inspect the abi file. It gives you all structs that define the tables of your contract.

Old solution

1. Inspect the history of the account of the contract and find the last deployment of your contract eosio::setabi`. Take the binary abi from that action. see for example the abi at https://eosweb.net/transaction/7bc7db4b7872dadcc1466b5ca5e8b580368c62d5e7c3882ac65d4602a511a8cb
2. Convert from binary format to human readable code
3. Inspect the structs in the abi. These define your tables.
• I think I will need something more than looking into history on web given the automated trading I did with RAM to find a contract I need... but thanks. This is the high-level answer to what I asked. – Damir Olejar Jul 15 '18 at 12:54
• It is much simpler: cleos get code accountname -a contract.abi – friedger Jul 15 '18 at 12:55
• Thanks, I got the .abi file and the code hash. I was expecting to see something more, like primary keys as numbers for each transaction I did using the contract... although I am a bit confused since I have published many contracts under the same name, just different code. EDIT: OK I got it now, .abi is a model :) thanks again for your help ! – Damir Olejar Jul 15 '18 at 13:03