## 3 System Model and Problem Statements
### Problem Formulation
#### 3.2.3 The Layer of the Blockchain
Since devices share cloud or edge servers' processing resources, it seems difficult to know precisely how much computing power and overhead each server has at any given time. Therefore, the server computing overhead and computation resources are expressed as random variables \(\psi\) and \(\hat{\mathfrak{h}}\). As \(X=\{x_{0},\,x_{1},\,\ldots,\,x_{p-1}\}\) and \(Y=\{y_{0},\,y_{1},\,\ldots,\,y_{p-1}\}\), they are partitioned into \(q\) and \(p\) independent values, respectively. The computation overhead and resources of the servers at time slot \(t\) could be represented as \(\psi(\mathfrak{t})\) and \(\hat{\mathfrak{h}}(\mathfrak{t})\), respectively. The total computing cycles of one consensus phase could be calculated based on the necessary computing cycles of each consensus stage [45]. \[CC(t)=\left[\frac{tb*(l+1)}{ts}+1\right]*\omega+\left[\frac{tb*(l+1)}{ts}+3m+4k -2\right]*\Phi\;,\;if\;tb\leqslant z(t) \tag{17}\]  
Whenever the total transaction size exceeds the block size, the overall computing cycles of multiple consensus processes can be calculated as follows (authors considered that there are at most two consensus processes) [47]:  
\[cc_{1}(t)=1+\frac{tb}{ts}*(\omega+\Phi) \tag{10}\]0  
The consensus time and the consensus process overhead can be calculated as Equation (19) [40]. \[V_{n}(t) =\left\{ \begin{array}{l l}\frac{CC(t)}{\mathfrak{h}(t)}+3b_{t}&if \;tb\leqslant z(t)\\ \frac{CC(t)}{\mathfrak{h}(t)}+3b_{t}+t_{i}&if\;tb>z(t)\\ 1&\\ \end{array} \right. \tag{19}\]  
Additionally, the broadcast delay among nodes is \(b_{t}\), and the block generation interval is \(ti\)[48]. \[CO_{bn}(t) =\left\{ \begin{array}{l l}\psi(\mathfrak{t})&if\;tb\leqslant z(t)\\ &\mathbf{1}\\ 2\mathfrak{h}(\mathfrak{t})&if\;tb>z(t)\\ \end{array} \right. \tag{20}\]  
The total overhead \(CO_{total}\) can then be expressed as (21). \[CO_{total}=CO_{server}(t)+CO_{bn}(t)+CO_{block}(t) \tag{21}\]  
If the consensus time, \(V_{n}(t)\), is less than the time limit \(t_{i}\), the consensus process is considered active, the created block is appended to the blockchain, and the MC is notified. In this system, \(\text{Cost}(t)\) represents the weighted amount of computation overhead and energy consumption, which helps to balance the optimization and reflects the system's overall efficiency. It is referred to as Equation (22). When \(\lambda\) is 1, the weighted sum will turn into the cost of energy and vice versa. Besides, we can tune the parameter if one aspect is more important. The numbers were also normalized. There may be a few tasks that cannot be done before the battery dies. If the battery level is equal to zero, the IoT object does not perform the computing task. If a computation task fails, the task failure indicated by \(\xi\), is defined as the cost. If failure happens, the purpose of the indicator denoted by \(\tilde{v}\left(\xi\right)\) is equal to one, and zero is the opposite. The IoT object's efficiency in selecting the targeted edge node at time slot \(t\) is indicated by \(Ef_{t}\), which is biased on system cost and task failure and is given by Equation (23) [49]:  
\[\text{Cost}(\text{t})=\lambda E_{total}(t)+(1-\lambda)\;CO_{total}\;,\;\;\lambda \;\left[0,\;1\right],\;t\in\mathbb{T} \tag{22}\]  
\[Ef_{t}=d_{i}-\bar{\upsilon}\xi\;(lb_{m}=0)-\;\text{Cost}(\text{t}) \tag{23}\]