## 3 Improved RE-BPFT Blockchain Consensus Algorithm
### Node Credit Calculation
The activity credit \(C_{\text{act}_{i}}\) of node \(i\) is calculated by the following formula:_  
\[C_{\text{act}_{i}}=\frac{\sum\limits_{r=1}^{R}\left[\gamma\times GM_{i}(r)+(1- \gamma)\times GC_{i}(r)\right]\times e^{-\lambda(R-r)}}{\sum\limits_{r=1}^{R}e^ {-\lambda(R-r)}} \tag{6}\]  
_Here, \(R\) represents the total number of consensus rounds the current system is in, \(r\) denotes the index from historical round \(1\) to round \(R\). \(GMi(r)\) indicates whether node \(i\) serves as the primary node in round \(r\) (1 if yes, 0 otherwise); \(GC_{i}(r)\) shows whether node \(i\) is a consensus node in round \(r\) (1 if yes, 0 otherwise). \(\gamma\) represents the weight coefficient for the primary node's participation, reflecting its importance in consensus, with a value range of (0.5, 1). \(e^{-\lambda(R-r)}\) is the time decay factor, which attenuates participation behavior in round \(r\), giving higher weight to recent actions._  
**Definition 5**. : _Incentive credit value \(C_{\text{inc}}\). The incentive credit evaluation aims to motivate low-credit nodes to work actively, hence it correlates with node credit rankings. The incentive credit value \(C_{\text{inc}_{i}}\) of node \(i\) is calculated by the following formula:_  
\[C_{\text{inc}_{i}}=C_{\text{min}}+(C_{\text{max}}-C_{\text{min}})\times\left( 1-e^{-a\times\frac{C_{\text{rank}_{i}}-1}{a-1}}\right) \tag{7}\]  
_Here, \(n\) is the total number of nodes currently participating in consensus, \(C_{\text{rank}_{i}}\) represents the ranking of node \(i\), with a value range of \([1,\ n]\). \(a\) is the exponential decay factor, controlling the rate of incentive reduction. The parameter \(a\) can be adjusted based on the total number of nodes, system volatility, or the desired incentive curve. This formula ensures excellent boundary controllability. Specifically, when node \(i\) ranks first in credit (\(C_{\text{rank}_{i}}=1\)) in the current round, the exponential term becomes \(\text{e}^{0}=1\), resulting in \(C_{\text{inc}_{i}}\to C_{\text{min}}\); when the node ranks last (\(C_{\text{rank}_{i}}=\text{n}\)), the exponential term approaches 0, leading to \(C_{\text{inc}_{i}}\to C_{\text{max}}\). Thus, the formula guarantees that the incentive value always stays within the preset interval and provides explicit control over boundary behaviors._  
**Definition 6**. : _Indirect credit value \(C_{\text{idir}}\). The indirect credit value indirectly assesses a node's behavior in consensus activities by rewarding nodes with consistent high performance over time and encouraging nodes with lower credit scores to enhance their involvement. This metric is calculated as a weighted combination of active credit and incentive credit values. Specifically, the indirect credit value \(C_{\text{idir}_{i}}\) of node \(i\) is determined by the formula below:_  
\[C_{\text{idir}_{i}}=\alpha\times C_{\text{act}_{i}}+\beta\times C_{\text{ inc}_{i}} \tag{8}\]  
_In this formula, \(\alpha\) denotes the weight assigned to active credit, and \(\beta\) denotes the weight assigned to incentive credit, with the constraint that \(\alpha+\beta=1\)._  
**Definition 7**. : _Historical credit value \(C_{\text{his}}\). The historical credit value measures the consistency and stability of a node's long-term behavior, employing a moving average strategy. The indirect credit value \(C_{\text{his}_{i}}\) of node \(i\) is calculated by the following formula:_  
\[C_{\text{his}_{i}}=\frac{1}{T}\times\sum\limits_{t=1}^{T}C_{i}^{(t)} \tag{9}\]  
_where \(C_{i}^{(t)}\) represents the comprehensive score in round \(t\), and \(T\) is the sliding window size._  
**Definition 8**. : _Comprehensive credit value \(C\). The comprehensive credit value represents an integrated assessment of a node's performance by considering direct, indirect, and historical behaviors. Its main purpose is to provide credit rewards to consistently reliable nodes while imposing credit deductions on nodes demonstrating malicious or detrimental actions.