Can we add the permission to access the table?

Can we add the permission to access the table?



I know how to declare ,initialize and get,set values in a table .My question is Can we add permission to access the table to a particular user inside our smart contract ?





tables are open to read for anyone without even needing a blockchain account. i think the closest you can do is encrypt data in a table with someone's public key so they can read it only if they have the secret key
– confused00
Aug 27 at 12:15




1 Answer
1



You can not forbid reading the data from a smart contracts table, because it is exposed by the RPC interface or CLI.



What you can do to prevent understanding it by 3rd parties, is encrypt your data like @confused00 said.



If you just want to limit access for adding, modyfing or deleting, you can use the scopes of the multi_index and the require_auth method, which will check for the right signatures. This would look something like this:


require_auth(user);
testIndex1 test1(_self, user); // code, scope
// iterate over first index
for(auto itr = test1.begin(); itr != test1.end() && count!=pLimit;)
// delete element and update iterator reference
itr = test1.erase(itr);
count++;






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)