Meaning of scope
You can just make up a scope as you go along. As a general rule there are 3 ways to use the scope:
Globally - all table entries are kept in one scope (usually with the name of the contract)
cleos get table censuscensus global population
Groups - All table entries that are similar in some way share the same scope
cleos get table censuscensus male population
Individual - Each entry has its own scope (usually used to obfuscate or have quick access)
cleos get table censuscensus phillhamnett population
Seeing all table rows
To see all table rows, just add -l -1
(minus el, minus one) somewhere after get table
.
Within smart contract
Lets say you have a typedef set up in a smart contract for a multi_index
array.
typedef eosio::multi_index< eosio::name("censuscensus"), struct_for_table_goes_here > census_table;
You can set a scope when you initialize the census_table
:
census_table global_table(get_self(), eosio::name("global").value);
census_table male_table(get_self(), eosio::name("male").value);
census_table individual_table(get_self(), eosio::name("phillhamnett").value);
You don't need to do anything else to start using the table with the scope other than initialize it as shown above
cleos --wallet-url http://wallet:5555 -u http://server:7777 get table mynewaccount mynewaccount todos