Skip to main content

22 posts tagged with "Plain-Text Accounting"

View all tags

Beancount.io v3.0: Your Financial Data, Under Your Control

· 8 min read
Mike Thrift
Mike Thrift
Marketing Manager

Most financial software forces you to trust them with your data. They own it, control it, and lock you in. We believe you deserve better.

Today, we're launching the next generation of Beancount.io, built on a simple principle: your financial data should belong to you, not us. With native Git integration, you can pull your complete accounting ledger to your own machine, edit it with any tool you want, and push changes back. No lock-in. No proprietary formats. Just your data, under your control.

This release focuses on three core goals that matter most to the people managing their finances with plain-text accounting:

  1. True Data Ownership through native Git integration
  2. Seamless Collaboration for teams, partners, and accountants
  3. An Intuitive Interface that makes plain-text accounting accessible to everyone

Dashboard Overview

Powerful Financial Reports at Your Fingertips

The new dashboard includes comprehensive financial reporting tools that help you understand your financial position at a glance:

Income Statement

Income Statement Dashboard

Track your net profit, income, and expenses across different commodities over time. The Income Statement view provides a clear breakdown of your revenue streams and spending patterns, helping you identify trends and make informed financial decisions. Visualize your financial performance with interactive charts that show how your income and expenses evolve month by month or year by year.

Balance Sheet

Balance Sheet Dashboard

Monitor your net worth across different commodities over time with the comprehensive Balance Sheet view. See your assets, liabilities, and equity at any point in time, with historical tracking that shows how your financial position changes. This powerful tool helps you understand your overall financial health and track progress toward your financial goals.

Trial Balance

Trial Balance Dashboard

The Trial Balance view provides a complete snapshot of all your account balances at a specific point in time. Perfect for reconciliation and ensuring your books are balanced, this view shows debits and credits side by side, making it easy to verify the accuracy of your accounting records.

Account Detail View

Account Detail Dashboard

Dive deep into any account with the Account Detail view. See account balance values and changes over time with intuitive charts and graphs. The view includes a comprehensive account journal that shows all transactions affecting the account, including sub-accounts, giving you complete visibility into how money flows through your financial system.

Modern File Editor

File Editor Dashboard

The new dashboard introduces a completely redesigned file editor that makes editing your Beancount ledger files a pleasure. Built with modern, responsive design principles, the new editor provides a smooth, intuitive editing experience whether you're on a desktop, tablet, or mobile device.

Git Integration: Your Ledger, Your Way

One of the most requested features is now here: native Git integration. With the new version, you can seamlessly pull your ledger accounts using standard Git protocols, giving you complete control over your financial data.

What you can do:

# Clone your ledger to your machine
git clone ssh://[email protected]:2222/you/ledger.git

# Edit locally with your favorite tools
vim 2025.beancount

# Push changes back
git commit -am "Added Q4 transactions"
git push

Why this matters (Data Sovereignty):

  • True Exit Plan: Your complete financial history is in a standard Git repository. You stop paying us? You keep everything.
  • Tool Agnostic: Edit with VS Code, Vim, Emacs, or specialized Beancount tools. Your choice, not ours.
  • Complete Audit Trail: Every change is tracked with Git's full history, showing exactly who changed what and when. Perfect for compliance and peace of mind.
  • Distributed Backup: Git's distributed nature means you have automatic, versioned backups on your machine.

This makes Beancount.io the only platform that makes your data more portable, not less.

Team Collaboration: Built for How Teams Actually Work

Whether you're running a small business, working with an accountant, or managing household finances with a partner, collaboration matters.

Collaborate with Your Team

The new collaboration system makes this natural and affordable:

  • Invite Collaborators: Simply invite others by email to join your ledger as collaborators
  • Real-Time Updates: See changes made by collaborators in real-time, keeping everyone in sync
  • Activity History: Track who made what changes and when, maintaining full accountability

Perfect for small businesses, freelancers working with accountants, or anyone who needs to share financial management responsibilities. Collaboration has never been easier or more secure.

Multi-Ledger Support: Organize Your Finances Your Way

The new version supports creating multiple ledgers, giving you the flexibility to organize your finances exactly as you need. Whether you want separate ledgers for personal and business finances, different projects, or different entities, the new version makes it simple.

Benefits of multi-ledger support:

  • Separation of Concerns: Keep personal and business finances completely separate
  • Project-Based Organization: Create dedicated ledgers for different projects or clients
  • Flexible Structure: Organize your accounting system in a way that makes sense for your unique situation
  • Easy Switching: Move between ledgers seamlessly with the intuitive ledger switcher

Create as many ledgers as you need to keep your financial records organized and manageable.

Public Ledgers: Share and Learn from the Community

The new version introduces public ledger sharing, allowing you to share your well-structured ledgers with the Beancount community. This feature promotes knowledge sharing and helps others learn best practices for organizing their own accounting systems.

How public ledgers work:

  • Share Your Expertise and Let it Go Viral: Make your ledger public to help others learn from your setup
  • Discover Best Practices: Browse public ledgers to see how others organize their finances
  • Community Learning and Social Network: Learn from real-world examples of effective Beancount usage
  • Privacy Control: You decide which ledgers to make public—your private ledgers remain completely private

By sharing excellent ledger examples, we're building a stronger, more knowledgeable Beancount community where everyone can learn and improve together.

Enhanced Fava & Beancount Community Features

We've integrated popular features from the Beancount community that solve real workflow problems:

  • Expense Amortization (amortize_over): Spread annual subscriptions or prepaid expenses across months automatically
  • Financial Forecasting (forecast): Project future cash flow based on recurring transactions
  • Document Linking(link_documents): Keep receipts and invoices connected to transactions
  • Auto-Document Discovery(tag_discovered_documents): Automatically tag and organize supporting documents

These aren't experimental features—they're battle-tested tools from the Beancount community, now seamlessly integrated.

Faster Performance, Smoother Experience

Under the hood, the new version includes significant performance optimizations that make everything feel faster:

  • Quicker Load Times: Pages and reports load noticeably faster, even with large ledgers
  • Smoother Interactions: UI interactions are more responsive, with reduced lag when navigating between views
  • Optimized Data Processing: Complex calculations and report generation happen more efficiently
  • Better Resource Management: The system uses resources more intelligently, ensuring consistent performance even during peak usage

These improvements mean you spend less time waiting and more time managing your finances effectively.

Privacy & Security: Your Data, Your Rules

We champion your data sovereignty by securing your ledger in a private, encrypted Git repository that you fully own, can export, and delete at will. This control demands responsibility: you determine access by managing trusted collaborators and must exercise extreme caution when publishing ledgers, understanding that public data is permanently visible to the internet and should be thoroughly sanitized of sensitive details. Ultimately, your data remains yours—protected by our infrastructure but governed strictly by your rules.

What's Next?

The new version is just the beginning of our journey toward making Beancount.io the best plain-text accounting platform available, targeting toward GitHub of Finance. Traditional financial software relies on "Data Lock-in". Beancount.io is building a different kind of defensibility: Protocol Lock-in. We're already working on:

  • Mobile app improvements for on-the-go accounting
  • Additional integrations with popular financial services
  • More advanced reporting and analytics features
  • Enhanced collaboration tools for teams

We'd love to hear your feedback on the new version! Your input helps us prioritize what to build next.

Happy accounting!

The Beancount.io Team

Detox Your Small‑Business Finances — the Beancount Way

· 10 min read
Mike Thrift
Mike Thrift
Marketing Manager

Turn one messy ledger into a calm, cash‑confident business in 30 days—using plain‑text accounting.


2025-09-04-detox-your-small-business-finances

TL;DR

  • Separate, simplify, and lock your books with a lean chart of accounts, consistent imports, and automated balance checks.
  • Surface what matters—COGS, overhead, cash runway—via quick bean-query reports.
  • Cut the noise (unused subscriptions, duplicate tools) and codify good habits (weekly reconcile, monthly close, receipts attached).
  • Make tax season boring by keeping statements, receipts, and balances verifiable in one place.

Why a “Detox”?

Financial clutter in a small business isn't just messy—it's expensive. It hides wasteful spending, obscures your true profitability, and turns tax season into a frantic scavenger hunt. A financial detox is a focused, 30-day reset: you identify what moves (and leaks) money, remove the complexity, and then institutionalize simple, repeatable routines to keep it clean.

Beancount is the perfect tool for this because it’s transparent, scriptable, and verifiable. Unlike black-box software, a plain-text ledger means every number is explainable. Every check and balance can be automated with directives and queries, creating a self-auditing system that forces clarity. This guide will walk you through a four-week plan to achieve just that.


Week 0 — Set Your Baseline

Before you can clean up, you need a solid foundation. This week is about defining the structure of your financial world.

Create a Lean Chart of Accounts

Your chart of accounts is the skeleton of your financial system. The goal here is minimalism. Don't create an account for every possible expense you might have. Start with the essentials you use today; you can always add more later. A cluttered chart of accounts encourages miscategorization and makes high-level analysis difficult.

Here’s a simple, effective starting point:

; Core entities
2025-01-01 open Assets:Bank:Checking USD
2025-01-01 open Assets:Bank:Savings USD
2025-01-01 open Liabilities:CreditCard:Business USD
2025-01-01 open Income:Sales
2025-01-01 open Expenses:COGS
2025-01-01 open Expenses:Overhead:Rent
2025-01-01 open Expenses:Overhead:Utilities
2025-01-01 open Expenses:SaaS
2025-01-01 open Equity:Opening-Balances

Lock Balances You Can Verify

The most powerful feature in plain-text accounting is the ability to assert reality. A balance directive tells Beancount: "On this date, this account had exactly this much money." If it doesn't, Beancount will raise an error. This is your primary safety net.

When starting out, use pad in combination with balance to initialize your accounts from a bank statement. The pad directive creates a transaction that forces the account to the correct starting balance, booking the difference to an equity account.

; Initialize from statements
2025-01-01 pad Assets:Bank:Checking Equity:Opening-Balances
2025-01-01 balance Assets:Bank:Checking 12345.67 USD

A word of caution: Use pad sparingly. It's for getting started cleanly, not for papering over recurring reconciliation mistakes.


Week 1 — Separate and Simplify Flows

With a structure in place, it's time to clarify how money moves through your business.

Keep Business ≠ Personal

This is the golden rule of small-business finance. Co-mingling funds is a recipe for confusion and tax-time headaches.

  • Maintain one dedicated business bank account and one business credit card.
  • Mirror this separation in your ledger: Assets:Bank:Business:Checking, Liabilities:CreditCard:Business.
  • If you pay yourself, book it as a distribution to Equity:Owner-Draws. Never categorize personal expenses directly from business accounts.

Standardize Vendor Categories

Do you pay for AWS, Google Cloud, and Vercel? Don't create three separate accounts. Map them all to a single, logical category like Expenses:Cloud. Avoid creating micro-accounts you won't actually analyze. The goal is to see patterns, not to track every single vendor with its own account.


Week 2 — Automate Inputs and Receipts

Manual data entry is slow, error-prone, and unsustainable. This week is about building a machine to feed your ledger reliably.

Build a No-Drama Import Path

Beancount's import framework lets you teach it how to read CSV or OFX files from your bank and automatically generate transactions. Invest the time to set this up once, and you'll save hundreds of hours down the line. Keep your importer rules in version control (like Git) so your system is repeatable and backed up.

  • Start with Beancount’s official Importing External Data guide.
  • For a more interactive workflow, consider a tool like beancount-import, which provides a web UI for semi-automatic matching.
  • Many users rely on the built-in ingest or newer beangulp frameworks to build their custom importers. Pick one and stick with it for consistency.

Attach Documents Where They Belong

A transaction without a receipt is an unsubstantiated claim. Beancount and its web interface, Fava, make it trivial to link source documents to entries, creating an unshakeable audit trail.

You have two great options:

  1. Documents Folder + Directive: Store all your receipts and statements in a dedicated folder. Then, link a file to a transaction using the document directive.
  2. Drag-and-Drop in Fava: Simply drag a PDF or image file onto a transaction in the Fava UI. Fava automatically stores the file and inserts the correct document directive into your ledger file for you.
; In your main ledger file, tell Fava where your documents live
option "documents" "/home/acme/docs"

; Link a receipt to a specific transaction posting
2025-08-07 * "Figma" "Monthly Subscription"
Assets:CreditCard:Business -12.00 USD
Expenses:SaaS 12.00 USD
document: "receipts/figma-2025-08-07.pdf"

Week 3 — See the Truth (Fast Queries You’ll Reuse)

Your ledger is now clean and fed with data. It's time to ask it important questions. Fire up the bean-query command-line tool to get instant answers.

1) Where’s My Cash?

Get a quick snapshot of your liquid assets.

bean-query business.beancount 'BALANCES FROM year = 2025 AND (account ~ "Assets:Bank" OR account ~ "Liabilities:CreditCard")'

This gives you an immediate, real-time view of your cash position without logging into multiple bank portals.

2) What Am I Spending On Overhead vs. COGS?

Understand where your money is really going. Are you spending more on non-essential overhead or on the costs directly tied to delivering your product (Cost of Goods Sold)?

SELECT
account,
units(sum(position))
WHERE
account ~ "^Expenses:(Overhead|COGS)" AND year = 2025
GROUP BY
account
ORDER BY
account

This query separates your core operational costs from your administrative burden, a critical insight for profitability.

3) Which Subscriptions Look “Zombie”?

Find recurring, small-dollar expenses that often fly under the radar. These "zombie" subscriptions can bleed your cash flow dry.

SELECT
payee,
COUNT(*) AS num_transactions,
SUM(number) AS total_spent
WHERE
account ~ "^Expenses:SaaS" AND date >= '2025-01-01'
GROUP BY
payee
ORDER BY
num_transactions DESC,
total_spent DESC

This query instantly reveals vendors you pay frequently. If you see one you don't recognize or no longer need, it's time to cancel.


Week 4 — Tidy and Lock the System

The final week is about building the habits and guardrails that keep your finances clean for good.

Put Simple Budgets in Place

