1

So we are using an ethereum smart contract to store investor balances and also storing their balances in local portfolio tables. What would be the right approach to sync in a balance between ethereum smart contract and local db.

What I have in mind right now is to modify local db balance when making transaction call but then again if for some reason tx fails on smart contract level, it would create a discrepancy.

What would be the correct approach of doing this especially in production level ?

2
  • Just poll the blockchain periodically and update the balances. Do so with a resolution which satisfies your DB-accuracy requirements. Keep in mind that the transactions which you are aware of are not necessarily the only transactions which change those balances. Jun 8, 2020 at 14:54
  • What do you mean by "transactions which you are aware of are not necessarily the only transactions which change those balances" ? Can you give any examples for that ? Jun 8, 2020 at 15:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.