# BIMA Credit Score (BCS)

The BIMA Credit Score (BCS) is a proprietary algorithm designed to assess the risk level of a Bitcoin address based on its on-chain activity. This scoring system is integrated into [**Bima Occam**](https://occam.bima.money/) to provide Occam users on the BIMA platform with comprehensive risk assessment capabilities.

The score ranges from 0 to 100, where a higher score indicates lower risk. The calculation involves fetching data from multiple Bitcoin blockchain APIs (Blockstream, Mempool, BlockCypher, Blockchain.info) and combining various metrics.

### **1. Data Points Collected**

The algorithm primarily relies on the following data points for a given Bitcoin address:

* **Transaction Count (`txCount`):** Total number of transactions associated with the address.
* **Total Received BTC (`totalReceivedBtc`):** The cumulative amount of Bitcoin received by the address.
* **Total Sent BTC (`totalSentBtc`):** The cumulative amount of Bitcoin sent from the address.
* **UTXO Balance BTC (`utxoBalanceBtc`):** The current unspent transaction output balance of the address.
* **Address Age (`addressAgeDays`):** The number of days since the address first appeared on the blockchain.
* **Recent Transaction Activity:** Whether the address has had a transaction within the last 30 days.

### **2. Scoring Logic**

The Bima Credit Score is calculated by assigning points based on these metrics. The specific weighting and contribution of each factor are as follows:

* **Transaction Count:** Each transaction contributes `2` points to the score.
  * `score += txCount * 2`
* **Total Received BTC:** Contributes up to `50` points. The contribution is capped to prevent excessively large transactions from skewing the score.
  * `score += Math.min(totalReceivedBtc * 0.5, 50)`
* **UTXO Balance BTC:** Contributes up to `30` points. This reflects the current holdings of the address.
  * `score += Math.min(utxoBalanceBtc * 1, 30)`
* **Address Age:** Older addresses are generally considered more established and less risky.
  * If `addressAgeDays` > 365 days: `+20` points
  * If `addressAgeDays` > 180 days: `+10` points
  * `if (addressAgeDays > 365) score += 20; else if (addressAgeDays > 180) score += 10;`
* **Recent Transaction Activity:** Addresses with recent activity are often seen as active and potentially more legitimate.
  * If a transaction occurred within the last 30 days: `+15` points
  * `if (recentTxTime && now - recentTxTime < 60 * 60 * 24 * 30) score += 15;`

The final score is then clamped between 0 and 100:

`score = Math.min(Math.max(score, 0), 100)`

### **3. Risk Level Assignment**

Based on the calculated Bima Credit Score, a risk level is assigned for Occam users:

* **Low Risk:** Score between 70 and 100.
  * Indicates high creditworthiness with minimal default risk, suitable for standard transactions.
* **Medium Risk:** Score between 40 and 69.
  * Indicates a moderate risk profile requiring standard monitoring and due diligence.
* **High Risk:** Score between 0 and 39.
  * Indicates an elevated default risk requiring enhanced due diligence and careful consideration.

***

*The BIMA Credit Score is currently implemented in BIMA Occam to help users make informed decisions when interacting with Bitcoin addresses on the platform.*
