Ask A Question

Notifications

You’re not receiving notifications from this thread.

How to deposit, withdraw, transfer coins...

Benny Maas asked in Rails
Hi Chris,

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)
    • name
    • symbol

  • Wallets (belongs_to coin)(has_many transactions)
    • coin_id
    • name
    • wtype (Type of wallet, Hardware, Exchange, Local, …)
    • address
    • balance
    • description

  • Transactions(belong_to wallet)
    • date
    • txid (Transaction ID) this should be generated when the transaction is saved to the DB. (SecureRandom.hex 32)
    • wallet_id
    • txtype (Transaction Type: Deposit, Withdraw, Transfer)
    • amount
    • amount_currency
    • description
    • 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.

Benny
Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,946+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.