Skip to main content

How to deposit, withdraw, transfer coins...

Rails • Asked by Benny Maas
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

Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 22,346+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.