I am trying to implement Role based access control mechanism using block chain. My model consists of two tables(user assignment and role assignment) which contains 500 entries each.So, I can't enter the entries in table manually. After storing these tables, my smart contract would be able to allow or deny the access of user request. So, how could I store and read these tables? I hope someone helps! Thank you in advance.
1 Answer
If you can't enter enough data in one transaction (due to gas limits) you can split it into multiple transactions.
So just implement a function which adds "rows" (or whatever kind of entries) into the tables, maybe 10 or 100 at a time. Then you can call your function as much as needed until the tables are "full".
If by reading you mean reading the data for the smart contract's usage, you can just access the data directly. If you mean external access (through a node), you can just ask for the data from your node and you will get it without any gas costs as it's a read-only operation. You don't most likely even need a separate explicit function for it as all public variables generate a getter function automatically.