Skip to main content
Skip table of contents

Exchange Flow and Balances


This document provides information on the cryptocurrency exchange process and how balances are managed with banking providers (in this example, Railsbank), BitGo, and Kraken.

The term "Ledger" will frequently appear in the context of Railsbank. Simply put, it refers to an "Account" within their system.

For better understanding, it is recommended to familiarize yourself with the following concepts:

  • Interledger Accounts Logic: Understanding what interledgers are and how they function.

  • Virtual and Real Accounts: The differences between virtual and real accounts.

  • Synthetic Currency Exchange Mechanism: How interledgers operate within exchanges, including fiat examples.

 Configuration Example

Initial Setup:

  • WL (Whitelabel) creates a general EUR ledger account in Railsbank and deposits some funds, say 100,000 EUR. This ledger account is configured in the Crassula system as an interledger account.

  • WL also creates a Kraken account and deposits some funds, say 5 BTC and 100,000 EUR.

How the Exchange Works

  1. User Accounts:

    • The user has a BTC account and receives 2.5 BTC (handled by the BitGo integration).

    • The user also has a regular EUR ledger account with a balance of 0 EUR (handled by Railsbank).

  2. Exchange Process:

    • The user wants to exchange 1 BTC for EUR. They navigate to the currency exchange section and initiate an exchange operation. Assuming the exchange rate is 1 BTC = 30,000 EUR:

      • A debit transaction of -1 BTC is created on the user's BTC account.

      • A credit transaction of +30,000 EUR is created on the user's Railsbank account.

      • An exchange order is created on Kraken to sell 1 BTC. Both transactions are in a Pending status, awaiting the order processing on Kraken, which usually takes seconds at market price.

  3. Order Processing:

    • Once Kraken confirms the order is successful, the balances update as follows:

      • The user's Kraken account now holds 4 BTC and 130,000 EUR.

      • The ledger transactions need to be processed, meaning funds are transferred from the WL’s general Railsbank ledger account to the user’s ledger account.

      • The user’s ledger account now has 30,000 EUR, and the WL's general ledger account has 70,000 EUR. Both the debit and credit transactions are marked as Completed. BitGo balances remain unchanged since we do not track user balances there, only aggregate crypto amounts and deposit addresses.

Final Account Balances After Exchange:

  • BitGo Wallet: 2.5 BTC (unchanged as no funds were withdrawn by the user).

  • Kraken Account: 4 BTC and 130,000 EUR (adjusted for potential Kraken fees).

  • WL General EUR Ledger Account: 70,000 EUR.

  • User BTC Account in Our System: 1.5 BTC (after exchanging 1 BTC for EUR).

  • User EUR Account in Our System: 30,000 EUR (mirrored in the user’s Railsbank ledger account).

WL is responsible for monitoring liquidity, managing their balances across BitGo, Kraken, and Railsbank (general ledger account).

In scenarios involving virtual accounts, the interledger concept isn't used because there's no actual fiat movement from the WL account to the user’s account. Essentially, the system will simply "display" to the user that a certain amount of fiat is available for their use.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.