Fava can read budget directives from your ledger and display helpful progress bars in its reports, showing you if you're on track. This provides a gentle, constant reminder of your spending goals.

; Cap SaaS spending at $100 per month
2025-01-01 custom "budget" Expenses:SaaS "monthly" 100.00 USD

Set these for key variable expense categories like software, advertising, or contractors to notice drift before it becomes a problem.

Close the Month, Every Time

Establish a simple, non-negotiable monthly closing process:

  1. Reconcile: For every bank and credit card account, add a balance assertion matching the final number on your monthly statement.
  2. Attach: Attach the PDF statement itself to the balance entry using the document directive.
  3. Report: Run your three saved queries (cash, overhead/COGS, subscriptions) and paste the outputs into a short monthly review note.

The balance assertion is an automatic tripwire. If your ledger doesn't match the bank statement, Beancount will throw an error, telling you exactly where to look for the discrepancy.


Make Tax Season Boring (In a Good Way)

By following this system, you transform tax preparation from a crisis into a simple reporting exercise.

  • Receipts are attached to transactions, so there’s no frantic search. In Fava, you’re one click away from the source document for any expense.
  • Tax-relevant items can be tagged (e.g., #tax-deductible), allowing you to pull a clean report with bean-query for your accountant.
  • Year-end balances are locked and verified with balance assertions, giving you and your preparer confidence in the numbers.

A 30-Day Checklist (Print This)

  • Day 1–3
    • Create a minimal chart of accounts.
    • Add pad + balance for each bank/card using the latest statements.
  • Day 4–10
    • Set up one importer pipeline and commit your rules to version control.
    • Backfill 90 days of transactions; run a first BALANCES snapshot.
  • Day 11–15
    • Standardize vendors to their respective accounts (SaaS, Cloud, Shipping, etc.).
    • Attach statement PDFs for the reconciled periods; confirm they appear in Fava.
  • Day 16–20
    • Run the overhead vs. COGS query; fix any miscategorized items.
    • Run the subscription frequency query; cancel or consolidate unused services.
  • Day 21–25
    • Add one or two budget caps for key variable expenses via custom "budget".
    • Save your three most important bean-query commands to a script for easy reuse.
  • Day 26–30
    • Reconcile all accounts with month-end balance assertions.
    • Write a short "monthly close" note summarizing key numbers and linking to documents.

Common Snippets You’ll Reuse

A Clean Expense Posting

2025-08-05 * "Figma" "Pro plan"
Expenses:SaaS 12.00 USD
Assets:Bank:Checking -12.00 USD

Balance Assertion from a Statement

2025-09-01 balance Assets:Bank:Checking  8423.17 USD

Budget Guardrail for Rent

2025-01-01 custom "budget" Expenses:Overhead:Rent "monthly" 2500.00 USD

Keep It Simple, Keep It Scripted

The philosophy of a Beancount-powered financial detox is simple:

  • Script what you repeat: Automate imports and reporting.
  • Let assertions fail loudly: They are your safety rails, not an inconvenience.
  • Prefer fewer, clearer accounts over perfect, granular categorization.

Adopt these habits, and your business will run on tight feedback loops: cash visibility daily, spending drift visible weekly, and a truly boring year-end. That's the clarity and control this detox is designed to deliver.


References & Further Reading

This post is for educational purposes only and is not tax or legal advice.

10 Practical Steps to a Fast, Reliable Month-End Close in Beancount

· 7 min read
Mike Thrift
Mike Thrift
Marketing Manager

If your ledger lives in plain text, your month-end close can be both fast and auditable. The process doesn't need to be a frantic scramble of spreadsheets and calculators. This guide distills a clean, repeatable process tailored for Beancount and its web interface, Fava, built around balance assertions, smart imports, and lightweight checks.

Here's the checklist for a painless close:

2025-09-02-month-end-close

  1. Gather statements and import all raw transactions.
  2. Normalize payees, descriptions, and metadata.
  3. Reconcile every cash, bank, and credit account with balance assertions.
  4. Tie out transfers and inter-account moves.
  5. Update prices for investments and verify valuations.
  6. Attach or source documents (receipts, invoices) in your ledger.
  7. Run queries and dashboards for P&L and variance checks.
  8. Post accruals and adjustments as needed.
  9. Validate the ledger with automated checks.
  10. Commit, tag, and archive the month.

1. Set the Ground Rules (and Reuse Them)

A consistent close starts with a stable foundation. Your Chart of Accounts and key Beancount options should be declared centrally and rarely changed. Options like operating_currency and documents handling ensure your reports and imports behave predictably every single time.

Tip: Treat your options file as "infrastructure." Changing it can alter how your numbers are computed. Version it carefully in Git.


2. Import Everything—Then Never Hand-Type It Again

Automating your data import is the single biggest speed-up for closing your books. Use Beancount’s powerful importing tools and community-built importers to pull in bank feeds, credit card CSV/OFX files, brokerage data, and payroll reports.

The goal is a one-command import that generates balanced postings that you only need to review and commit. This eliminates manual data entry, the primary source of errors and delays.


3. Normalize Payees and Metadata Up Front

Clean data is reliable data. Standardize your payees, narration, and tags during the import process so that your searches, rules, and reports remain accurate month after month.

Beancount’s plugin system lets you add lightweight transformations and validations as your files are loaded. This is perfect for enforcing custom consistency checks or using the built-in noduplicates plugin to flag repeat transactions before they become a problem.


4. Reconcile with balance Assertions

For every account that has a statement (checking, savings, credit cards), use Beancount’s balance directive to assert the closing balance. This simple line turns reconciliation from a manual eyeball-check into a precise, automated test.

; Asserts the balance is exactly 1234.56 at the start of the day
2025-09-01 balance Assets:Bank:Checking 1234.56 USD

Because balances are checked at the beginning of the day, it's easiest to use the first day of the next month for a month-end statement. If Beancount’s calculated balance disagrees with your assertion, you’ll get a precise error and a date to begin your investigation. Always fix the source of truth (your transactions) first; don't "force" a reconcile.


5. Tie Out Inter-Account Transfers

Ensure every transfer appears on both sides of the transaction. A payment from your checking account to your credit card, for instance, should be reflected in both accounts. Mismatched transfers are a common source of reconciliation headaches.

Use the pad directive only for setting historical opening balances when you first set up an account. It’s a setup tool, not a reconciliation crutch to fix month-end differences.


6. Verify Positions and Prices for Investments

To get an accurate view of your net worth, you need up-to-date market values for your investments and foreign currencies. Use Beancount’s price directive to record these values as of your closing date.

2025-08-31 price VTI  290.14 USD
2025-08-31 price EUR 1.11 USD

Many tools can fetch these prices for you automatically. After updating them, re-run your balance sheet or net worth reports to see the valuation changes.


7. Attach Receipts and Source Documents

Maintain a clean audit trail by linking transactions to their source documents. Use the documents option in your main Beancount file to point to your archive of receipts and invoices.

option "documents" "/path/to/Finance/Documents"

If you name your files by date (e.g., 2025-08-13.vendor.receipt.pdf), Beancount and Fava can automatically discover and link them, making it easy to pull up a receipt for any transaction with a single click.


8. Review the Month with Fava and BQL

A fast feedback loop is critical. Use Fava to visually inspect your finances. Its charts and reports are perfect for slicing expenses by category, checking income trends, and spotting anomalies at a glance.

For more precise checks, use the Beancount Query Language (BQL). This query, for example, gives you a ranked breakdown of all expenses for August 2025:

SELECT
account,
ROUND(SUM(position), 2) AS total
WHERE
date >= 2025-08-01 AND date < 2025-09-01
AND account ~ 'Expenses'
GROUP BY
account
ORDER BY
total DESC;

9. Post Accruals and Adjustments

If you use accrual accounting, record your month-end adjustments as explicit, dated transactions. This can include accrued expenses (like a utility bill you haven't received yet), prepaid expense amortization, or revenue recognition. Keep them simple and well-documented in the narration so they are easy to understand during future reviews.


10. Validate, Tag, and Archive

Before you finalize the month, run a final check for structural integrity:

bean-check your-ledger.beancount

This command will catch imbalances, references to accounts you haven't opened, and other common errors. Fix anything it flags.

Once everything is correct, commit your changes to version control (like Git) with a clear message and tag, such as close-2025-08. Finally, archive your bank statements and consider the month locked.


A Simple Close Script You Can Adapt

You can automate most of these steps with a simple shell script. This turns your close into a single, repeatable command.

#!/usr/bin/env bash
set -euo pipefail

# Example: ./close.sh 2025-08
MONTH=${1:?Please provide a month in YYYY-MM format}
LEDGER=~/finance/ledger.beancount

# 1. Import new transactions
echo "Importing transactions for $MONTH..."
make import MONTH="$MONTH"

# 2. Update market prices for the last day of the month
PRICE_DATE=$(date -d "$MONTH-01 +1 month -1 day" +%F)
echo "Fetching prices for $PRICE_DATE..."
make prices DATE="$PRICE_DATE"

# 3. Validate the entire ledger
echo "Running bean-check..."
bean-check "$LEDGER"

# 4. Generate a key report (e.g., expense breakdown)
echo "Generating expense report for $MONTH..."
bean-query "$LEDGER" -f txt "
SELECT account, SUM(position)
WHERE date >= '${MONTH}-01' AND date < '${MONTH}-01' + 1 month
AND account ~ 'Expenses'
GROUP BY account ORDER BY SUM(position) DESC;
" > "reports/${MONTH}-expenses.txt"

# 5. Commit and tag the close in Git
echo "Committing and tagging the close..."
git -C ~/finance add .
git -C ~/finance commit -m "Close ${MONTH}"
git -C ~/finance tag "close-${MONTH}"

echo "Month ${MONTH} is closed and tagged."

Why This Works

This process is fast and reliable because it’s built on a few core principles:

  • Assertions, not Eyeballs: The balance directive turns reconciliation into a precise, automated check.
  • Deterministic Inputs: Automated importers and normalized metadata make your ledger reproducible and consistent.
  • Explorable Data: Fava and BQL provide powerful tools to validate results and drill into outliers instantly.
  • Auditable Changes: Adjustments are plain-text journal entries, making them easy to review and understand months or years later.

A good month-end is mostly logistics. With Beancount, you can turn it into a short, scriptable ritual: import, assert, price, query, and commit. Keep the workflow stable, and your close will stay fast—even as your financial life grows more complex.

Accrued Expenses in Beancount: A Practical Guide (with copy-paste ledger examples)

· 8 min read
Mike Thrift
Mike Thrift
Marketing Manager

Accrued expenses sound abstract until month-end closes start piling up. They are a cornerstone of proper accrual accounting, ensuring your financial reports reflect economic reality, not just when cash changes hands. Here’s a clear, Beancount-first walkthrough of what they are, why they matter, and exactly how to book, reverse, and report them in your plain-text ledger.

TL;DR ⚡

  • Accrued expenses are costs you’ve incurred this period but haven’t paid yet. They are recorded as a liability until the cash goes out.
  • In Beancount, this is simple: you debit an Expenses: account and credit a Liabilities:Accrued: account. Later, you clear the liability when you pay.
  • To report, you can see what you owe as of a specific date by running a bean-query with CLOSE ON and CLEAR to get a clean balance-sheet snapshot.

2025-08-24-accrued-expenses-in-beancount-a-practical-guide

What is an Accrued Expense?

An accrued expense is a cost that a business has incurred, but has not yet paid. It's recorded when the service is received or the cost is incurred, even if the invoice hasn't arrived or the payment isn't due yet. This practice follows the matching principle of accrual accounting, which dictates that expenses should be recorded in the same period as the revenues they helped generate.

Common examples include:

  • Wages earned by employees at the end of a month but paid in the next.
  • Utilities (electricity, water) you used in December but won't be billed for until January.
  • Interest on a loan that has accumulated over the month but has not yet been withdrawn from your account.

By recording these costs when they happen, you get a much truer picture of your company's financial performance for that period.

How Beancount Thinks About It (in 30 seconds)

Beancount is a plain-text, double-entry accounting system. Everything is a dated directive or transaction in a text file. The system is built on five core account types: Assets, Liabilities, Equity, Income, and Expenses.

Entries are always ordered by date. A key detail is that balance assertions are checked before same-day transactions are processed. This is important to remember when you place checks and reversing entries.

Finally, the bean-query language provides a powerful, SQL-like way to generate reports. With operators like OPEN ON, CLOSE ON, and CLEAR, you can create precise "as-of" views for financial statements.

Your Chart of Accounts (Suggested)

A clean, hierarchical chart of accounts is your best friend. For accrued expenses, the structure is straightforward. You'll need:

  • An expense account: e.g., Expenses:Utilities, Expenses:Payroll:Wages
  • A corresponding liability account: e.g., Liabilities:Accrued:Utilities, Liabilities:Accrued:Payroll
  • Your cash account: e.g., Assets:Bank:Checking

Beancount enforces the five top-level account types. Keeping your account names organized makes querying and reporting much easier down the road.

The Core Pattern (No Plugin, No Magic)

This is the most direct way to handle accruals in Beancount. It involves two steps: accruing the expense at month-end and clearing the liability when you pay.

Step 1: Accrue the Expense at Month-End

On the last day of the period, you record the expense and create the liability.

2025-02-28 * "Accrue February electricity" #accrual
Expenses:Utilities 120.00 USD
Liabilities:Accrued:Utilities

Step 2: Clear the Accrual When You Pay

When the bill comes and you pay it, you don't hit the expense account again. Instead, you debit the liability account to clear it out.

2025-03-05 * "Pay Feb electricity - City Power"
Liabilities:Accrued:Utilities 120.00 USD
Assets:Bank:Checking

This is the cleanest approach for small teams. It correctly places the expense in February and ensures you don't double-count it in March. Notice that in Beancount, leaving one amount blank lets the system balance the transaction for you automatically.

Alternative: Reversing Entry on Day 1

If you prefer the classic "auto-reverse" accounting style, you can post the opposite of your accrual entry on the first day of the next month. Then, you book the actual vendor bill to the expense account as you normally would.

Step 1: Accrue at Month-End (Same as before)

2025-02-28 * "Accrue February electricity" #accrual
Expenses:Utilities 120.00 USD
Liabilities:Accrued:Utilities

Step 2: Reverse on the First Day of the Next Month

2025-03-01 * "Reverse Feb electricity accrual" #reversal
Liabilities:Accrued:Utilities 120.00 USD
Expenses:Utilities

Step 3: Book the Payment as Usual

2025-03-05 * "City Power - February bill"
Expenses:Utilities 120.00 USD
Assets:Bank:Checking

Heads-up on checks: Remember that balance assertions evaluate before same-day transactions. If you want to check your Liabilities:Accrued:Utilities account balance, place the assertion on 2025-02-28 to confirm the accrual or on 2025-03-01 after the reversal transaction to confirm it's zero. Placing it before the reversal on 2025-03-01 will cause a false failure.

Six Common Accruals (Copy-Paste Patterns) 📋

Here are some ready-to-use examples for common business accruals.

1. Rent Not Yet Invoiced

2025-01-31 * "Accrue January rent" #accrual
Expenses:Rent 3000.00 USD
Liabilities:Accrued:Rent

2. Wages Earned but Unpaid

2025-03-31 * "Accrue March wages" #accrual
Expenses:Payroll:Wages 8500.00 USD
Liabilities:Accrued:Payroll

3. Vacation Pay (PTO) Earned

2025-03-31 * "Accrue PTO earned in March" #accrual
Expenses:Payroll:PTO 900.00 USD
Liabilities:Accrued:Payroll

4. Interest Accrued on a Loan

2025-02-29 * "Accrue monthly loan interest" #accrual
Expenses:Interest 210.00 USD
Liabilities:Accrued:Interest

5. Professional Fees (Audit/Legal)

2025-12-31 * "Accrue year-end audit fees" #accrual
Expenses:Professional:Audit 4200.00 USD
Liabilities:Accrued:Professional

6. Utilities Used but Not Billed

2025-04-30 * "Accrue April utilities" #accrual
Expenses:Utilities 95.00 USD
Liabilities:Accrued:Utilities

Reporting: "What do I owe as of a certain date?"

bean-query is your tool for getting answers. Here’s how you can get a proper balance sheet snapshot of your accrued expenses.

Get All Accrued Liability Balances at Period-End

This query gives you the balance of each accrued liability account as of March 31, 2025.

bean-query main.beancount '
SELECT account, UNITS(SUM(position)) AS balance
FROM OPEN ON 2025-01-01 CLOSE ON 2025-04-01 CLEAR
WHERE account ~ "^Liabilities:Accrued"
GROUP BY 1
ORDER BY 1;
'
  • OPEN ON sets starting balances at the period start.
  • CLOSE ON truncates transactions before this date (it's exclusive). That's why we use 2025-04-01 to get data up to and including 2025-03-31.
  • CLEAR zeroes out Income and Expenses, giving you a clean balance sheet view (Assets, Liabilities, Equity).

See a Register of All Accrual Postings

If you want to see the raw transaction history for your accrual accounts:

bean-query main.beancount '
SELECT date, payee, narration, position
WHERE account ~ "^Liabilities:Accrued"
ORDER BY date;
'

Get a Single Total for All Accruals

For a quick summary of the total amount you owe:

bean-query main.beancount '
SELECT UNITS(SUM(position)) AS total_accruals
FROM OPEN ON 2025-01-01 CLOSE ON 2025-04-01 CLEAR
WHERE account ~ "^Liabilities:Accrued";
'

Controls & "Gotchas" Specific to Beancount

  • Balance Assertions Timing: As mentioned, assertions check the balance at the start of the day. 2025-03-01 balance ... runs before any transactions on 2025-03-01. Plan accordingly.
  • Naming and Hierarchy: A tidy tree like Liabilities:Accrued:* is not just for looks. It makes your queries simpler and your reports instantly understandable.
  • Pad with Caution: The pad directive can fix opening balances, but avoid using it to "fix" recurring accruals. Making explicit entries provides a clear audit trail.
  • As-Of Reporting: For balance-sheet snapshots, always prefer OPEN ... CLOSE ... CLEAR in bean-query. This prevents income and expense accounts from polluting your liability totals.

Prepaid vs. Accrued (Quick Contrast)

It's easy to mix these up. They are mirror images:

  • Accrued Expense: Service consumed now, cash paid later. This creates a liability.
  • Prepaid Expense: Cash paid now, service consumed later. This creates an asset.

The accounting logic is the same in Beancount; only the accounts differ (Assets:Prepaid:* vs. Liabilities:Accrued:*).

Drop-in Template (Start of File)

Here are the open directives you'd need for the examples used in this post. Add these to the top of your ledger file once.

; --- Accounts (open once) ---
2025-01-01 open Assets:Bank:Checking
2025-01-01 open Expenses:Utilities
2025-01-01 open Expenses:Payroll:Wages
2025-01-01 open Expenses:Interest
2025-01-01 open Expenses:Professional:Audit
2025-01-01 open Liabilities:Accrued:Utilities
2025-01-01 open Liabilities:Accrued:Payroll
2025-01-01 open Liabilities:Accrued:Interest
2025-01-01 open Liabilities:Accrued:Professional

Final Notes

If you run your books on a cash basis, you won’t post accruals at all—expenses are simply recorded when they are paid. If you run on an accrual basis, using the patterns above is essential for matching costs to the period where you consumed the service.

The examples here provide general educational guidance. Always consult your CPA for industry-specific treatments, especially regarding bonuses, payroll taxes, and capitalization thresholds.

S-Corp Election, Explained for Beancount Users

· 15 min read
Mike Thrift
Mike Thrift
Marketing Manager

What it is, when it pays off, and how to model it cleanly in your ledger (with examples).

⚠️ This guide is U.S.-specific and for education only. Talk to a tax pro for your situation.

TL;DR

  • An S-corp is a tax status you choose with the IRS (via Form 2553) so that business profits pass through to the owners' personal tax returns. A key requirement is that you must pay owner-operators a reasonable W-2 salary before taking any profit as dividends or distributions.
  • Deadlines matter: For an existing business, you must file no later than the 15th day of the 3rd month of the tax year you want the S-corp status to begin. For a calendar-year 2025 election, March 15, 2025, falls on a Saturday, so the practical deadline is the next business day, Monday, March 17, 2025.
  • Why do this? The main attraction is potential self-employment tax savings. While your W-2 salary is subject to FICA taxes, distributions are not. However, this benefit comes with added costs for payroll, compliance, and, in some states, extra entity-level taxes.
  • In Beancount, it's critical to separate wages from distributions. You'll need to track payroll liabilities, handle the special accounting for health insurance for shareholders owning more than 2% of the company, and record distributions explicitly through equity accounts.

2025-08-08-s-corp-election

What is an S-corp election?

At its core, an S-corp election is a request you make to the IRS to change how your business is taxed. By filing Form 2553, you ask the IRS to tax your corporation or LLC under Subchapter S of the Internal Revenue Code. This makes your business a "pass-through" entity, meaning its income, losses, deductions, and credits are passed directly to the shareholders' personal tax returns. It’s purely a tax classification, not a different type of legal business entity.

Key effects for an owner-operator

Once the election is active, your role fundamentally splits in two: you are now both a shareholder and an employee of your company.

This distinction is crucial. The compensation you receive for your labor must be paid as W-2 wages, which are subject to standard payroll taxes (Social Security and Medicare). Any remaining profit can then be paid out as distributions, which are generally not subject to self-employment taxes. The IRS insists that you pay yourself a reasonable salary for your work before you take any distributions.

Should you elect S-corp status?

The S-corp election is often worth evaluating once your business generates steady and meaningful profit. A common rule of thumb is to consider it when your ongoing business profit can comfortably support a market-rate salary for your role, with enough left over to make distributions worthwhile after covering all the new administrative costs.

The exact break-even point is unique to your situation and depends on several factors:

  • Your "Reasonable Salary": What would a business pay for someone with your skills and responsibilities in your industry? This figure is the baseline for your W-2 wages and is subject to IRS scrutiny.
  • State Taxes and Fees: Some states have their own rules. California, for example, imposes a 1.5% tax on an S-corp's net income, plus a minimum annual franchise tax of $800.
  • Added Costs: You'll need a payroll service, and you'll be paying for unemployment insurance. Your bookkeeping and tax preparation fees will also likely increase due to the added complexity.
  • QBI Deduction (Section 199A): The S-corp election can impact your Qualified Business Income deduction. The W-2 wages you pay yourself can either help you qualify for the full deduction or, at higher income levels, become a limiting factor.

Eligibility & Timing

Not every business can become an S-corp. Here are the high-level requirements:

  • It must be a domestic corporation or an eligible LLC.
  • It can have no more than 100 shareholders.
  • It can only have one class of stock.
  • Shareholders must be individuals, certain trusts, or estates (i.e., no partnerships, corporations, or non-resident alien shareholders).

When to file Form 2553

Timing is critical, and the rules differ slightly for new versus existing businesses.

  • For a new business: You must file within 2 months and 15 days after the first day of your first tax year. For example, if your business's tax year begins on January 7, your deadline is March 21.
  • For an existing C-corp (or an LLC taxed as a C-corp): You can file at any time during the preceding tax year or by the 15th day of the 3rd month of the year you want the election to take effect. If this date falls on a weekend or holiday, the deadline shifts to the next business day, a provision granted under IRC Section 7503.

What if you missed the deadline? Don't panic. The IRS provides a path for late-election relief under Revenue Procedure 2013-30. You can often file for this relief within 3 years and 75 days of the intended effective date, provided you have a reasonable cause for the late filing.

Reasonable Salary: The Part That Trips People Up

This is the most scrutinized aspect of the S-corp structure. The IRS is very clear: shareholder-employees must be paid reasonable compensation for the services they provide before any profits are taken as distributions.

What does "reasonable" mean? There's no single dollar amount. The IRS and courts look at a variety of factors to determine if your salary is appropriate, including your duties and responsibilities, the time you spend working, your level of experience, and what comparable businesses would pay for similar services. Expect the IRS to take a close look if you pay yourself a very low W-2 salary while taking large distributions. This is often seen as a red flag for attempting to evade payroll taxes.

Health Insurance & Fringe Benefits for >2% Shareholders

There's a special rule for how S-corps handle health insurance for shareholders who own more than 2% of the company. If the S-corp pays or reimburses these health insurance premiums, the cost is deductible by the S-corp.

However, the value of those premiums must also be included in the shareholder-employee's W-2 wages. While this amount is subject to federal income tax withholding, it is exempt from Social Security and Medicare (FICA) taxes as long as it's handled correctly. You must coordinate with your payroll provider to ensure these amounts are reported properly on your W-2.

State-Level Gotchas (Examples)

Federal S-corp status doesn't always translate directly at the state level. Always check your state's specific rules.

  • California: S-corps are subject to a 1.5% tax on their California-source net income. Additionally, most corporations must pay an $800 minimum franchise tax each year (though some exceptions apply for the first year).
  • New York: Making a federal S-corp election is not enough. You must also file a separate state-level election, Form CT-6, to be treated as a New York S-corporation. Failure to do so means you'll be taxed as a standard C-corp at the state level.

How to Model an S-corp Cleanly in Beancount

Plain text accounting is perfect for managing the added complexity of an S-corp. Here’s how to structure your ledger.

Suggested Chart of Accounts (Starter)

This basic structure separates your payroll expenses from distributions and creates liability accounts to track taxes you owe.

; Core bank & income
1970-01-01 open Assets:Bank:Checking USD
1970-01-01 open Income:Sales USD
1970-01-01 open Income:Other USD

; Payroll expenses & liabilities
1970-01-01 open Expenses:Payroll:Wages USD
1970-01-01 open Expenses:Payroll:EmployerTaxes USD
1970-01-01 open Expenses:Benefits:HealthInsurance USD
1970-01-01 open Liabilities:Payroll:Federal:FIT USD
1970-01-01 open Liabilities:Payroll:FICA USD
1970-01-01 open Liabilities:Payroll:Medicare USD
1970-01-01 open Liabilities:Payroll:State:Withholding USD

; Equity
1970-01-01 open Equity:ContributedCapital USD
1970-01-01 open Equity:Distributions USD
1970-01-01 open Equity:RetainedEarnings USD

Typical Payroll Run (Simplified)

Your payroll provider (e.g., Gusto, ADP) will debit your bank account for your net pay and the total tax liability. Your Beancount transaction should break this down into the gross wages, employer taxes, and the corresponding liabilities.

; This transaction records a $100k annual salary, paid monthly.
2025-01-31 * "Gusto" "Jan payroll — shareholder-employee"
Expenses:Payroll:Wages 8,333.33 USD ; Gross wages
Expenses:Payroll:EmployerTaxes 637.50 USD ; Employer-side FICA/Medicare
Liabilities:Payroll:Federal:FIT -1,200.00 USD ; Employee withholding
Liabilities:Payroll:FICA -516.67 USD ; Employee withholding
Liabilities:Payroll:Medicare -120.83 USD ; Employee withholding
Assets:Bank:Checking -7,133.33 USD ; Net pay debited from bank

When your payroll provider remits those taxes to the government on your behalf, you'll record another transaction to clear out the liabilities.

; This represents the tax payment made by your payroll provider.
2025-02-15 * "EFTPS" "Federal payroll tax deposit"
Liabilities:Payroll:Federal:FIT 1,200.00 USD
Liabilities:Payroll:FICA 516.67 USD
Liabilities:Payroll:Medicare 120.83 USD
Assets:Bank:Checking -1,837.50 USD ; This amount matches the tax portion of the Gusto debit.

Health Insurance for a >2% Shareholder

Record the premium payment as a business expense. You can use metadata to remind yourself that this needs to be reported on the W-2.

2025-02-01 * "BlueCross" "Shareholder health insurance (report on W-2)"
Expenses:Benefits:HealthInsurance 600.00 USD ; w2: "true"
Assets:Bank:Checking -600.00 USD

Owner Distributions (Not Wages)

Distributions are a reduction of equity, not a business expense. Record them separately from payroll.

2025-03-31 * "Owner Distribution" "Q1 distribution"
Equity:Distributions 20,000.00 USD
Assets:Bank:Checking -20,000.00 USD

Your shareholder basis determines whether distributions are tax-free and whether you can deduct business losses on your personal return. While the official calculation is done on your tax return, you can track an estimate in Beancount using a dedicated equity subaccount or metadata. You'll reconcile this to the Schedule K-1 you receive from the S-corp annually.

A Note on the QBI Deduction (Section 199A)

Owners of pass-through businesses, including S-corps, may be eligible for up to a 20% deduction on their qualified business income (QBI). However, for taxpayers with income above a certain threshold, this deduction can be limited by the amount of W-2 wages the business pays. This creates a complex interplay: paying a reasonable salary is required for an S-corp, and those same wages can impact your QBI deduction—sometimes helping it, sometimes limiting it. This is a key area to model with your tax professional.

What Changes Operationally After You Elect?

Switching to an S-corp adds a few administrative layers:

  • Run Payroll: You must formally run payroll, complete with tax withholdings, employer tax payments, quarterly filings, and year-end W-2s.
  • File Form 1120-S: This is the annual S-corporation tax return. You'll also issue a Schedule K-1 to each shareholder detailing their share of the company's financial results.
  • Handle Shareholder Health Insurance Correctly: Ensure premiums for >2% owners are included in their W-2 wages.
  • Mind State Rules: Stay on top of any required state-level S-corp elections or entity taxes (like in CA and NY).

Common Pitfalls to Avoid

  • Late or Invalid Election: Double-check deadlines and ensure all required shareholders sign Form 2553. If you miss it, investigate relief under Rev. Proc. 2013-30.
  • Unreasonable Salary: Don't be tempted to pay yourself an artificially low salary. Document why your compensation is reasonable based on your role and market data.
  • Mixing Wages and Distributions: Keep these transactions clean and separate in your books. Distributions are not payroll.
  • Ignoring State Requirements: Forgetting a state election or failing to pay an entity-level tax can lead to penalties and compliance headaches.

Quick Checklist

  • Confirm you are eligible and that the potential tax savings outweigh the new costs.
  • Calendar the Form 2553 filing deadline (and remember the weekend/holiday rule).
  • Set up a payroll service and determine a well-documented, reasonable salary.
  • Plan to take distributions only after salary and business expenses are paid.
  • Investigate and comply with your state's specific S-corp filing requirements and taxes.
  • Update your Beancount ledger with the necessary accounts for payroll, liabilities, and shareholder equity.

Beancount S‑Corp Starter (neutral template)

;
; Beancount S‑Corp Starter (neutral template)
; Generated: 2025-08-09
; ---
; How to use this:
; 1) Search for "TODO" and fill in your state(s), payroll provider, EIN, and bank names.
; 2) Keep wages and owner distributions separate.
; 3) Coordinate with your payroll provider to report >2% shareholder health insurance on the W‑2 (Box 1).
; 4) Delete or adapt the CA/NY examples if you’re in a different state.
;
; Notes:
; - This is a bookkeeping template, not tax advice.
; - Operating currency assumed USD. Change as needed.
;

