All threads / How to deposit, withdraw, transfer coins...

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
Join the discussion

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

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

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

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.