Skip to main content

Try Cala

Cala is a Rust library — you embed the ledger in your own service rather than running a standalone server. All you need is Rust and a PostgreSQL database.

Add the Dependency

Add cala-ledger to your Cargo.toml:

cala-ledger = "0.20"

Initialize the Ledger

Connect to PostgreSQL and initialize the ledger:

use cala_ledger::{CalaLedger, CalaLedgerConfig};

let pool = sqlx::postgres::PgPoolOptions::new()
.max_connections(20)
.connect("postgres://user:password@localhost:5432/pg")
.await?;

let config = CalaLedgerConfig::builder()
.pool(pool)
.exec_migrations(true)
.build()?;
let cala = CalaLedger::init(config).await?;

Run the Example

Clone the repository and run the complete example, which creates a journal, accounts, transaction templates, and posts transactions:

git clone https://github.com/GaloyMoney/cala.git
cd cala
make reset-deps rust-example

Next Steps