option "title" "S‑Corp Ledger"
option "operating_currency" "USD"
commodity USD

; === Accounts (open as of 2025-01-01; adjust dates as needed) ==================
2025-01-01 open Assets:Bank:Checking USD ; TODO: Rename to your bank (e.g., Assets:Bank:Chase:Operating)
2025-01-01 open Assets:Bank:Savings USD
2025-01-01 open Assets:AccountsReceivable USD
2025-01-01 open Assets:PrepaidExpenses USD

2025-01-01 open Liabilities:CreditCard:Corporate USD
2025-01-01 open Liabilities:Payroll:Federal:FIT USD
2025-01-01 open Liabilities:Payroll:Federal:FICA USD
2025-01-01 open Liabilities:Payroll:Federal:Medicare USD
2025-01-01 open Liabilities:Payroll:Federal:FUTA USD
2025-01-01 open Liabilities:Payroll:State:Withholding USD ; TODO: Rename state (e.g., CA, NY)
2025-01-01 open Liabilities:Payroll:State:Unemployment USD
2025-01-01 open Liabilities:Payroll:Local USD

2025-01-01 open Equity:ContributedCapital USD
2025-01-01 open Equity:Distributions USD
2025-01-01 open Equity:RetainedEarnings USD
2025-01-01 open Equity:OpeningBalances USD

