Hacker News new | ask | show | jobs
by superzamp 589 days ago
You could take a look at how the Formance ledger [1] is built for some inspiration and take it from there.

A few pointers I’d have would be:

* Decide what this ledger will be in charge of (keeping balances? Answering fast and in volume to a balance-bound transaction commit? Financial reporting with complex aggregations?)

* Choose a transaction data model that optimizes for what’s most important in your use-case (tracking value movement, tracking change to the financial position of your business, etc). This would define wether what operations on accounts can happen along with how accounts can be relate to one another in a transaction.

* Pick a proper monetary values representation format, likely a variant of Decimal or Integer + Currency code. If you don’t use big numbers with infinite lengths, define what happens at boundaries when numbers overflow.

Have fun!

[1] https://github.com/formancehq/ledger