0

Can I add a trigger to smart contract to insert/update data to my traditional DB. E.g. Let's say I have students private blockchain where each student has to update their info. Once they insert/update it, I am maintaining a database with all the current information as I do not want to change my legacy app that is built on traditional DB. I understand that every time the students update their info, it will cost the ether and I am ready for that. In other words, can I have callbacks once a method gets executed on smart contract so I can continue performing actions from my server.

Rob Hitchens
  • 55,151
  • 11
  • 89
  • 145
Ujjwal Vaish
  • 115
  • 4

1 Answers1

2

A smart contract directly cannot perform action which have a scope outside of the EVM. If this wasn't the case, the contract will be prone to nondeterministic gas usage.

A possible solution is to create a server to watch changes on the chain and perform the corresponding action on the database to keep it in sync.

This might help you: How can an Ethereum contract get data from a website?

user280930
  • 46
  • 4