API Reference

Reckoning

Reckoning Overview

Block Earner run regular reconciliation procedures, known as the "Reckoning" process, to manage and settle all loan-related transactions. By default, this process runs twice daily at nominated times, providing a predictable and reliable schedule for maintaining the integrity and accuracy of all loan accounts on the platform.

Reckoning Timeline



How does reckoning work

Pre-Reckoning

1 hour before the scheduled reckoning time, Block Earner will send a webhook Pre-Reckoning Report details the transactions that are going to be included in the next reckoning and the deposit required on business side.


📘

Implementation Recommendation

Block Earner recommend to always send the reckoningAmount to main account during the pre-reckoning deposit window. This is to make sure the float kept on the main account is always at the same level

The pre-reckoning report consist of 3 parts:

Fiat Summary

  • currentBalance: current main account balance
  • reckoningAmount: for all the transactions listed in the report, the net fiat amount. Note that the reckoningAmount can be postive or negative. If it's positive, it means there is more fiat repayment than fiat borrow in this reckoning. If the amount is negative, it means the reckoning has more borrow than repayment. In the negative case, the requiredAmountToDeposit is 0.
  • requiredAmountsToDeposit: The gap between account balance and the reckoning amount required.

Example 1:

In a reckoning, there is total incomplete repayment of 20,000 AUD and 15,000 AUD total new loans and redraws. You main account balance is 2,000 AUD. You will receive:

"fiatSummaries": [
		{
      "currency": "AUD",
      "currentBalance": "2000.00",
      "reckoningAmount": "5000.00", // net of 20,000 AUD repayment and 15,000 borrow
      "requiredAmountsToDeposit": "3000" // 3000 AUD deposit to main account is still required
    }
  ]  

Example 2:

In a reckoning, there is total incomplete repayment of 4,000 AUD and 18,000 AUD total new loans and redraws. You main account balance is 2,000 AUD. You will receive:

"fiatSummaries": [
  {
    "currency": "AUD",
    "currentBalance": "2000.00",
    "reckoningAmount": "-14000.00",  // net of 4,000 AUD repayment and 18,000 borrow
    "requiredAmountsToDeposit": "0"  // No deposit required as there is more borrows
   }
]

Crypto Summary

The Crypto Summary works in a very similar way as Fiat Summary. It mainly applies to the net amount of security.

  • currentBalance: current main account security balance
  • reckoningAmount: for all the transactions listed in the report, the net security amount. Note that the reckoningAmount can be postive or negative. If it's positive, it means there is more new loan/security top up than security withdrawal/close loan in this reckoning. If the amount is negative, it means the reckoning has more security withdrawal/close loan than top up/new loan. In the negative case, the requiredAmountToDeposit is 0.
  • requiredAmountsToDeposit: The gap between account balance and the reckoning amount required.

Example 1:

In a reckoning, there is total new loan + incomplete security top up of 5 BTC and 2 BTC total security withdrawal and close loan. You main account balance is 1.5 BTC. You will receive:

{
   "currency": "BTC",
   "currentBalance": "1.5",
   "reckoningAmounts": "3.00",// net of 5 BTC and 2 BTC
   "requiredAmountsToDeposit": "2.00" // 2 BTC deposit to main account still required
 }

Example 2:

In a reckoning, there is total new loan + incomplete security top up of 2.7 ETH and 8 ETH total security withdrawal and close loan. You main account balance is 3.2 ETH. You will receive:

{
   "currency": "ETH",
   "currentBalance": "3.2",
   "reckoningAmounts": "-5.3",// net of 2.7 ETH and 8 ETH
   "requiredAmountsToDeposit": "0.00" // No deposit required for this reckoning
 } 

Transactions included

List of all the transactions included in the following reckoning

Example:

    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "loanId": "223e4567-e89b-12d3-a456-426614174000",
      "externalTransactionId": "123e4567-e89b-12d3-a456-426614174000",
      "userId": "423e4567-e89b-12d3-a456-426614174000",
      "externalUserId": "123e4567-e89b-12d3-a456-426614174000",
      "loanTransactionType": "OPEN_LOAN",
      "fiatAmount": "10000.00",
      "fiatCurrency": "AUD",
      "securityCryptoAmount": "0.5",
      "securityCryptoCurrency": "BTC",
      "paymentDetails": {
        "accountName": "John Doe",
        "accountNumber": "12345678",
        "bsb": "123-456",
        "country": "AU",
        "fiatCurrency": "AUD"
      }
    }

Main Reckoning Process

Once the reckoning is started on Block Earner side, Block Earner will go through all the transactions included in the reckoning and make sure the fund is ready in the sub-account.

❗️

Block Earner will do best effort for all the transactions in the list, one by one. For each transaction, we will try to debit from the main account and if there is not enough fund in main account, this transaction is skipped and will continue to the next transaction.