2025-01-01 open Income:Sales USD
2025-01-01 open Income:Other USD

2025-01-01 open Expenses:COGS USD
2025-01-01 open Expenses:Payroll:Wages USD
2025-01-01 open Expenses:Payroll:EmployerTaxes:FICA USD
2025-01-01 open Expenses:Payroll:EmployerTaxes:Medicare USD
2025-01-01 open Expenses:Payroll:EmployerTaxes:FUTA USD
2025-01-01 open Expenses:Payroll:EmployerTaxes:State USD
2025-01-01 open Expenses:Benefits:HealthInsurance USD
2025-01-01 open Expenses:Benefits:HSA USD
2025-01-01 open Expenses:Benefits:Retirement:Match USD
2025-01-01 open Expenses:Taxes:State:S‑Corp USD ; e.g., CA 1.5% entity‑level tax
2025-01-01 open Expenses:Taxes:State:Franchise USD ; e.g., CA $800 minimum franchise tax
2025-01-01 open Expenses:Professional:Payroll USD
2025-01-01 open Expenses:Professional:Accounting USD
2025-01-01 open Expenses:Professional:Legal USD
2025-01-01 open Expenses:BankFees USD
2025-01-01 open Expenses:Software USD
2025-01-01 open Expenses:Office USD
2025-01-01 open Expenses:Meals USD
2025-01-01 open Expenses:Travel USD
2025-01-01 open Expenses:Insurance:GeneralLiability USD

; === Example: Owner capitalization =================================================
2025-01-02 * "Owner" "Initial capital contribution"
Assets:Bank:Checking 25,000.00 USD
Equity:ContributedCapital -25,000.00 USD

; === Example: Customer payment =====================================================
2025-01-15 * "Stripe" "January subscription receipts"
Assets:Bank:Checking 12,000.00 USD
Income:Sales -12,000.00 USD

; === Example: Monthly payroll (single shareholder‑employee) ========================
; Numbers chosen to balance perfectly. Adapt FIT/State numbers to your reality.
; Gross wages: 8,333.33 | Employee FIT: 1,200.00 | State Withholding: 300.00
; Employee FICA (6.2%): 516.67 | Employee Medicare (1.45%): 120.83
; Employer FICA: 516.67 | Employer Medicare: 120.83
; Net pay: 6,195.83
2025-01-31 * "Gusto" "Jan payroll — shareholder‑employee"
Expenses:Payroll:Wages 8,333.33 USD
Expenses:Payroll:EmployerTaxes:FICA 516.67 USD
Expenses:Payroll:EmployerTaxes:Medicare 120.83 USD
Liabilities:Payroll:Federal:FIT -1,200.00 USD
Liabilities:Payroll:Federal:FICA -1,033.34 USD ; employee + employer
Liabilities:Payroll:Federal:Medicare -241.66 USD ; employee + employer
Liabilities:Payroll:State:Withholding -300.00 USD
Assets:Bank:Checking -6,195.83 USD

; === Example: Payroll tax deposits (EFTPS & State) =================================
2025-02-15 * "EFTPS" "Federal payroll deposit (FIT, FICA, Medicare)"
Liabilities:Payroll:Federal:FIT 1,200.00 USD
Liabilities:Payroll:Federal:FICA 1,033.34 USD
Liabilities:Payroll:Federal:Medicare 241.66 USD
Assets:Bank:Checking -2,475.00 USD

2025-02-16 * "STATE DOR" "State payroll withholding"
Liabilities:Payroll:State:Withholding 300.00 USD
Assets:Bank:Checking -300.00 USD

; === Example: Health insurance for >2% shareholder =================================
; Coordinate with payroll so the annual premium total is included in W‑2 Box 1.
; The premium itself is deductible here; do NOT withhold SS/Medicare on it when handled properly.
2025-02-01 * "BlueCross" "Shareholder health insurance (W‑2 inclusion handled by payroll)"
Expenses:Benefits:HealthInsurance 600.00 USD ; w2: "true"
Assets:Bank:Checking -600.00 USD

; === Example: Owner distribution (not wages) =======================================
2025-03-31 * "Owner Distribution" "Q1 distribution"
Equity:Distributions 20,000.00 USD
Assets:Bank:Checking -20,000.00 USD

; === State examples (delete/edit if not applicable) =================================
; California minimum franchise tax (not always first year; check rules)
2025-04-15 * "California FTB" "Annual franchise tax"
Expenses:Taxes:State:Franchise 800.00 USD
Assets:Bank:Checking -800.00 USD

; California S‑Corp 1.5% entity‑level tax (example estimate payment)
2025-06-15 * "California FTB" "S‑Corp tax estimate"
Expenses:Taxes:State:S‑Corp 1,500.00 USD
Assets:Bank:Checking -1,500.00 USD

; New York separate S election (CT‑6) has no direct ledger impact; placeholder note.
2025-01-05 note Equity:RetainedEarnings "NY S‑election (CT‑6) filed — bookkeeping note only (no entry)"

; === Basis tracking (optional — off‑book memo) =====================================
2025-12-31 note Equity:RetainedEarnings "Basis rollforward: +Capital 25,000 +Income 60,000 −Distributions 20,000 = End basis 65,000 (reconcile to K‑1)"

; === Import hints (CSV from Gusto/ADP) =============================================
; - For Gusto payroll register CSVs, map columns:
; Gross Pay -> Expenses:Payroll:Wages
; Employee FIT/FICA/Medicare -> Liabilities:Payroll:Federal:FIT/FICA/Medicare (negative)
; State Withholding -> Liabilities:Payroll:State:Withholding (negative)
; Employer FICA/Medicare/FUTA/SUTA -> Expenses:Payroll:EmployerTaxes:* (positive) AND
; if your CSV lists employer taxes as amounts owed, mirror them as Liabilities:* (negative),
; then clear with your EFTPS/state payments.
; Net Pay -> Assets:Bank:Checking (negative, matches pay date)
; - Health insurance paid by company:
; Vendor payment -> Expenses:Benefits:HealthInsurance (positive) / Bank (negative);
; ensure payroll includes the annual premium in W‑2 Box 1 for >2% shareholder.
;
; Tips:
; - Keep distributions out of payroll accounts.
; - Use tags like #payroll #distribution to filter in Fava.
; - Consider separate bank subaccounts for tax set‑asides (federal/state).

User Experience and Feedback on LLM-Assisted Plain Text Accounting

· 5 min read
Mike Thrift
Mike Thrift
Marketing Manager

Plain text accounting (PTA) has long been the secret weapon of tech-savvy finance nerds. Using simple text files and tools like Beancount or Ledger, you get unparalleled control, transparency, and ownership over your financial data. But let's be honest—it's always had a reputation for being, well, a pain. The learning curve is steep, the data entry is tedious, and one misplaced comma can send you on a frustrating debugging quest.

But what if you could have the power of PTA without the pain? Enter Large Language Models (LLMs). AI is starting to creep into every corner of the PTA workflow, promising to automate the boring stuff and make this powerful system accessible to everyone. Based on a deep dive into user feedback, let's explore how AI is revolutionizing plain text accounting—and whether it's living up to the hype.


The Old Way: The Manual Grind of PTA

For years, the PTA experience has been defined by a few common hurdles:

  • The Wall of Intimidation: Newcomers often feel overwhelmed. As one user admitted, "I was too intimidated for years... but it seemed useful and would eventually pay off." Between learning double-entry bookkeeping and navigating command-line tools, getting started is tough.
  • The "Edit-Compile-Debug" Cycle: Unlike GUI software that screams at you the second you make a mistake, PTA errors often hide until you run a check. This slow feedback loop feels like debugging code, turning a simple data entry task into a chore.
  • The Import Nightmare: Getting your data into the system is a major bottleneck. It often involves manually downloading CSV files from multiple banks, cleaning them up, and running custom scripts—a brittle and time-consuming process. One user spent "about 4 hours catching up on importing the past ~8 months" of transactions, even with some automation.

Enter the AI Assistant: How LLMs Are Slashing the Workload

This is where AI is changing the game, acting as a powerful assistant to handle the most tedious parts of PTA.

Automating the Grunt Work: Categorization and Imports

This is the low-hanging fruit for AI. Instead of writing complex rules to figure out what "STARBUCKS #12345" is, you can just ask an LLM.

Users are reporting great success feeding transaction descriptions to models like GPT-4 and getting back perfect categorizations, like Expenses:Food:Coffee. Tools like Beanborg are even integrating ChatGPT to intelligently suggest categories when its own rules fail.

Even better, LLMs are becoming on-the-fly data importers. Instead of writing a Python script to parse a bank's messy CSV file, you can now paste the data into a chat window and ask the AI to convert it to Beancount format. It's not always 100% perfect, but it turns hours of coding into a few minutes of prompt engineering.

Making PTA Less Scary: Onboarding and Error Handling

That initial wall of intimidation? LLMs are helping users climb it. One new user described using GPT-4 as a "hand-holding tutor" to walk them through setting up their first ledger file. The AI explained concepts, generated example entries, and helped them build the confidence to go it alone.

AI is also providing the real-time feedback that PTA has always lacked. Developers are building editor extensions that use LLMs to check your syntax as you type, highlighting imbalances or errors with the familiar red squiggly line. Imagine an AI that not only flags an error but also explains why it's wrong and suggests a fix.

Chatting With Your Finances

Perhaps the most exciting development is the rise of conversational analysis. Instead of writing a specific command-line query, you can now just ask your ledger questions in plain English.

Users are experimenting with exporting their data and using tools like Claude to ask things like, "How much did I spend on groceries in March compared to April?" The AI can analyze the data, spot trends, and even offer insights. In the business world, companies like Puzzle.io offer Slack bots that let executives query company financials in real-time. This kind of natural language interface is a game-changer for making financial data accessible.


