Ethtags: Major smart contract updates
Repository
https://github.com/jtomes123/ethtags
New feature
- Persistent data storage on contract updates
What are the changes
Originally there was only one contract that handled the whole logic and data of ethtags. This is rather undesirable, so I reimplemented the smart contract to be split into two one rather simple contract that stores data and the main contract that handles all the logic.
Why was this change neccessary
This change had to be implemented before ethtags moved to the mainnet in order to prevent an incident where there would be an error in the smart contract and no way to fix it, because smart contracts can not be updated. Splitting the smart contract into two effectively solves this issue because there is one simple contract, that stores the data and will not be updated and then there is a contract which handle the logic and communication with the frontend.
How was is implemented
I studied ways of creating persistent storage and I really liked an infosphere. I thought about just using a production ready solution from the internet, but in the end I decided to code it myself and make it custom tailored for ethtags.
Features of my implementation are
- Public get functions
- Set functions accessible only by the author and the newest version of the main contract
- Only data types that are needed are implemented
There are not really any screenshots, but you can go through the code here
Bugfixes and improvements
I have migrated to modifiers in the main contract, this change streamlined the code a little, and I added comments to the whole code.
Thanks for the contribution. It has been approved.
Could it be a security problem to have the contract address coded in the front end instead of the backend?
Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]
I thought that was the case too at first, however it has to be like that. The user always comunicates with the smart contract. The frontend serves as a UI of sorts, you could use the contract only with a command line tool, I think it was called geth. It is secure because the contract handles the data based on senders address which as far as I know can not be couterfeited.
Hey @jtomes123
We're already looking forward to your next contribution!
Contributing on Utopian
Learn how to contribute on our website or by watching this tutorial on Youtube.
Utopian Witness!
Vote for Utopian Witness! We are made of developers, system administrators, entrepreneurs, artists, content creators, thinkers. We embrace every nationality, mindset and belief.
Want to chat? Join us on Discord https://discord.gg/h52nFrV