I am developing an app that uses Ethereum as its payment method, and in the app, users will have their own balances. But there is a slight problem and it has to do with fees.
If a user deposits funds, he is obviously paying a fee to send the money. And that is understandable
Now in my app, users will be able to give their friends funds as well. HERE is where the problem arises.
If a wallet is created for each new client, not only is there a fee when they first deposit money, but they would be charged money every time they gave someone else money.
POSSIBLE SOLUTION:
I then thought of making it so that each user deposites into the same Ethereum wallet, and then have a separate database that registers how much of that total balance is of each user. So that makes it possible for having balances shifting in the database without it actually shifting in the Ethereum blockchain, until a user wants to withdraw.
ISSUE WITH THE SOLUTION:
How would I know which user sent the money? It is possible for a user to first specify which account they are sending the money from and then sending, but I see holes here for security reasons. For instance, what if a bad person knows the persons Ethereum address and pretends he is sending the funds and gets the funds credited to his account.
There was also the option of using the data variable in the transactionObject
in the code:
web3.eth.sendTransaction(transactionObject, myCallbackFunction);
And in this option, if the data
variable was a code that was randomly generated, it would make it easy to track what is happening. HOWEVER not all ethereum wallets online give the option of using that data
variable during a transaction, and this might limit the amount of potential clients that can use my app.
QUESTION:
How might I go about fixing the previous issue of finding the right way to store user balances? I am not sure if there is another way of getting this done and if someone has a solution please let me know.