The Catch: Don't Fire Your Brain Just Yet

While the possibilities are exciting, users are right to be cautious. Two major concerns consistently come up: privacy and trust.

  • Privacy is Paramount: Your financial history is incredibly sensitive. As one user put it, "I'm worried that I'm feeding some API with my financial history." Sending your data to a third-party cloud service like OpenAI is a non-starter for many. The solution? A growing number of users are running open-source LLMs locally on their own machines, ensuring their data never leaves their control.

  • Trust, but Verify: LLMs can be confidently wrong. They sometimes "hallucinate" account names or make small math errors that unbalance an entry. The community consensus is clear: use AI as an assistant, not an autonomous accountant. Always run your ledger through a final check (bean-check) and keep a human in the loop for final approval.


The Future is Augmented, Not Replaced

LLM assistance is rapidly transforming plain text accounting from a niche, expert-only system into a powerful tool that's becoming more accessible every day. The AI is fantastic at handling the repetitive, soul-crushing parts of bookkeeping—data entry, categorization, and parsing.

This frees up humans to do what they do best: review, interpret, and make decisions. The future isn't about letting a robot manage your money. It's about a partnership where the AI does the heavy lifting, giving you the clean, accurate data you need to truly understand your financial story.

As one user aptly put it, "Let the robots do the repetitive bookkeeping, so humans can focus on understanding and decision-making." With that balanced approach, the once-painful world of plain text accounting is looking brighter than ever.

Beancount's Technical Edge vs. Ledger, hledger, and GnuCash

· 6 min read
Mike Thrift
Mike Thrift
Marketing Manager

Choosing a personal accounting system involves trade-offs between performance, data architecture, and extensibility. For engineers and other technical users, the choice often comes down to which system provides the most robust, predictable, and programmable foundation.

Drawing from a detailed comparative report, let's analyze the technical specifics of Beancount versus its popular open-source counterparts: Ledger-CLI, hledger, and GnuCash.

2025-07-22-beancounts-technical-edge-a-deep-dive-on-performance-python-api-and-data-integrity-vs-ledger-hledger-and-gnucash


Speed and Performance: Quantitative Benchmarks 🚀

For any serious dataset, performance is non-negotiable. Beancount is architected to handle decades of transactional data without compromising on speed. Despite being implemented in Python (v2), its highly optimized parser is remarkably efficient.

  • Beancount: Real-world usage shows it can load and process ledgers with hundreds of thousands of transactions in approximately 2 seconds. Memory usage is modest; parsing ~100k transactions converts the source text into in-memory objects using only tens of megabytes of RAM.
  • The 1M Transaction Stress Test: A benchmark using a synthetic ledger of 1 million transactions, 1,000 accounts, and 1 million price entries revealed significant architectural differences:
    • hledger (Haskell): Successfully completed a full parse and report in ~80.2 seconds, processing ~12,465 txns/sec while using ~2.58 GB of RAM.
    • Ledger-CLI (C++): The process was terminated after 40 minutes without completion, likely due to a known regression causing excessive memory and CPU usage with highly complex ledgers.
    • Beancount: While not included in that specific 1M test, its performance curve suggests it would handle the task efficiently. Furthermore, the upcoming Beancount v3, with its new C++ core and Python API, is expected to deliver another order-of-magnitude improvement in throughput.
  • GnuCash (C/Scheme): As a GUI application loading its entire dataset into memory, performance degrades noticeably with size. A ~50 MB XML file (representing 100k+ transactions) took 77 seconds to open. Switching to the SQLite backend only marginally improved this to ~55 seconds.

Conclusion: Beancount provides exceptional performance that scales predictably, a crucial feature for long-term data management. It avoids the performance cliffs seen in Ledger and the UI-bound latency of GnuCash.


Data Architecture: Plain Text vs. Opaque Databases 📄

The way a system stores your data dictates its transparency, portability, and durability. Beancount uses a clean, human-readable plain text format that is superior for technical users.

  • Compact & Efficient: A 100,000-transaction Beancount file is only ~8.8 MB. This is more compact than the equivalent Ledger file (~10 MB) partly because Beancount's syntax allows for the inference of the final balancing amount in a transaction, reducing redundancy.
  • Structurally Enforced: Beancount mandates explicit YYYY-MM-DD\ open\ Account directives. This disciplined approach prevents account name typos from silently creating new, incorrect accounts—a common pitfall in systems like Ledger and hledger which create accounts on-the-fly. This structure makes the data more reliable for programmatic manipulation.
  • Version Control Ready: A plain text ledger is perfectly suited for version control with Git. You get a complete, auditable history of every financial change you make.
  • Contrast with GnuCash: GnuCash defaults to a gzip-compressed XML file, where data is verbose and wrapped in tags with GUIDs for every entity. While it offers SQLite, MySQL, and PostgreSQL backends, this abstracts the data away from simple, direct text manipulation and versioning. Editing the raw XML is possible but far more cumbersome than editing a Beancount file.

Conclusion: Beancount's data format is not just text; it's a well-defined language that maximizes clarity, enforces correctness, and integrates seamlessly with developer tools like git and grep.


The Killer Feature: A True Python API and Plugin Architecture 🐍

This is Beancount's defining technical advantage. It is not a monolithic application but a library with a stable, first-class Python API. This design decision unlocks limitless automation and integration possibilities.

  • Direct Programmatic Access: You can read, query, and manipulate your ledger data directly in Python. This is why developers migrate. As one user noted, the frustration of trying to script against Ledger's poorly documented internal bindings evaporates with Beancount.
  • Plugin Pipeline: Beancount's loader allows you to insert custom Python functions directly into the processing pipeline. This enables arbitrary transformations and validations on the data stream as it's being loaded—for instance, writing a plugin to enforce that every expense from a specific vendor must have a certain tag.
  • Powerful Importer Framework: Move beyond clunky CSV import wizards. With Beancount, you write Python scripts to parse financial statements from any source (OFX, QFX, CSV). Community tools like smart_importer even leverage machine learning models to automatically predict and assign posting accounts, turning hours of manual categorization into a seconds-long, one-command process.
  • How Others Compare:
    • Ledger/hledger: Extensibility is primarily external. You pipe data to/from the executable. While they can output JSON/CSV, you cannot inject logic into their core processing loop without modifying the C++/Haskell source.
    • GnuCash: Extensibility is handled via a steep learning curve with Guile (Scheme) for custom reports or via Python bindings (using SWIG and libraries like PieCash) that interact with the GnuCash engine. It's powerful but less direct and "Pythonic" than Beancount's native library approach.

Conclusion: Beancount is architected for the programmer. Its library-first design and deep integration with Python make it the most flexible and automatable system of the four.


Philosophy: A Strict Compiler for Your Finances 🤓

Beancount's learning curve is a direct result of its core philosophy: your financial data is a formal language, and it must be correct.

Beancount's parser functions like a strict compiler. It performs robust syntactical and logical validation. If a transaction doesn't balance or an account hasn't been opened, it will refuse to process the file and will return a descriptive error with a line number. This is a feature, not a bug. It guarantees that if your file "compiles," the underlying data is structurally sound.

This deterministic approach ensures a level of data integrity that is invaluable for building reliable automated systems on top of it. You can write scripts that consume Beancount's output with confidence, knowing the data has already been rigorously validated.

Who is Beancount For?

Based on this technical analysis, Beancount is the optimal choice for:

  • Developers and Engineers who want to treat their finances as a version-controlled, programmable dataset.
  • Data Tinkers who want to write custom queries, build unique visualizations with tools like Fava, or feed their financial data into other analytical models.
  • Anyone who values demonstrable correctness and automation over the convenience of a GUI or the leniency of a less-structured format.

If you desire raw C++ performance for standard reports, Ledger is a contender. For exceptional scalability in a functional programming paradigm, hledger is impressive. For a feature-packed GUI with minimal setup, GnuCash excels.

But if you want to build a truly robust, automated, and deeply customized financial management system, Beancount provides the superior technical foundation.

The Complete Guide to Cryptocurrency Accounting with Beancount.io

· 11 min read
Mike Thrift
Mike Thrift
Marketing Manager

Are you drowning in crypto transactions across multiple exchanges, struggling with DeFi complexity, or panicking about tax season? You're not alone. The cryptocurrency landscape has exploded from simple Bitcoin purchases to a sophisticated ecosystem of DeFi protocols, staking rewards, yield farming, and cross-chain activities that challenge traditional accounting methods.

Here's the harsh reality: every crypto transaction is potentially taxable, and the IRS is watching. Whether you're a casual Bitcoin holder or a DeFi power user managing positions across dozens of protocols, maintaining accurate financial records isn't optional—it's essential for compliance and financial clarity.

The problem? Traditional accounting software has limited native support for crypto's complexity. While tools like QuickBooks can handle crypto with additional plugins, and Excel can import blockchain data with scripts, most solutions require significant customization for comprehensive crypto accounting.

The solution? Beancount.io's plain-text accounting system built on the powerful open-source Beancount language. Important note: Beancount is an open-source double-entry accounting language created by Martin Blais, while Beancount.io is a commercial hosting service that provides a user-friendly interface and cloud infrastructure for Beancount. This guide covers both the underlying Beancount principles and how to use them effectively through the Beancount.io platform.

Complete Guide to Cryptocurrency Accounting

