Ask A Question
You’re not receiving notifications from this thread.
How to deposit, withdraw, transfer coins...
Benny Maas asked in Rails
I want to create an app where I can keep track of my cryptocurrencies.
This is what I have right now:
- Coins (can have many wallets)
- Wallets (belongs_to coin)(has_many transactions)
- wtype (Type of wallet, Hardware, Exchange, Local, …)
- Transactions(belong_to wallet)
- txid (Transaction ID) this should be generated when the transaction is saved to the DB. (SecureRandom.hex 32)
- txtype (Transaction Type: Deposit, Withdraw, Transfer)
- old_balance (should take the actual balance from the wallet)
- new_balance (should calculate the new balance old_balance + amount)
The creation of coins and wallets is no problem.
Im stuck at the transaction part, the deposit and withdraw part.
Where would you put the deposit, withdraw and the transfer methods?
If you need more infos, let me know.