Actually, I am looking to create a contract in which a variable can be set and later on can be retrieved. All the contracts available there involves struct
and multi index table.
In EOS, is it possible to write a smart contract without using multi-index
table and struct
?
-
You could delegate the storage of your state to a different contract. Does that count?– friedgerCommented Sep 25, 2018 at 16:31
-
That is another thing, I am looking to know something else.– A.K.Commented Sep 26, 2018 at 5:28
2 Answers
As i know you cannot do that because multi-indexed tables are made to store all states and data,a variable will not store that.Because during transaction it stores only transaction data not your variable state that you might have seen in ethereum blockchain because ethereum have that structure that you can store state in transaction and eos have different structure that cannot used to store data in transaction.
The closest thing I can think of is a singleton.
This answer explains how to use it well: https://eosio.stackexchange.com/a/1670/959
-
In the shared answer, logic is almost fine but they too are using struct and multi-index. I am looking to know the limitations of smart contract development in EOS.– A.K.Commented Sep 25, 2018 at 10:56