The Cryptocurrency Accounting Nightmare (And Why It's Getting Worse)

Your Crypto Portfolio is Scattered Everywhere

Let's be honest about your setup. You probably have:

  • 3-5 different exchanges (Coinbase for easy buys, Binance for altcoins, Kraken for that one token...)
  • Multiple wallets (MetaMask for DeFi, Ledger for long-term holds, that old wallet you forgot about...)
  • DeFi positions across 10+ protocols (Uniswap, Compound, Aave, and whatever new yield farm caught your attention)
  • Staking rewards trickling in from various validators
  • Random airdrops appearing in your wallet like crypto Christmas presents

Each platform speaks a different language. Coinbase gives you a CSV that looks nothing like Binance's export. Uniswap doesn't even have exports. And don't get me started on tracking your DeFi positions across Layer 2 networks.

Transaction Types That Challenge Traditional Accounting

Your crypto activities include transaction types that traditional accounting systems weren't originally designed to handle:

  • Impermanent loss from liquidity providing (try explaining that to QuickBooks)
  • Flash loans that borrow and repay millions in a single transaction
  • Yield farming where you earn 5 different tokens for providing liquidity
  • Cross-chain bridges that make assets disappear on one network and appear on another
  • Staking derivatives like stETH that accrue value differently than the underlying asset
  • DAO governance tokens that you received for using protocols

The Tax Compliance Minefield

Here's what keeps crypto investors awake at night:

  • Every single trade is taxable (yes, even that ETH-to-USDC swap)
  • Cost basis tracking becomes impossible with hundreds of micro-transactions
  • Staking rewards are income the moment you receive them (at fair market value)
  • DeFi rewards are income even if you can't sell them yet
  • The IRS wants Form 8949 with every single transaction listed
  • Penalties are severe for getting it wrong

Traditional accounting software requires significant customization for this complexity. While solutions exist, they often require additional plugins, scripts, or manual processes to handle the full scope of cryptocurrency activities.

Enter Beancount.io: The Crypto Accounting Solution You've Been Waiting For

What if I told you there's an accounting system designed for exactly this chaos? Beancount.io isn't just another accounting tool—it's a plain-text accounting revolution that handles cryptocurrency complexity like it was born for it.

Why Beancount.io Dominates Crypto Accounting

🔍 Complete Transparency: Every calculation is visible. No black boxes, no "trust us" algorithms. You see exactly how your cost basis is calculated, how gains are computed, and where every satoshi went.

📊 Unlimited Flexibility: Create any account structure you need. Track DeFi positions, staking derivatives, cross-chain assets, or that weird token you got from a DAO vote. If you can imagine it, you can track it.

🎯 Precise Cost Basis: Lot-based tracking with specific identification. Choose exactly which Bitcoin you're selling for optimal tax outcomes. FIFO, LIFO, or cherry-pick your lots—your choice.

🔗 Future-Proof: Plain-text format means your data is yours forever. No vendor lock-in, no proprietary formats, no "sorry, we're shutting down" emails.

⚡ Scriptable Power: Automate imports, generate custom reports, and integrate with any tool. Because your crypto portfolio is unique, your accounting should be too.

Setting Up Your Crypto Command Center

Building Your Account Architecture

Think of this as designing the blueprint for your crypto empire. We're creating a structure that can handle everything from your first Bitcoin purchase to complex multi-protocol DeFi strategies:

Note: The examples use 1970-01-01 as a placeholder opening date. For actual use, replace with your real account opening dates, especially if using automated import tools that filter transactions by date.

; Exchange Accounts
1970-01-01 open Assets:Crypto:Coinbase:USD
1970-01-01 open Assets:Crypto:Coinbase:BTC
1970-01-01 open Assets:Crypto:Coinbase:ETH
1970-01-01 open Assets:Crypto:Binance:USD
1970-01-01 open Assets:Crypto:Binance:BTC
1970-01-01 open Assets:Crypto:Binance:ETH
1970-01-01 open Assets:Crypto:Binance:ADA

; Wallet Accounts
1970-01-01 open Assets:Crypto:Wallet:MetaMask:ETH
1970-01-01 open Assets:Crypto:Wallet:MetaMask:USDC
1970-01-01 open Assets:Crypto:Wallet:MetaMask:UNI
1970-01-01 open Assets:Crypto:Wallet:Ledger:BTC
1970-01-01 open Assets:Crypto:Wallet:Ledger:ETH

; DeFi Protocol Accounts
1970-01-01 open Assets:DeFi:Compound:cUSDC
1970-01-01 open Assets:DeFi:Uniswap:ETH-USDC-LP
1970-01-01 open Assets:Staking:Ethereum:ETH
1970-01-01 open Assets:Crypto:Mining:BTC

; Income Accounts
1970-01-01 open Income:Crypto:Staking:ETH
1970-01-01 open Income:Crypto:Mining:BTC
1970-01-01 open Income:Crypto:Airdrops
1970-01-01 open Income:Crypto:DeFi:Yield
1970-01-01 open Income:CapitalGains:Crypto
1970-01-01 open Income:Crypto:Trading:Margin

; Expense Accounts
1970-01-01 open Expenses:Crypto:Fees:Trading
1970-01-01 open Expenses:Crypto:Fees:Network
1970-01-01 open Expenses:Crypto:Fees:Withdrawal

; Additional accounts for advanced scenarios
1970-01-01 open Assets:Crypto:Binance:BTC-Margin
1970-01-01 open Liabilities:Crypto:Binance:Borrowed
1970-01-01 open Liabilities:Crypto:Binance:BTC
1970-01-01 open Assets:Checking
1970-01-01 open Expenses:Crypto:Mining:Electricity

Commodity Definitions

Define your cryptocurrencies as commodities with proper metadata:

1970-01-01 commodity BTC
name: "Bitcoin"
asset-class: "cryptocurrency"
price-source: "coinbase"

1970-01-01 commodity ETH
name: "Ethereum"
asset-class: "cryptocurrency"
price-source: "coinbase"

1970-01-01 commodity ADA
name: "Cardano"
asset-class: "cryptocurrency"
price-source: "binance"

1970-01-01 commodity USDC
name: "USD Coin"
asset-class: "stablecoin"
price-source: "coinbase"

1970-01-01 commodity UNI
name: "Uniswap"
asset-class: "cryptocurrency"
price-source: "coinbase"

1970-01-01 commodity UNI-V2-ETH-USDC
name: "Uniswap V2 ETH-USDC LP Token"
asset-class: "liquidity-pool"

Mastering Crypto Transactions: From Simple to Sophisticated

Ready to see Beancount.io in action? Let's walk through real-world scenarios that would break other accounting systems but are handled elegantly here.

1. Your First Bitcoin Purchase (The Gateway Drug)

Every crypto journey starts somewhere. Here's how to record that life-changing moment when you bought your first Bitcoin:

2024-01-15 * "Buy 0.5 BTC on Coinbase"
Assets:Crypto:Coinbase:BTC 0.5 BTC {30000.00 USD}
Assets:Crypto:Coinbase:USD -15025.00 USD
Expenses:Crypto:Fees:Trading 25.00 USD

2. Taking Profits (Or Cutting Losses) Like a Pro

The moment of truth: selling your crypto. This is where most accounting systems fall apart, but Beancount.io shines with precise cost basis tracking:

2024-03-20 * "Sell 0.3 BTC on Coinbase"
Assets:Crypto:Coinbase:BTC -0.3 BTC {30000.00 USD}
Assets:Crypto:Coinbase:USD 10470.00 USD
Expenses:Crypto:Fees:Trading 30.00 USD
Income:CapitalGains:Crypto 1440.00 USD ; 10470 - (0.3 × 30000) - 30 = 1440

3. Staking Rewards: Earning While You Sleep

Passive income at its finest. But remember, the IRS requires staking rewards to be reported as taxable income when received, based on fair market value at the time of receipt (per IRS Digital Assets guidance, 2024). While there is ongoing litigation (Jarrett v. United States), the current official position requires immediate reporting. Here's how to track them properly:

2024-02-01 * "ETH Staking Rewards"
Assets:Staking:Ethereum:ETH 0.05 ETH {2500.00 USD}
Income:Crypto:Staking:ETH 125.00 USD

4. DeFi Yield Farming: Where Things Get Spicy 🌶️

Welcome to advanced DeFi accounting. DeFi yield farming involves complex multi-token transactions that require sophisticated tracking. Here's how to properly account for a Uniswap liquidity position:

; Initial liquidity provision
2024-01-10 * "Add liquidity to ETH-USDC pool"
Assets:Crypto:Wallet:MetaMask:ETH -10 ETH {2500.00 USD}
Assets:Crypto:Wallet:MetaMask:USDC -25000 USDC {1.00 USD}
Assets:DeFi:Uniswap:ETH-USDC-LP 100 UNI-V2-ETH-USDC {500.00 USD}

; Claiming rewards
2024-02-10 * "Claim Uniswap LP rewards"
Assets:Crypto:Wallet:MetaMask:UNI 50 UNI {8.00 USD}
Income:Crypto:DeFi:Yield 400.00 USD

5. Cross-Exchange Transfers

Moving Bitcoin from Coinbase to Ledger wallet:

2024-01-20 * "Transfer BTC from Coinbase to Ledger"
Assets:Crypto:Coinbase:BTC -1.0 BTC {30000.00 USD}
Assets:Crypto:Wallet:Ledger:BTC 0.9995 BTC {30000.00 USD}
Expenses:Crypto:Fees:Withdrawal 0.0005 BTC {30000.00 USD}

Advanced Cryptocurrency Scenarios

Margin Trading

Recording leveraged positions:

; Opening a leveraged long position (borrowing BTC)
2024-02-15 * "Open 2x leveraged BTC position"
Assets:Crypto:Binance:BTC-Margin 1.0 BTC {35000.00 USD}
Liabilities:Crypto:Binance:BTC -1.0 BTC {35000.00 USD}
Expenses:Crypto:Fees:Trading 50.00 USD
Assets:Crypto:Binance:USD -50.00 USD

; Closing the position with profit
2024-02-20 * "Close leveraged BTC position"
Assets:Crypto:Binance:BTC-Margin -1.0 BTC {35000.00 USD}
Assets:Crypto:Binance:USD 37950.00 USD
Liabilities:Crypto:Binance:BTC 1.0 BTC {35000.00 USD}
Income:Crypto:Trading:Margin -2900.00 USD
Expenses:Crypto:Fees:Trading 50.00 USD

Airdrops and Forks

Recording free token distributions:

2024-03-01 * "Received UNI airdrop"
Assets:Crypto:Wallet:MetaMask:UNI 400 UNI {8.00 USD}
Income:Crypto:Airdrops 3200.00 USD

Mining Operations

For cryptocurrency miners:

2024-01-01 * "Bitcoin mining reward"
Assets:Crypto:Mining:BTC 0.1 BTC {45000.00 USD}
Income:Crypto:Mining:BTC 4500.00 USD

; Mining expenses
2024-01-31 * "Mining electricity costs"
Expenses:Crypto:Mining:Electricity 800.00 USD
Assets:Checking -800.00 USD

Tax Reporting and Compliance

Cost Basis Tracking

Beancount.io automatically tracks cost basis using the lot-based system:

; Multiple purchases at different prices
2024-01-01 * "Buy BTC batch 1"
Assets:Crypto:Coinbase:BTC 1.0 BTC {40000.00 USD}
Assets:Crypto:Coinbase:USD -40000.00 USD

2024-02-01 * "Buy BTC batch 2"
Assets:Crypto:Coinbase:BTC 1.0 BTC {45000.00 USD}
Assets:Crypto:Coinbase:USD -45000.00 USD

; Selling specific lots (FIFO, LIFO, or specific identification)
2024-03-01 * "Sell BTC using FIFO"
Assets:Crypto:Coinbase:BTC -0.5 BTC {40000.00 USD}
Assets:Crypto:Coinbase:USD 22470.00 USD
Expenses:Crypto:Fees:Trading 30.00 USD
Income:CapitalGains:Crypto 2440.00 USD ; 22470 - 20000 - 30 = 2440

Generating Tax Reports

Use Beancount's query system and plugins to generate tax reports:

  • Form 8949: Capital gains and losses (via bean-query or third-party plugins)
  • Schedule D: Summary of capital gains (requires additional scripting)
  • Form 1040: Income from staking, mining, airdrops (via custom reports)
  • Detailed transaction logs: For audit purposes

Note: Tax report generation requires additional plugins, scripts, or integration with specialized tax software. Beancount provides the data foundation, but specific tax forms typically require custom development or third-party tools.

Best Practices for Crypto Accounting

1. Regular Reconciliation

  • Import exchange data weekly
  • Verify wallet balances monthly
  • Cross-check with blockchain explorers

2. Proper Documentation

  • Save all transaction confirmations
  • Document the purpose of each transaction
  • Maintain records of market prices at transaction time

3. Separate Business and Personal

; Personal crypto investments
Assets:Personal:Crypto:Coinbase:BTC

; Business crypto operations
Assets:Business:Crypto:Treasury:BTC

4. Track All Income Sources

  • Staking rewards (taxable as income)
  • Mining rewards (taxable as income)
  • Airdrops (taxable at fair market value)
  • DeFi yield (taxable as income)

5. Fee Management

Track all fees separately for proper tax deduction:

Expenses:Crypto:Fees:Trading     ; Exchange trading fees
Expenses:Crypto:Fees:Network ; Blockchain network fees
Expenses:Crypto:Fees:Withdrawal ; Withdrawal fees

Exchange API Integration

Beancount.io can integrate with major exchanges:

  • Coinbase Pro API: Automatic transaction import
  • Binance API: Real-time balance updates
  • Kraken API: Historical data synchronization

Blockchain Analysis

Connect with blockchain explorers:

  • Etherscan: Ethereum transaction verification
  • Blockchain.info: Bitcoin transaction tracking
  • BscScan: Binance Smart Chain monitoring

Portfolio Tracking

Sync with portfolio management tools:

  • CoinTracker: Tax report generation
  • Koinly: Multi-exchange aggregation
  • Blockfolio: Mobile portfolio tracking

Important Disclaimers

Tax and Legal Notice: This guide provides general information about cryptocurrency accounting using Beancount and does not constitute professional tax, legal, or financial advice. Tax treatment of cryptocurrency transactions varies by jurisdiction and individual circumstances. Complex scenarios like cross-chain bridges, impermanent loss, and flash loans may have unclear tax implications under current regulations. For specific guidance on whether transactions constitute taxable dispositions, refer to IRS FAQ Q-15 through Q-18 (2024) or consult local tax regulations. Always consult with a qualified tax professional or CPA familiar with cryptocurrency taxation in your jurisdiction before making tax-related decisions.

Software Clarification: Examples in this guide use standard Beancount syntax. While Beancount.io provides a user-friendly interface for Beancount, the underlying accounting principles apply to any Beancount implementation.

Conclusion

Cryptocurrency accounting doesn't have to be overwhelming. With Beancount's powerful plain-text accounting system, accessible through Beancount.io's platform, you can:

  • Maintain Complete Transparency: Every transaction is visible and auditable
  • Ensure Tax Compliance: Proper cost basis tracking and income reporting
  • Scale with Your Portfolio: Handle simple trades to complex DeFi strategies
  • Integrate Seamlessly: Connect with exchanges, wallets, and tax tools
  • Future-Proof Your Records: Plain-text format ensures long-term accessibility

Whether you're a casual Bitcoin holder or a sophisticated DeFi yield farmer, Beancount provides the foundation and flexibility needed to master cryptocurrency accounting. Start with basic transactions and gradually incorporate more complex scenarios as your crypto journey evolves.

The examples in this guide provide a solid foundation, but remember that cryptocurrency accounting is an evolving field. Stay informed about regulatory changes, consult with tax professionals, and adapt your accounting practices as needed.

Ready to take control of your cryptocurrency finances? Sign up for Beancount.io and experience the power of transparent, scriptable crypto accounting built on the robust Beancount foundation.

Cryptocurrency Tax Compliance Guide: Mastering IRS Requirements with Beancount.io

· 9 min read
Mike Thrift
Mike Thrift
Marketing Manager

Cryptocurrency taxation has evolved from a niche concern to a critical compliance requirement for millions of investors. With the IRS increasing enforcement and requiring detailed reporting, accurate record-keeping isn't just good practice—it's essential for avoiding penalties and optimizing your tax liability.

This comprehensive guide shows you how to achieve complete cryptocurrency tax compliance using Beancount.io's powerful plain-text accounting system, ensuring you meet all IRS requirements while maximizing tax efficiency.

Cryptocurrency Tax Compliance Guide

Understanding Cryptocurrency Tax Requirements

IRS Treatment of Cryptocurrency

The IRS treats cryptocurrency as property, not currency, which creates specific tax implications:

  • Every transaction is potentially taxable: Trading, selling, spending, or exchanging crypto
  • Cost basis must be tracked: For every unit of cryptocurrency owned
  • Holding period determines tax rate: Short-term vs. long-term capital gains
  • Income recognition required: For mining, staking, airdrops, and DeFi rewards
  • Detailed records mandatory: Transaction-level documentation for audits

Key Tax Forms for Cryptocurrency

Form 1040 - Individual Income Tax Return

  • Line 1: Report crypto income (staking, mining, airdrops)
  • Schedule 1: Additional income sources
  • Digital Asset Question: Must answer "Yes" if you had crypto transactions

Form 8949 - Sales and Other Dispositions of Capital Assets

  • Part I: Short-term capital gains/losses (held ≤ 1 year)
  • Part II: Long-term capital gains/losses (held > 1 year)
  • Detailed transaction reporting: Date acquired, date sold, proceeds, cost basis

Schedule D - Capital Gains and Losses

  • Summary of Form 8949: Aggregated capital gains/losses
  • Net capital gain/loss: Final calculation for tax liability

Setting Up Tax-Compliant Crypto Accounting

Account Structure for Tax Reporting

Design your account hierarchy to align with tax requirements:

; Assets - Organized by holding period and source
1970-01-01 open Assets:Crypto:ShortTerm:Coinbase:BTC
1970-01-01 open Assets:Crypto:LongTerm:Coinbase:BTC
1970-01-01 open Assets:Crypto:Trading:Binance:ETH
1970-01-01 open Assets:Crypto:Investment:Ledger:BTC

; Income - Separated by tax treatment
1970-01-01 open Income:Crypto:Staking:Ordinary ; Taxed as ordinary income
1970-01-01 open Income:Crypto:Mining:Ordinary ; Taxed as ordinary income
1970-01-01 open Income:Crypto:Airdrops:Ordinary ; Taxed as ordinary income
1970-01-01 open Income:CapitalGains:ShortTerm ; Short-term capital gains
1970-01-01 open Income:CapitalGains:LongTerm ; Long-term capital gains

; Expenses - Tax deductible categories
1970-01-01 open Expenses:Crypto:Fees:Deductible ; Trading fees
1970-01-01 open Expenses:Crypto:Mining:Equipment ; Mining equipment
1970-01-01 open Expenses:Crypto:Mining:Electricity ; Mining electricity
1970-01-01 open Expenses:CapitalLoss:ShortTerm ; Short-term capital losses
1970-01-01 open Expenses:CapitalLoss:LongTerm ; Long-term capital losses

Metadata for Tax Compliance

Use metadata to track tax-relevant information:

2024-01-15 * "Buy BTC for long-term investment" ^investment-btc #long-term
purchase-date: "2024-01-15"
intended-holding: "long-term"
tax-lot-id: "BTC-001"
Assets:Crypto:LongTerm:Coinbase:BTC 1.0 BTC {45000.00 USD}
Assets:Crypto:Coinbase:USD -45000.00 USD
Expenses:Crypto:Fees:Deductible 50.00 USD
Assets:Crypto:Coinbase:USD -50.00 USD

Recording Taxable Cryptocurrency Events

1. Cryptocurrency Sales

Short-term Capital Gains (≤ 1 year)

2024-06-15 * "Sell BTC - Short-term capital gain" ^btc-sale-001
date-acquired: "2024-01-15"
holding-period: "151 days"
form-8949-code: "A"
Assets:Crypto:ShortTerm:Coinbase:BTC -0.5 BTC {45000.00 USD}
Assets:Crypto:Coinbase:USD 24000.00 USD
Expenses:Crypto:Fees:Deductible 30.00 USD
Assets:Crypto:Coinbase:USD -30.00 USD
Income:CapitalGains:ShortTerm 1470.00 USD ; 24000 - 22500 - 30

Long-term Capital Gains (> 1 year)

2025-02-01 * "Sell BTC - Long-term capital gain" ^btc-sale-002
date-acquired: "2024-01-15"
holding-period: "382 days"
form-8949-code: "D"
Assets:Crypto:LongTerm:Coinbase:BTC -0.5 BTC {45000.00 USD}
Assets:Crypto:Coinbase:USD 28000.00 USD
Expenses:Crypto:Fees:Deductible 35.00 USD
Assets:Crypto:Coinbase:USD -35.00 USD
Income:CapitalGains:LongTerm 5465.00 USD ; 28000 - 22500 - 35

2. Cryptocurrency-to-Cryptocurrency Trades

Every crypto-to-crypto trade is taxable:

2024-03-20 * "Trade BTC for ETH - Taxable exchange"
; Dispose of BTC (taxable event)
Assets:Crypto:Trading:Binance:BTC -1.0 BTC {46000.00 USD}
Income:CapitalGains:ShortTerm 2000.00 USD ; 48000 - 46000

; Acquire ETH (new cost basis)
Assets:Crypto:Trading:Binance:ETH 20 ETH {2400.00 USD}

; Trading fees
Expenses:Crypto:Fees:Deductible 40.00 USD
Assets:Crypto:Trading:Binance:USD -40.00 USD

3. Staking Rewards (Ordinary Income)

2024-01-31 * "ETH Staking Rewards - January"
reward-type: "staking"
fair-market-value: "2500.00 USD per ETH"
taxable-income: "200.00 USD"
Assets:Staking:Ethereum:ETH 0.08 ETH {2500.00 USD}
Income:Crypto:Staking:Ordinary 200.00 USD

4. Mining Income

2024-01-15 * "Bitcoin Mining Reward"
mining-pool: "Slush Pool"
block-height: "825000"
fair-market-value: "45000.00 USD per BTC"
Assets:Crypto:Mining:BTC 0.01 BTC {45000.00 USD}
Income:Crypto:Mining:Ordinary 450.00 USD

; Mining expenses (deductible)
Expenses:Crypto:Mining:Electricity 120.00 USD
Assets:Checking -120.00 USD

5. Airdrops and Hard Forks

2024-03-01 * "UNI Token Airdrop"
airdrop-source: "Uniswap Protocol"
fair-market-value: "8.00 USD per UNI"
taxable-amount: "3200.00 USD"
Assets:Crypto:Wallet:MetaMask:UNI 400 UNI {8.00 USD}
Income:Crypto:Airdrops:Ordinary 3200.00 USD

6. DeFi Activities

Yield Farming Rewards

2024-02-28 * "Compound Protocol Yield"
protocol: "Compound"
reward-token: "COMP"
fair-market-value: "85.00 USD per COMP"
Assets:Crypto:Wallet:MetaMask:COMP 12 COMP {85.00 USD}
Income:Crypto:DeFi:Ordinary 1020.00 USD

Liquidity Pool Fees

2024-02-15 * "Uniswap LP Fees Claimed"
protocol: "Uniswap V3"
pool: "ETH-USDC"
Assets:Crypto:Wallet:MetaMask:ETH 0.2 ETH {2600.00 USD}
Assets:Crypto:Wallet:MetaMask:USDC 300 USDC
Income:Crypto:DeFi:Ordinary 820.00 USD

Tax Optimization Strategies

1. Tax Loss Harvesting

Systematically realize losses to offset gains:

; Identify losing positions
2024-12-15 * "Tax Loss Harvesting - Sell ADA at loss"
purchase-date: "2024-06-01"
purchase-price: "0.60 USD per ADA"
sale-price: "0.45 USD per ADA"
Assets:Crypto:Trading:Binance:ADA -1000 ADA {0.60 USD}
Assets:Crypto:Trading:Binance:USD 445.00 USD
Expenses:Crypto:Fees:Deductible 5.00 USD
Assets:Crypto:Trading:Binance:USD -5.00 USD
Expenses:CapitalLoss:ShortTerm 150.00 USD ; Realized loss

2. Wash Sale Considerations

While wash sale rules don't officially apply to crypto, avoid potential issues:

; Wait 31 days before repurchasing
2025-01-16 * "Repurchase ADA after wash sale period"
wash-sale-safe: "31+ days elapsed"
Assets:Crypto:Trading:Binance:ADA 1000 ADA {0.45 USD}
Assets:Crypto:Trading:Binance:USD -450.00 USD
Expenses:Crypto:Fees:Deductible 5.00 USD
Assets:Crypto:Trading:Binance:USD -5.00 USD

3. Specific Identification Method

Choose which lots to sell for optimal tax outcomes:

; High-cost basis lot for loss harvesting
2024-11-30 * "Sell high-cost ETH lot for tax loss"
lot-selection: "specific-identification"
cost-basis: "3500.00 USD per ETH"
sale-price: "2400.00 USD per ETH"
Assets:Crypto:Trading:Coinbase:ETH -5 ETH {3500.00 USD}
Assets:Crypto:Trading:Coinbase:USD 11950.00 USD
Expenses:Crypto:Fees:Deductible 50.00 USD
Assets:Crypto:Trading:Coinbase:USD -50.00 USD
Expenses:CapitalLoss:ShortTerm 5500.00 USD ; Significant loss

4. Long-term vs Short-term Planning

Strategically time sales for favorable tax treatment:

; Hold for long-term treatment
2024-12-20 * "BTC approaching long-term status"
purchase-date: "2024-01-01"
days-held: "354"
long-term-date: "2025-01-02"
note: "Hold 11 more days for long-term treatment"

Automated Tax Reporting

Form 8949 Generation

Use Beancount.io queries to generate Form 8949 data:

-- Short-term capital gains/losses
SELECT
date,
narration,
-position as quantity_sold,
cost(position) as cost_basis,
value(position) as proceeds,
value(position) + cost(position) as gain_loss
WHERE account ~ "Income:CapitalGains:ShortTerm"
OR account ~ "Expenses:CapitalLoss:ShortTerm"
ORDER BY date;

Schedule D Summary

-- Capital gains summary
SELECT
'Short-term' as type,
sum(position) as total_gain_loss
WHERE account ~ "Income:CapitalGains:ShortTerm"
OR account ~ "Expenses:CapitalLoss:ShortTerm"

UNION ALL

SELECT
'Long-term' as type,
sum(position) as total_gain_loss
WHERE account ~ "Income:CapitalGains:LongTerm"
OR account ~ "Expenses:CapitalLoss:LongTerm";

Ordinary Income Reporting

-- Crypto ordinary income
SELECT
account,
sum(position) as total_income
WHERE account ~ "Income:Crypto.*:Ordinary"
GROUP BY account
ORDER BY total_income DESC;

Record Keeping and Documentation

Essential Documentation

Maintain comprehensive records for each transaction:

2024-01-15 * "BTC Purchase - Complete Documentation" ^btc-001
exchange: "Coinbase Pro"
transaction-id: "abc123def456"
confirmation-hash: "0x789..."
ip-address: "192.168.1.100"
timestamp: "2024-01-15T14:30:00Z"
market-price-source: "CoinGecko"
Assets:Crypto:LongTerm:Coinbase:BTC 1.0 BTC {45000.00 USD}
Assets:Crypto:Coinbase:USD -45000.00 USD

Audit Trail Maintenance

Create detailed audit trails:

; Link related transactions
2024-01-15 * "BTC Purchase" ^btc-purchase-001
2024-01-20 * "BTC Transfer to Wallet" ^btc-purchase-001
2024-06-15 * "BTC Sale" ^btc-purchase-001

Price Verification

Document price sources for fair market value:

2024-01-15 price BTC 45000.00 USD
source: "CoinGecko"
timestamp: "2024-01-15T14:30:00Z"
verification: "Multiple exchange average"

Common Tax Compliance Mistakes

1. Missing Transactions

  • Problem: Not reporting all taxable events
  • Solution: Comprehensive transaction tracking in Beancount.io

2. Incorrect Cost Basis

  • Problem: Using wrong cost basis calculation method
  • Solution: Lot-based tracking with specific identification

3. Missing Income Reporting

  • Problem: Not reporting staking, mining, or airdrop income
  • Solution: Separate income accounts for all sources

4. Inadequate Documentation

  • Problem: Insufficient records for audit defense
  • Solution: Detailed metadata and transaction linking

5. Timing Issues

  • Problem: Incorrect holding period calculations
  • Solution: Automated date tracking and alerts

Integration with Tax Software

Generate reports compatible with major tax software:

# Export to TurboTax format
def export_turbotax_format():
return {
'form_8949_short_term': query_short_term_gains(),
'form_8949_long_term': query_long_term_gains(),
'schedule_1_income': query_ordinary_income(),
'deductible_expenses': query_deductible_expenses()
}

Professional Tax Preparation

Provide CPAs with comprehensive reports:

-- Complete tax package for CPA
SELECT
'Capital Gains Summary' as report_type,
account,
sum(position) as amount
WHERE account ~ "Income:CapitalGains"
OR account ~ "Expenses:CapitalLoss"
GROUP BY account

UNION ALL

SELECT
'Ordinary Income Summary' as report_type,
account,
sum(position) as amount
WHERE account ~ "Income:Crypto.*:Ordinary"
GROUP BY account;

Year-End Tax Planning

December Tax Strategies

Implement year-end tax optimization:

; December tax planning checklist
2024-12-01 * "Year-end tax planning review"
unrealized-gains: "Calculate unrealized positions"
loss-harvesting: "Identify loss harvesting opportunities"
income-timing: "Consider deferring income to next year"
expense-timing: "Accelerate deductible expenses"

Quarterly Estimated Taxes

Track quarterly tax obligations:

2024-01-15 * "Q1 Estimated Tax Payment"
Expenses:Taxes:Estimated:Federal 5000.00 USD
Expenses:Taxes:Estimated:State 1200.00 USD
Assets:Checking -6200.00 USD

Conclusion

Cryptocurrency tax compliance doesn't have to be overwhelming. With Beancount.io's comprehensive plain-text accounting system, you can:

  • Ensure Complete Compliance: Meet all IRS reporting requirements
  • Optimize Tax Liability: Implement sophisticated tax strategies
  • Maintain Audit-Ready Records: Comprehensive documentation and audit trails
  • Automate Reporting: Generate tax forms and reports automatically
  • Scale with Complexity: Handle simple trades to complex DeFi strategies

Key benefits for crypto tax compliance:

  • Transparent Calculations: See exactly how tax numbers are computed
  • Flexible Reporting: Generate any report format needed
  • Professional Integration: Work seamlessly with CPAs and tax software
  • Future-Proof Records: Plain-text format ensures long-term accessibility

Start implementing proper crypto tax compliance today. The investment in accurate record-keeping will save you time, money, and stress during tax season while ensuring you're fully compliant with IRS requirements.

Ready to master cryptocurrency tax compliance? Get started with Beancount.io and take control of your crypto tax obligations.

DeFi Accounting Made Simple: Tracking Yield Farming, Liquidity Pools, and Staking Rewards with Plain-Text Accounting

· 7 min read
Mike Thrift
Mike Thrift
Marketing Manager

Decentralized Finance (DeFi) has revolutionized how we interact with financial services, offering unprecedented opportunities for yield generation, liquidity provision, and decentralized trading. However, with these opportunities comes the challenge of accurately tracking complex transactions for tax compliance and portfolio management.

Traditional accounting methods struggle with DeFi's unique characteristics: automated market makers, liquidity mining, impermanent loss, and multi-token rewards. This comprehensive guide shows you how to master DeFi accounting using Beancount.io's powerful plain-text accounting system.

DeFi Accounting Made Simple

Understanding DeFi Accounting Challenges

The Complexity of DeFi Transactions

DeFi protocols create accounting challenges that don't exist in traditional finance:

  • Multi-token transactions: Single operations involving multiple cryptocurrencies
  • Automated compounding: Rewards automatically reinvested
  • Impermanent loss: Value changes due to price divergence in liquidity pools
  • Gas fee optimization: Complex fee structures across different networks
  • Protocol governance: Voting rights and governance token distributions
  • Cross-protocol interactions: Transactions spanning multiple DeFi platforms

Tax Implications of DeFi Activities

The IRS treats DeFi activities as taxable events:

  • Liquidity provision: May trigger taxable events when depositing assets
  • Yield farming rewards: Taxable as ordinary income at fair market value
  • Impermanent loss: Potential tax implications when withdrawing from pools
  • Governance tokens: Airdrops and rewards taxable as income
  • Staking rewards: Taxable as income when received

Setting Up DeFi Accounts in Beancount.io

Comprehensive Account Structure

Create a detailed account hierarchy that captures all DeFi activities:

; Wallet Accounts
1970-01-01 open Assets:Crypto:Wallet:MetaMask:ETH
1970-01-01 open Assets:Crypto:Wallet:MetaMask:USDC
1970-01-01 open Assets:Crypto:Wallet:MetaMask:DAI
1970-01-01 open Assets:Crypto:Wallet:MetaMask:WBTC

; Uniswap V3 Liquidity Pools
1970-01-01 open Assets:DeFi:Uniswap:ETH-USDC-LP
1970-01-01 open Assets:DeFi:Uniswap:DAI-USDC-LP
1970-01-01 open Assets:DeFi:Uniswap:WBTC-ETH-LP

; Compound Protocol
1970-01-01 open Assets:DeFi:Compound:cUSDC
1970-01-01 open Assets:DeFi:Compound:cETH
1970-01-01 open Assets:DeFi:Compound:cDAI

; Aave Protocol
1970-01-01 open Assets:DeFi:Aave:aUSDC
1970-01-01 open Assets:DeFi:Aave:aETH
1970-01-01 open Assets:DeFi:Aave:DebtETH

; Staking Protocols
1970-01-01 open Assets:Staking:Ethereum:ETH
1970-01-01 open Assets:Staking:Lido:stETH
1970-01-01 open Assets:Staking:RocketPool:rETH

; Income Accounts
1970-01-01 open Income:DeFi:Yield:Uniswap
1970-01-01 open Income:DeFi:Yield:Compound
1970-01-01 open Income:DeFi:Yield:Aave
1970-01-01 open Income:DeFi:Staking:Ethereum
1970-01-01 open Income:DeFi:Governance:Tokens
1970-01-01 open Income:DeFi:Airdrops

; Expense Accounts
1970-01-01 open Expenses:DeFi:Gas:Ethereum
1970-01-01 open Expenses:DeFi:Gas:Polygon
1970-01-01 open Expenses:DeFi:Gas:Arbitrum
1970-01-01 open Expenses:DeFi:ImpermanentLoss

DeFi-Specific Commodities

Define tokens and LP tokens with proper metadata:

1970-01-01 commodity UNI-V3-ETH-USDC
name: "Uniswap V3 ETH-USDC LP Token"
asset-class: "liquidity-pool"
protocol: "uniswap-v3"

1970-01-01 commodity cUSDC
name: "Compound USDC"
asset-class: "lending-token"
protocol: "compound"

1970-01-01 commodity stETH
name: "Lido Staked Ethereum"
asset-class: "staking-derivative"
protocol: "lido"

Tracking Common DeFi Activities

1. Uniswap Liquidity Provision

Adding Liquidity to a Pool

2024-01-15 * "Add liquidity to ETH-USDC Uniswap V3 pool"
Assets:Crypto:Wallet:MetaMask:ETH -5.0 ETH {2500.00 USD}
Assets:Crypto:Wallet:MetaMask:USDC -12500 USDC
Assets:DeFi:Uniswap:ETH-USDC-LP 100 UNI-V3-ETH-USDC {250.00 USD}
Expenses:DeFi:Gas:Ethereum 0.01 ETH {2500.00 USD}
Assets:Crypto:Wallet:MetaMask:ETH -0.01 ETH {2500.00 USD}

Claiming LP Fees

2024-02-15 * "Claim Uniswap LP fees"
Assets:Crypto:Wallet:MetaMask:ETH 0.2 ETH {2600.00 USD}
Assets:Crypto:Wallet:MetaMask:USDC 300 USDC
Income:DeFi:Yield:Uniswap 820.00 USD
Expenses:DeFi:Gas:Ethereum 0.005 ETH {2600.00 USD}
Assets:Crypto:Wallet:MetaMask:ETH -0.005 ETH {2600.00 USD}

Removing Liquidity with Impermanent Loss

2024-03-15 * "Remove liquidity from ETH-USDC pool"
Assets:DeFi:Uniswap:ETH-USDC-LP -100 UNI-V3-ETH-USDC {250.00 USD}
Assets:Crypto:Wallet:MetaMask:ETH 4.8 ETH {2800.00 USD}
Assets:Crypto:Wallet:MetaMask:USDC 12800 USDC
Expenses:DeFi:ImpermanentLoss 240.00 USD ; IL calculation
Expenses:DeFi:Gas:Ethereum 0.008 ETH {2800.00 USD}
Assets:Crypto:Wallet:MetaMask:ETH -0.008 ETH {2800.00 USD}

2. Compound Protocol Lending

Supplying Assets to Compound

2024-01-20 * "Supply USDC to Compound"
Assets:Crypto:Wallet:MetaMask:USDC -10000 USDC
Assets:DeFi:Compound:cUSDC 500 cUSDC {20.00 USD}
Expenses:DeFi:Gas:Ethereum 0.008 ETH {2500.00 USD}
Assets:Crypto:Wallet:MetaMask:ETH -0.008 ETH {2500.00 USD}

Earning Compound Interest

2024-02-20 * "Compound interest accrual"
Assets:DeFi:Compound:cUSDC 5.2 cUSDC {20.50 USD}
Income:DeFi:Yield:Compound 106.60 USD

Claiming COMP Rewards

2024-02-20 * "Claim COMP governance tokens"
Assets:Crypto:Wallet:MetaMask:COMP 12 COMP {85.00 USD}
Income:DeFi:Governance:Tokens 1020.00 USD
Expenses:DeFi:Gas:Ethereum 0.006 ETH {2600.00 USD}
Assets:Crypto:Wallet:MetaMask:ETH -0.006 ETH {2600.00 USD}

3. Aave Protocol Operations

Depositing and Borrowing

; Deposit ETH as collateral
2024-01-25 * "Deposit ETH to Aave"
Assets:Crypto:Wallet:MetaMask:ETH -10 ETH {2500.00 USD}
Assets:DeFi:Aave:aETH 10 aETH {2500.00 USD}
Expenses:DeFi:Gas:Ethereum 0.01 ETH {2500.00 USD}
Assets:Crypto:Wallet:MetaMask:ETH -0.01 ETH {2500.00 USD}

; Borrow USDC against ETH collateral
2024-01-25 * "Borrow USDC from Aave"
Assets:Crypto:Wallet:MetaMask:USDC 15000 USDC
Liabilities:DeFi:Aave:DebtUSDC -15000 USDC
Expenses:DeFi:Gas:Ethereum 0.008 ETH {2500.00 USD}
Assets:Crypto:Wallet:MetaMask:ETH -0.008 ETH {2500.00 USD}

Repaying Loans with Interest

2024-03-25 * "Repay USDC loan to Aave"
Liabilities:DeFi:Aave:DebtUSDC 15000 USDC
Expenses:DeFi:Interest:Aave 450 USDC ; Interest accrued
Assets:Crypto:Wallet:MetaMask:USDC -15450 USDC
Expenses:DeFi:Gas:Ethereum 0.008 ETH {2700.00 USD}
Assets:Crypto:Wallet:MetaMask:ETH -0.008 ETH {2700.00 USD}

4. Ethereum Staking

Direct Ethereum Staking

2024-01-10 * "Stake ETH on Ethereum 2.0"
Assets:Crypto:Wallet:MetaMask:ETH -32 ETH {2500.00 USD}
Assets:Staking:Ethereum:ETH 32 ETH {2500.00 USD}
Expenses:DeFi:Gas:Ethereum 0.01 ETH {2500.00 USD}
Assets:Crypto:Wallet:MetaMask:ETH -0.01 ETH {2500.00 USD}

Staking Rewards

2024-02-10 * "ETH staking rewards"
Assets:Staking:Ethereum:ETH 0.15 ETH {2600.00 USD}
Income:DeFi:Staking:Ethereum 390.00 USD

Liquid Staking with Lido

2024-01-12 * "Stake ETH with Lido"
Assets:Crypto:Wallet:MetaMask:ETH -10 ETH {2500.00 USD}
Assets:Staking:Lido:stETH 10 stETH {2500.00 USD}
Expenses:DeFi:Gas:Ethereum 0.008 ETH {2500.00 USD}
Assets:Crypto:Wallet:MetaMask:ETH -0.008 ETH {2500.00 USD}

Advanced DeFi Scenarios

Yield Farming Strategies

Multi-Protocol Yield Farming

; Step 1: Deposit USDC to Compound
2024-01-30 * "Deposit USDC to Compound for yield farming"
Assets:Crypto:Wallet:MetaMask:USDC -20000 USDC
Assets:DeFi:Compound:cUSDC 1000 cUSDC {20.00 USD}

; Step 2: Borrow DAI against cUSDC
2024-01-30 * "Borrow DAI from Compound"
Assets:Crypto:Wallet:MetaMask:DAI 15000 DAI
Liabilities:DeFi:Compound:DebtDAI -15000 DAI

; Step 3: Provide DAI-USDC liquidity to Uniswap
2024-01-30 * "Add DAI-USDC liquidity for farming"
Assets:Crypto:Wallet:MetaMask:DAI -15000 DAI
Assets:Crypto:Wallet:MetaMask:USDC -5000 USDC ; Additional USDC
Assets:DeFi:Uniswap:DAI-USDC-LP 200 UNI-V3-DAI-USDC {100.00 USD}

Cross-Chain DeFi Operations

Bridging Assets

2024-02-05 * "Bridge ETH to Polygon"
Assets:Crypto:Wallet:MetaMask:ETH -5 ETH {2600.00 USD}
Assets:Crypto:Wallet:Polygon:ETH 5 ETH {2600.00 USD}
Expenses:DeFi:Bridge:Fees 0.01 ETH {2600.00 USD}
Assets:Crypto:Wallet:MetaMask:ETH -0.01 ETH {2600.00 USD}

Flash Loans and Arbitrage

2024-02-10 * "Flash loan arbitrage opportunity"
; Flash loan
Assets:Crypto:Temp:FlashLoan 100000 USDC
Liabilities:DeFi:Aave:FlashLoan -100000 USDC

; Arbitrage trade
Assets:Crypto:Temp:FlashLoan -100000 USDC
Assets:Crypto:Temp:Arbitrage 101500 USDC

; Repay flash loan
Liabilities:DeFi:Aave:FlashLoan 100000 USDC
Assets:Crypto:Temp:Arbitrage -100090 USDC ; Including fees

; Profit
Assets:Crypto:Wallet:MetaMask:USDC 1410 USDC
Income:DeFi:Arbitrage:Profit 1410.00 USD

DeFi Tax Reporting Considerations

Income Recognition

All DeFi rewards are taxable as ordinary income:

; Track all income sources separately
Income:DeFi:Yield:Uniswap ; LP fees
Income:DeFi:Yield:Compound ; Interest earned
Income:DeFi:Staking:Ethereum ; Staking rewards
Income:DeFi:Governance:Tokens ; Governance token airdrops
Income:DeFi:Airdrops ; Protocol airdrops

Expense Deductions

Track deductible expenses:

Expenses:DeFi:Gas:Ethereum          ; Gas fees
Expenses:DeFi:Gas:Polygon ; Layer 2 fees
Expenses:DeFi:Interest:Aave ; Borrowing costs
Expenses:DeFi:ImpermanentLoss ; IL from LP positions

Capital Gains Tracking

Use lot-based accounting for accurate capital gains:

; Different cost basis for same token
Assets:DeFi:Compound:cUSDC 100 cUSDC {20.00 USD} ; Batch 1
Assets:DeFi:Compound:cUSDC 100 cUSDC {21.00 USD} ; Batch 2

Best Practices for DeFi Accounting

1. Real-Time Transaction Recording

  • Record transactions immediately after execution
  • Use transaction hashes for verification
  • Monitor mempool for pending transactions

2. Gas Fee Optimization Tracking

; Track gas optimization strategies
Expenses:DeFi:Gas:Ethereum:Standard ; Standard gas price
Expenses:DeFi:Gas:Ethereum:Fast ; Fast gas price
Expenses:DeFi:Gas:Ethereum:Instant ; Instant gas price

3. Protocol Risk Management

; Track protocol-specific risks
Expenses:DeFi:Risk:SmartContract ; Smart contract failures
Expenses:DeFi:Risk:Liquidation ; Liquidation events
Expenses:DeFi:Risk:Slippage ; Slippage costs

4. Automated Reconciliation

  • Set up automated price feeds
  • Use protocol APIs for balance verification
  • Implement automated transaction imports

5. Documentation Standards

  • Maintain detailed transaction notes
  • Document strategy rationale
  • Keep protocol interaction records

Integration with DeFi Tools

Portfolio Tracking

  • DeBank: DeFi portfolio overview
  • Zapper: Multi-protocol dashboard
  • Zerion: DeFi wallet and tracker

Tax Reporting

  • Koinly: DeFi tax calculations
  • CoinTracker: Multi-protocol support
  • TokenTax: Specialized DeFi reporting

Analytics Platforms

  • DeFi Pulse: Protocol analytics
  • DeFiLlama: TVL and yield tracking
  • APY.vision: Impermanent loss tracking

Conclusion

DeFi accounting complexity shouldn't prevent you from participating in the decentralized finance revolution. With Beancount.io's powerful plain-text accounting system, you can:

  • Track Complex Transactions: Handle multi-protocol interactions seamlessly
  • Ensure Tax Compliance: Proper income recognition and expense tracking
  • Monitor Portfolio Performance: Real-time insights into DeFi positions
  • Manage Risk: Track impermanent loss and protocol risks
  • Scale Operations: From simple staking to complex yield farming strategies

The key to successful DeFi accounting is consistency, accuracy, and proper categorization. Start with basic protocols and gradually expand to more complex strategies as you become comfortable with the accounting patterns.

Ready to master DeFi accounting? Start your Beancount.io journey and take control of your decentralized finance portfolio today.