Live data from Hacker News

Books: an immutable double-entry accounting database service

developer.squareup.com

51–60 of 66 posts

Re: Books: an immutable double-entry accounting database service

#51
post #30

Earlier quoted context omitted.

Rows in the database are never updated or deleted. Only new rows are added.

A blockchain could be used to enforce that immutability. Which might be an actual, useful application for blockchains.

> A blockchain could be used to enforce that immutability. Which might be an actual, useful application for blockchains.

Yes, and surprisingly the implementation is called Bitcoin ;)

Re: Books: an immutable double-entry accounting database service

#52
I found it a lot of fun writing a double entry system, but the fun stops when implementation is finished and the "real work" begins. Next comes a costly and risky endeavor of defining the rules governing accounting events transacted by the AIS. This is where real difficulty and liability lies. An event triggers a series of transactions that must be financially sound and sufficient for meeting the expectations of an audit. Competent, qualified people must define these rules. These rules aren't universal truths. Accounting rules aren't black and white. This lead me to imagine that it is difficult, if not impossible, to define universally-applicable accounting events across all kinds of business. With that given, Square might be able to achieve these rules exclusively for the mom and pop retail customers whose types of business transactions are very similar, but the truth of this can only be revealed by third party auditors.

So, approach this space with a healthy dose of skepticism until its been appropriately vetted and certified by third party auditors.

Re: Books: an immutable double-entry accounting database service

#53
Great write up, but I don’t see how it could scale with the pessimistic lock of Spanner.

Updating the current balance of big merchants, which are receiving multiple payments per second seems to create a lot of lost transactions, with the locking of the balance.

That would generate deadlocks in RDBMSs, curious to know if Spanner is able to scale it.

I built a similar system using DynamoDB and optimistic locking, and for that I had to remove concurrency of updates in the same document, meaning you can get ˜30 updates of the same document per second, with each update taking ˜30 milliseconds.

Re: Books: an immutable double-entry accounting database service

#54

This looks good but some of the background has the air of the kind of artificial problems presented in late night infomercials: > It’s impossible to split a single payment into multiple payouts, since there is a many-to-one relationship of payments to payouts. So your model used a many-to-one relationship when you really wanted a many-to-many? > Since this is just a SQL database, there’s nothing preventing the payout…

I think this mocking of their intention and problem statements is misplaced. > So your model used a many-to-one relationship when you really wanted a many-to-many? In many schema discussions you’d be right, but in the case of payments systems it’s not the case. Payments and payouts are separate transactions and only loosely related. The allocation of credit from one leads to an increment in the settlement of the othe…

> The inconsistencies in question relate to the domain model of accounting, not referential integrity or other (normally) easily enforced database invariants.

Constraints can be more than referential integrity. When PostgreSQL released transition tables, I built a very small proof-of-concept using them to constrain a double-entry (-like) system. https://github.com/jimktrains/pgdea allows any number of debits and credits in a transaction, but the whole transaction must have a 0 balance.

Re: Books: an immutable double-entry accounting database service

#55
post #27
post #7

Earlier quoted context omitted.

This sounds like something internal...I don't think developers or typical small businesses need (or would want to!) to store their double-entry accounting database in shards across Google Cloud Spanner & Kubernetes clusters... Good luck with your application -- I, for one, think there's a need for it. I've wished for years that someone would put something like a secure, web-based Gnucash out into the world.

Doesn't necessarily need to be hosted, although given that people are fine with running Quickbooks or any other SaaS it's hard to see why they wouldn't be fine with ledger SaaS. Can still make a case for licensing, though, depending on the features. We built this for our internal accounting, it's a ledger service that enforced immutable double entry rules and can run as a container with a Postgres DB configured. http…

do you also have some kind of frontend for it? how do you see what's the flow of money and reporting? does it work with kibana out of the box?

Re: Books: an immutable double-entry accounting database service

#56
post #27
post #7

Earlier quoted context omitted.

This sounds like something internal...I don't think developers or typical small businesses need (or would want to!) to store their double-entry accounting database in shards across Google Cloud Spanner & Kubernetes clusters... Good luck with your application -- I, for one, think there's a need for it. I've wished for years that someone would put something like a secure, web-based Gnucash out into the world.

Doesn't necessarily need to be hosted, although given that people are fine with running Quickbooks or any other SaaS it's hard to see why they wouldn't be fine with ledger SaaS. Can still make a case for licensing, though, depending on the features. We built this for our internal accounting, it's a ledger service that enforced immutable double entry rules and can run as a container with a Postgres DB configured. http…

Yeah, people have been using things like Mint for ages, too, and it's not like professional accountants hosting Quickbooks on their ancient Windows boxen is any less terrifying from a security perspective than a ledger SaaS startup...

Personally, I'm likely to stick with Gnucash until or unless it becomes completely unsupported, but Intuit needs some real competition and it would be great to have more choice available.

gledger looks like a neat project, will check it out!

Re: Books: an immutable double-entry accounting database service

#57
post #31
post #16

Nice article, I'd be curious to know if/how their engine abstracts the complexity behind multi-currency transactions, or whether they rely on the accounting model to handle multi-currency. We built our own double-entry accounting engine at my previous company, and while the engine was not as fancy as what Square describes, the real challenge was building out the accounting models that manipulated the engine's primiti…

Damn that link is amazing for accounting

I agree!

Re: Books: an immutable double-entry accounting database service

#58
post #47

Ask the same programmer to write an invoicing & payments system, then coupon creation and track its claims, then something where users can recharge their phone, and their usage is tracked and balance is computed -- and each one of them will be a set of ad-hoc tables and custom code. But most transactional systems where things move from one entity to another and has the notion of "balance value" is best represented by…

What it really shows is the flow of money through the system. That’s really the crux of double-entry bookkeeping.

Re: Books: an immutable double-entry accounting database service

#59
post #28

So other accounting software provides mutable ? Square are you serious? Just adding a authentication layer over it and calling immutable

I don’t think you quite understand what they are doing. Once the entry is in the ledger, it can’t be changed. To correct it you must add in a compensating transaction that corrects the transaction - almost certainly a reversal.

Basically, it’s just a list of transactions you can only append to. You can’t delete any of the entries or modify them - they really are immutable.

Re: Books: an immutable double-entry accounting database service

#60
post #30

Earlier quoted context omitted.

Rows in the database are never updated or deleted. Only new rows are added.

A blockchain could be used to enforce that immutability. Which might be an actual, useful application for blockchains.

Sure, but that’s only needed in a purely distributed environment. There is absolutely no need for a blockchain in a centralised private database you have full control over.
Post reply on HN