Double-Entry Accounting For Developers Notes

This is a summary of the posts from Modern Treasury (part 1 and part 2) about accounting and its importance in software development involving money.

Is this guide for you?

  • This guide is designed for developers that work on applications that handle money in any way.
  • You may work at a fintech company (the data you handle is money), or
  • You are responsible for managing the fintech integrations in your startup (you handle data and money)

Accounts

An account is a segregated pool of value. Examples: your own bank checking account, balance on Venmo to the annual defense spending of the United States.

Chart of accounts (COA) is a simple depiction of the accounts we will need, their type, and normality:

Taken from original post

Types:

  • debit normal: represent funds you own, or uses of money
    • Example: assets (inventory, investment), expenses (tax expenses).
  • credit normal: represent funds you owe, or sources of money.
    • Example: liabilities (bank loans), equity (investors’ capital), or revenue (accumulated profits).

A common misconception is that one account needs to decrease while another needs to increase. However, they can both increase or decrease in tandem, depending on the debit and credit entries in the transaction and the account types.

Taken from original post

Transactions

  • Transactions are atomic events that affect account balances.
  • Transactions are composed of at least two entries, each of which corresponds to one account.
  • A transaction is an event recorded in the ledger.
    • Ledger is a timestamped log of events with monetary impact.
  • Transactions should enforce double-entry upon creation, which, in aggregate, must affect credit and debit sides in equal amounts.

Double-entry accounting

  • The most common failure mode is software accidentally creating or destroying records of funds.
  • Double-entry systems are a good standard for scalable applications for Uber, Square, Airbnb.
  • Every transaction should record both where the money came from and what the money was used for.
    • One representing the source and the other representing the use of funds.
  • Double-entry ensures that, as transactions are logged, sources and uses of funds are clearly shown, and balances can be reconstructed as of any date.
  • If the sum of balances of all credit normal accounts matches the sum of balances of all debit normal accounts in a single ledger, it is said that the ledger is balanced. This is an assurance of consistency and that all money is properly accounted for.
Taken from original post

Don’t do

  • Don’t mutate balances directly, instead compute a balance from a log of transactions.

Do

  • The double-entry treatment for each type of transaction can then be mapped into functions in your application code that dictate how you will write into the ledger database as transactions happen.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.