## 3 System Design
### Algorithm
#### 3.3.1 Relay Node Selection
The detailed node selection algorithm is presented below as Algorithm 1, where \(pmax\) represents the optimal link state:  
``` Input: UBSID, K Output:\(node_{i}\)
1:Initialize: \(\alpha=5\), \(\beta=4\),\(p_{0}=0.03\), \(\gamma=10\), \(node_{i}=\osl



#### 3.3.2 Incentive Mechanism

The incentive mechanism is a rationalized system that reflects the interaction between incentive agents and incentive objects. It belongs to a branch of game theory. Common incentive mechanisms can be categorized into three types: reputation-based mechanisms [15], tit-for-tat mechanisms [21], and monetary mechanisms [13]. Reputation-based mechanisms aim to identify selfish nodes and impose penalties on them. Tit-for-tat mechanisms use service as an incentive measure to prevent free-riding behavior. Monetary mechanisms, on the other hand, employ a more flexible payment structure to regulate participants' behavior. Due to its characteristics, the monetary mechanism is widely adopted in resource leasing, such as computing, bandwidth, storage, and other resources. Blockchain, with its inherent payment and transaction features, can be used to record ledgers in a trustful, transparent, and tamper-resistant manner. This makes it advantageous for building a secure and trustworthy bandwidth sharing market. In blockchain, incentive mechanisms are often designed in conjunction with consensus algorithms. For example, Bitcoin uses proof of work for mining computational power, while Filecoin uses proof of storage for mining storage capacity. Different blockchain consensus algorithms need to be designed based on the characteristics of the specific blockchain system and cannot be simply applied from other consensus algorithms. Our goal is to allow users to mine by forwarding messages, so we propose an incentive mechanism based on the PoNC consensus algorithm. In this mechanism, network contribution is defined as the number of packets forwarded by users, which can be calculated using local or distributed measurement methods [4]. The PoNC consensus algorithm is specifically designed to align with the objective of our blockchain system, where users can mine by participating in packet forwarding activities. The selection of consensus nodes in the PoNC algorithm is shown in Figure 5. All user nodes are considered as regular nodes participating in the selection of consensus nodes. Additionally, a subset of ICN regular nodes is selected as regulatory nodes to maintain the security and stability of the entire system. The first round of election considers whether the storage and computing resources of the nodes meet the requirements and whether the nodes are online to do a round of pre-screening; when the first round of pre-screening is over, the network contribution of all the user-side nodes is regularly calculated and the elected nodes are sorted according to the network contribution. Then, based on a threshold set by the system, nodes with network contributions greater than the threshold are selected as consensus nodes, while nodes with contributions below the threshold are selected as backup consensus nodes. If a consensus node goes offline, a node can be selected from the backup consensus nodes to replace it. The right to record transactions in the blockchain belongs only to the consensus nodes, while other nodes are responsible for collectively maintaining the distributed ledger. After a round of consensus node selection, the consensus nodes will validate the generated block data through digital signatures and broadcast the data to the entire system. The sequence diagram for achieving consensus on block data is shown in Figure 6. The node with the highest network contribution (let us assume it is Consensus Node 1) is responsible for recording transactions and packaging blocks. The block includes business data, timestamps, and the hash value of the previous block. Once the complete block is packaged, Consensus Node 1 broadcasts it to the other consensus nodes.