During the reckoning, Block Earner will complete all transactions that are ready for reckoning. At the end of reckoning, Block Earner will

  • Settle the AUD to end user's nominated bank account
  • Loan status and allowed actions are updated
  • For security withdrawal and close loan, the security will be landed respectively in the sub account first and then move to the main account balance. Business can initiate the crypto withdrawal to any wallet they prefer.

Post-Reckoning

Once the reckoning is completed, Block Earner will send a webhook message Post-reckoning Report to summarize all the completed and incompleted transactions.



Reckoning Example

A simple one with one loan application

Scenario: A user's BTC loan application has been approved with 1 BTC as security to borrow 50,000 AUD

Pre-Reckoning Report Example

{
  "userId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", // main account User ID
  "cryptoSummaries": [
    {
      "currency": "BTC",
      "currentBalance": "0.00",
      "reckoningAmounts": "1.00",
      "requiredAmountsToDeposit": "1.00"
    }
  ],
  "fiatSummaries": [
    {
      "currency": "AUD",
      "currentBalance": "0.00",
      "reckoningAmounts": "-50000.00",
      "requiredAmountsToDeposit": "0"
    }
  ],
  "transactions": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "loanId": null, //loan is only created after reckoning completed
      "externalTransactionId": "123e4567-e89b-12d3-a456-426614174000",
      "userId": "423e4567-e89b-12d3-a456-426614174000", //sub acccount user id
      "externalUserId": "123e4567-e89b-12d3-a456-426614174000",
      "loanTransactionType": "OPEN_LOAN",
      "fiatAmount": "160283.23", //fiat equivalent of security value
      "fiatCurrency": "AUD",
      "securityCryptoAmount": "1.00",
      "securityCryptoCurrency": "BTC",
      "paymentDetails": null
    },
    {
      "id": "ece4e0ba-04d2-42e6-bc88-d37ba114096c",
      "loanId": null, //loan is only created after reckoning completed
      "externalTransactionId": "ab5afe5d-6005-496f-acc5-694bbb9cf2ae",
      "userId": "423e4567-e89b-12d3-a456-426614174000", //sub acccount user id
      "externalUserId": "123e4567-e89b-12d3-a456-426614174000",
      "loanTransactionType": "FIAT_BORROW",
      "fiatAmount": "50000.00",
      "fiatCurrency": "AUD",
      "securityCryptoAmount": null,
      "securityCryptoCurrency": "BTC",
      "paymentDetails": {
        "accountName": "John Doe",
        "accountNumber": "12345678",
        "bsb": "123-456",
        "country": "AU",
        "fiatCurrency": "AUD"
      }
    }
  ]
}

Action Required

1 BTC is required in main account balance for the loan application to be processed in reckoning

What happened once Reckoning started

Once reckoning started, 1 BTC will be debited from main account to sub-account. Then the 1 BTC is used for sub-account's loan application in reckoning. You will also see transaction history of the security movement.

At the end of the reckoning, Block Earner will settle the fund 50,000 AUD to the nominated bank account of the user.

Post-Reckoning Report Example

Once the reckoning is completed, you will receive the post-reckoning webhook message.

{
  "userId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "includedTransactions": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "loanId": "223e4567-e89b-12d3-a456-426614174000", //loan is avaialble now for the sub account
      "externalTransactionId": "123e4567-e89b-12d3-a456-426614174000",
      "userId": "423e4567-e89b-12d3-a456-426614174000",
      "externalUserId": "123e4567-e89b-12d3-a456-426614174000",
      "loanTransactionType": "OPEN_LOAN",
      "fiatAmount": "160283.23", //fiat equivalent of security value
      "fiatCurrency": "AUD",
      "securityCryptoAmount": "1.00",
      "securityCryptoCurrency": "BTC",
      "paymentDetails": {
        "accountName": "John Doe",
        "accountNumber": "12345678",
        "bsb": "123-456",
        "country": "AU",
        "fiatCurrency": "AUD"
      }
    },
    {
      "id": "ece4e0ba-04d2-42e6-bc88-d37ba114096c",
      "loanId": "223e4567-e89b-12d3-a456-426614174000", //loan is avaialble now for the sub account
      "externalTransactionId": "ab5afe5d-6005-496f-acc5-694bbb9cf2ae",
      "userId": "423e4567-e89b-12d3-a456-426614174000", //sub acccount user id
      "externalUserId": "123e4567-e89b-12d3-a456-426614174000",
      "loanTransactionType": "FIAT_BORROW",
      "fiatAmount": "50000.00",
      "fiatCurrency": "AUD",
      "securityCryptoAmount": null,
      "securityCryptoCurrency": "BTC",
      "paymentDetails": {
        "accountName": "John Doe",
        "accountNumber": "12345678",
        "bsb": "123-456",
        "country": "AU",
        "fiatCurrency": "AUD"
      }
  ],
  "excludedTransactions": []
}

If for any reason the transactions are not able to complete, you will see it in the excludedTransactions list.