1 Introduction

Consensus protocols aid in resolving ambiguity for trivial decisions involving high-stakes transactional decisions. These decisions may be monetary, political, strategic, geographical, network-based, etc. These consensus models are utilized by blockchains to determine whether a new block can be added to the chain. Researchers have proposed a vast array of consensus models for this task. Proof-of-work (PoW) is a typical consensus model, depicted in Fig. 1 for the verification of financial transactions, with the application of cryptocurrencies depicted via peer-to-peer network validation [1].

Fig. 1
figure 1

A typical blockchain-based consensus model

Observable from the preceding model is that a transaction is initiated by a set of parties who wish to store a set of pre-validated data that must be usable in the event of a conflict. This information is transmitted to a network of trusted nodes (called miners), each of which verifies the transaction from each party involved. Each of these nodes, upon verification, attempts to generate a uniquely identifiable block using application-specific hash computations. A specified proportion of miner nodes must concur with the hash for it to be validated. A unique hash provided by the node with the longest chain length is selected and added to the main blockchain [2] for a PoW-based blockchain. This is because, in order to generate a block with a unique identifier, the miner node must perform the following operations:

  • Compare the hashes of all blocks in the chain with the current hash.

  • If the hash is repeated, it must be regenerated and this process must be repeated.

  • If the hash is unique, add this block to the blockchain and broadcast it to the other nodes.

When designing blockchain-based consensus models, a large number of delays are encountered, including reading delay, writing delay, hashing delay, verification delay, etc. To reduce these delays, researchers proposed a vast array of consensus models, each of which varies in terms of computational complexity, speed of operation, network requirements, etc. [3]. In the following section, an analysis of these algorithms, including their limitations, benefits, subtleties, and future research opportunities, is presented. On the basis of this analysis, it has been determined that trust-based models offer superior privacy, security, and attack resistance than their non-trust counterparts. In light of this observation, the proposed hybrid model discusses the design of a novel trust-based method for miner selection. During the evaluation of trust, the computation of end-to-end delay is crucial, as nodes with shorter communication delays are preferable to those with longer delays. In addition, it was discovered that tampered blockchains can be rectified via self-correcting mechanisms, which would facilitate the reuse of compromised nodes. This reusability enhances network dependability and is thus incorporated into the proposed model designs.

The rest of this paper addressed the above issues and organized as follows: The literature review is described in Sect. 2. This is followed by Sect. 3, which describes the design of the proposed consensus model with self-correcting, trust-integrated miner selection capabilities. Various network conditions were utilized to test the proposed model, and parameters such as delay, energy consumption, and attack detection efficiency were evaluated. In Sect. 4, Result and Comparative analysis is described. These evaluations and comparisons with other reviewed models are discussed in order to estimate the scalability and adaptability of the proposed consensus model. Section 5 of this text concludes with some illuminating observations about the proposed hybrid model and also suggests ways to improve it further.

2 Literature review

Researchers have come up with a broad array of consensus models as potential solutions to increase the effectiveness of blockchain mining. The majority of these models are implemented into applications that are network-specific, which decreases the scalability and flexibility of such models. A blockchain network needed an authorized participant for the verification and validation of mining nodes, as well as to identify the malicious attacking nodes. The entire process of mining depends upon the consensus of the participants.

Yang et al. [4] presented Streamlined Consensus Protocols, Raft Consensus Algorithm, and Delegated Proof of Stake with Downgrade (DPoSD), each of which is used to a distinct network-specific application [5]. When applied to networks of a greater scale, these models do not perform well in terms of quality of service (QoS). Similarly, Huang et al. [6] the work in proposes a voting-based consensus model, which can be applied for securing moderate-scale applications that use both public and private blockchains [7].

Xiao et al. [8] discusses a survey of different consensus models and recommends that hybrid models are highly efficient when compared with their single consensus-based counterparts to improve this scalability. These models provide a wider hash search space to underlying consensus models, thereby improving their overall performance. Otsuki et al. [9] discusses that performance can be validated via the work in, wherein different attack scenarios are demonstrated for any underlying consensus model, and a case study of this performance evaluation on the Practical Byzantine Fault Tolerance (PBFT) model is described [10].

Wang et al. [11] performed the survey of these consensus models along with their characteristics that can also be observed in, wherein researchers have proposed the use of automatic & adaptive self-organization of miner nodes and cluster-based classification & analysis of consensus models [12]. Xiang et al. [13] discusses the application of these models, where the Proof of Previous Transactions (PoPT) based model is discussed. This model utilizes previous trust levels of miner nodes, in order to assist their selection/deselection from the network. Due to this, only the miner nodes that have high efficiency, and have showcased good temporal performance are used for consensus.

Liang et al. [14] discusses that models have good mining performance, but their security can be improved via the use of multiple hybrid encryption models, modification of hashing techniques, and improving key exchange behaviour. Pang et al. [15] discussed that such a work, where the security of blockchains is improved using multiple algorithmic augmentations, wherein Blockchain-Based Homomorphic Encryption, Multiple tokens-based Proof of Stake, and variants of proof of work (PoW) models are discussed [16].

Bhutta et al. [17] discussed that these models contribute to the enhancement of the system's overall security by including encryption, hashing, and key exchange layers into the architecture of the system. Experiments that are similar to these are reported in [18]. Hu et al. [19] demonstrated in their studies that integrated credit systems for consensus, improves both the quality of service and the efficiency of mining. The applications of these models are explored in [20, 21]. These references include discussions on the Byzantine Consensus Algorithm for information authentication, authentication of data in the internet of things (IoT) for healthcare applications, and large-scale network authentications. These apps help improve blockchain consistency for public, private, and consortium-based blockchains by reducing network overheads and computational redundancies.

Ngubo et al. [22] discussed that the consistency of blockchain can be improved in all three types of blockchains. Similar models are discussed in [23,24,25], where applications such as WiFi-dependent consensus, inference-based consensus, consortium blockchain-based trust-varying mining, and application of consensus to software guard extensions (SGX) are proposed. Feng et al. [26] discussed that these models are similar to the ones presented in this article. In addition, trust management has been described with the goal of determining the trustworthiness of miners, rotating several random Masters, and an error-correcting data storage system that is built on blockchain technology [27, 28].

Srividya et al. [29] discusses that mining delays are decreased even more, and the overall security performance of public, private, and consortium blockchains is improved as a result of the use of these models, which aid in identifying mining nodes based on trust-based modelling scenarios. In light of these data, it is possible to draw the conclusion that hybrid consensus models with trust-based miner selection perform better than other models with regard to security and quality of service performance [30, 31]. Motivated by this observation, the next section proposes the design of a blockchain consensus model with trust integrated self-correcting miner selection. The performance of the proposed model is evaluated in terms of mining delay, & energy requirements, and is compared with various reviewed approaches (Table 1).

Table 1 Comparative analysis of related work

3 Design of the proposed blockchain consensus model with trust integrated self-correcting miner selection

Based on the literature review, it is observed that researchers have proposed a wide variety of consensus models, and each of them utilizes different mining algorithms to optimize blockchain network performance. Based on these models, it can be observed that delay for block addition can be represented via reading, writing, & verification components, and can be evaluated via Eq. (1) as follows,

$${D}_{a}={D}_{r}*L+\left({D}_{h}+{D}_{c}\right)*N+{D}_{w}$$
(1)

where \({D}_{a}, {D}_{r}, {D}_{h},{D}_{c}, and {D}_{w}\) represent the delay needed to add a new block, delay needed to read existing blocks, delay needed for hashing, delay needed for checking hash values, and delay needed for writing a block, while \(L \& N\) represent the current length of blockchain, and a number of times the block hash is found to be non-unique. It is observed in Table 2 and Fig. 2, that the result of total delay computations over POS, POW, and the proposed hybrid consensus algorithm. The Random number of blocks is taken to analyse the efficiency of the proposed algorithm in terms of delay.

Table 2 Comparative results of delay computation on different consensus algorithm
Fig. 2
figure 2

Delay analysis on different consensus algorithms

It is observed that adding a new block, exponentially increases with an increase in blockchain length, and thus researchers must explore options to reduce internal delays for improving blockchain speed. But most of the models used for delay reduction have limited scalability, and reduced flexibility when applied to large-scale network deployments. In order to improve blockchain scalability, while ensuring high quality of service (QoS) mining performance, the upcoming section discusses the design of the proposed trust integrated self-correcting miner selection model.

The comprehensive flow of the model is described in Fig. 3, wherein entire process of mining node selection, block creation & self-correction mining is visualized. The model initially uses a novel trust-factor evaluation method for selecting the best miner nodes. This trust factor is evaluated using node-to-node distance, energy levels, and historical trust values. Once miners are selected, then a hybrid consensus model is activated, which uses a combination of PoS, and PoW-based methods to improve mining efficiency. If the node is attacked, then the trust value is decreased and the self-correction process is called to update the hash of an affected node and validated the blockchain. Process of self-correction works simultaneously with the Trust Value computation of the node. Each selected miner node is validated using a self-correcting mechanism, which assists in the identification of hash mismatches and correcting them using a linked copy mechanism. The model design is categorised into 3 different parts, and each of which is discussed in detail in different sub-sections of this text.

Fig. 3
figure 3

Overall flow for the proposed TISCMB model

3.1 Trust-based miner node selection model

In order to design trust-based miner node selection, the proposed model utilizes node-to-node distance, node residual energy levels, and temporal trust levels. These levels are iteratively evaluated for each node, and a relative node score is evaluated using the following process,

  • Request for block addition originates from a source node, located at position \({x}_{s}, {y}_{s}\) in the cartesian space.

  • Let there by ‘\(n\)’ other nodes in the space, with locations [\(\left({x}_{1}, {y}_{1}\right), \left({x}_{2}, {y}_{2}\right), \dots ({x}_{n}, {y}_{n})\)]

  • Let the energy of these nodes be represented as \({E}_{1},{E}_{2}, \dots , {E}_{n}\)

  • Initialize a previous trust level for each node, and instantiate it with a constant value \(t\)

  • For each node, evaluate its relative trust score (\(RTS\)) using Eq. (2),

    $$RT{S}_{i,S}=\frac{{E}_{i}}{{d}_{i,S}}+\frac{T{L}_{i}}{T{L}_{S}}$$
    (2)

where \({d}_{i,S}, and T{L}_{i}\) represent the distance between node \(i \& S\), and the previous trust level of node \(i\), which is updated after every evaluation.

  • Find the average relative trust threshold using Eq. (3),

    $$RT{S}_{th}=\frac{\sum_{i=1}^{n}RT{S}_{i,S}}{n}$$
    (3)
  • Discard all nodes with trust levels lower than \(RT{S}_{th}\), and select other nodes as probable miner nodes.

Based on this process, a list of probable miner nodes is identified. Each of these nodes is checked for blockchain validation, and correction using the following process,

  • For each node in the list of probable miner nodes, validate their local blockchain copy, using the following steps,

    • Let the number of blocks in this blockchain copy be \(N\)

    • For each block in the blockchain, check the identity given in Eq. (4),

      $$Previous\,Hash\left(i\right)=Hash\left(i-1\right)$$
      (4)
    • If this identity holds true for all blocks in the local copy, then mark this chain as validated, and reduce its energy level using Eq. (5),

      $$Ne{w}_{E}=Ol{d}_{E}-\sum_{i=1}^{N}{E}_{chec{k}_{i}}$$
      (5)

where \(Ne{w}_{E}, Ol{d}_{E}, and {E}_{check}\) represent the new energy level of the recent node, old energy level of the current node, and the energy needed by a node to check & validate one block.

  • Relative trust values for all probable miner nodes with validated blockchains are directly used, and their trust level is incremented while for miner nodes with invalid blockchains, Blockchains are self-corrected via the process given in Sect. 3.3 and their trust level of respective node is reduced using Eq. (6) as followswhere \({N}_{Inv}\) represents the number of invalidated blocks found in the blockchain.

    $$TL =\left\{\begin{array}{ll}TL+1,&\quad if\, node\, is\, validated\\ TL-{N}_{INV},&\quad Otherwise\end{array}\right.$$
    (6)
  • The energy level of this node is reduced using Eq. (7) as follows

    $$E=E-{N}_{Inv}*{E}_{check}$$
    (7)
  • These new values of energy and trust levels are used for re-evaluation of relative trust score.

  • Upon re-evaluation, the nodes are re-ranked according to \(RTS\) values, and a final ranking list is evaluated.

figure a

Based on this final ranking list, miner nodes are selected, and used for consensus by the hybrid consensus model. The complete design of the hybrid consensus model is discussed in the next sub-section of this text, wherein its internal working is discussed in detail.

3.2 Hybrid consensus model

Once miner nodes are selected by the trust-based model, then each of the nodes executes a hybrid consensus algorithm for hash evaluation. To perform this task, the following block structure as discussed in Table 3 is used.

Table 3 The used block structure for storage

In the current block structure, values of a source node, destination node, data, timestamp, and previous hash are prefilled, and cannot be modified. Thus, to enforce block-level uniqueness, the Nonce value must be modified. In order to generate a new nonce value, the following Eq. (8) that utilizes chain length (\({C}_{length}\)) is used,

$$Nonce=random\left(RT{S}_{i,S}+Stak{e}_{S}+Timestamp+{C}_{length}\right)$$
(8)

where \(Stake\) is initialized with unity value at node-level, and incremented for each source node. Due to the addition of \(RTS, Stake \& Timestamp\) values, the model is able to generate unique hash values at faster speeds.

figure b

This is due to the fact that in PoW blockchains, chain lengths are used, while in PoS blockchains, node stakes are used to generate unique hash values, which restricts the random number feature space. While in the hybrid model, a combination of chain length, node stake, and relative trust score is used for enhancing random number generation, thereby reducing the overall delay needed for hash generation. Based on the generated nonce value, each node can find a unique hash value, and provide it for consensus. In order to a hash value to be accepted, conditions in Eq. (9) must be satisfied,

$$\begin{aligned} & Gen_{hash} \notin Previous\;Hashes \\ & T_{hash} = Min\left( {T_{i} } \right)\;where\; i \in M_{selected} \\ \end{aligned}$$
(9)

where \(Ge{n}_{hash}, {T}_{hash}, and {M}_{selected}\) represent generated hash, time needed for hashing, and a list of selected miner nodes. Based on these conditions, new hashes are generated, and blocks are formed. The step-wise procedure of the proposed model is shown by algorithm 1, wherein process hybrid consensus is summarized. These blocks are validated using a self-correcting blockchain model, which is described in the next sub-section.

3.3 Self-correcting blockchain model

Any wireless node is prone to a wide variety of attacks, which include man in the middle, masquerading, spoofing, spying, etc. During attack, internal blockchains stored on nodes are exposed to hackers, which allows them to modify data, and hash values present in the chain. In order to self-correct such blockchains, the following process is used,

  • For each block in the chain,Evaluate its hash value using

    • Evaluate its hash value using Eq. (10),

      $$Hash=SHA256\left(\begin{array}{c}Prev. Hash, Src, Dest, \\ Data, Timestamp, \\ Metadata, Nonce\end{array}\right)$$
      (10)
    • Compare the current hash value, with the previous hash value from the next block, and verify whether they are equal.

    • If they are, then go to next block in the chain, else find a node with the highest RTS value, and copy the blockchain from that node.

  • Once the blocks are copied, then perform chain correction using Eq. (4) as follows,

    $$Previous\, Hash\left(i\right)=Hash\left(i-1\right)$$

Once this process is followed, the entire chain of the current node is validated. For each block that is found to be non-validated, the chain’s trust levels, and energy levels are modified using Eqs. (6) and (7), which assists in re-ranking nodes for better miner selection. Based on this process, new blocks are added to the blockchain, and their performance is evaluated. This performance evaluation is done in terms of transaction delay, and energy consumption, under a number of attacks that are mitigated by the system. A comparative analysis of these parameters can be discussed in the next section of this text.

4 Result analysis and comparison

In order to evaluate the performance of the proposed hybrid model, the blockchain network was tested under the large number of connection requests. All these requests were conducted on a standard network environment, which consists the following parameters (Table 4).

Table 4 Network parameters used for analysis

The number of nodes varied from 100 to 1000, and the following attacks (along with the reasons for selecting them) were injected into the system,

  • Sybil attack (selected because blocks in the blockchain can be modified by attackers)

  • Spying attack (selected because blocks in the blockchain can be spied upon by attackers via route disruptions)

  • Spoofing attack (selected because false blocks can be added by attackers)

Due to the inclusion of a self-correcting model, and hybrid consensus with trust-based miner selection, QoS of the proposed kernel is better when it is compared with PoS [14], PoW [4], and PoPT [12] under different attacks. This performance is evaluated by changing the number of attacker (NA) nodes between 1 and 10%, and by evaluating QoS values. Average QoS values were estimated by adding 100k blocks for a network of 1000 nodes. This gives the true estimation of the performance of the hybrid model and includes large-scale deployment scenarios. According to the strategy used for evaluation, the values for end-to-end delay (D) for different existing models with the proposed model can be observed under Sybil attack are tabulated in Table 5.

Table 5 Average end-to-end delay for different consensus models (Sybil attack)

From this evaluation, and Fig. 4, it is estimated that the proposed hybrid model is 20% faster than PoS [14], 23% faster than PoW [4], and 28% faster than PoPT [12] under Sybil attack. Similar delay performance is obtained under different Spying attackers and compared over existing methods with the proposed method. This can be observed from Table 6 as follows.

Fig. 4
figure 4

End-to-end delay analysis over Sybil attack

Table 6 Average end-to-end delay for different consensus models (Spying attacking)

From this evaluation and Fig. 5, it is estimated that the proposed hybrid model is 18% faster than PoS [14], 20% faster than PoW [4], and 22% faster than PoPT [12] under Spying attack. This delay is further estimated for Spoofing attack which can be analysed over existing methods with the proposed method, is observed in Table 7.

Fig. 5
figure 5

End-to-end delay analysis over Spying attack

Table 7 Average end-to-end delay for different consensus models (Spoofing attack)

From this evaluation and Fig. 6, it is estimated that the proposed hybrid model is 14% faster than PoS [14], 16% faster than PoW [4], and 19% faster than PoPT [12] under Spoofing attack. The reason for this delay reduction as observed in Fig. 7, trust-based miner selection, the use of automatic correction of attacked nodes, which assists in reducing the delay needed for securely mining new blocks. The proposed hybrid consensus algorithm gives better results.

Fig. 6
figure 6

End-to-end delay analysis over Spoofing attack

Fig. 7
figure 7

Delay for different models

Similar estimations are performed for energy consumption, and this can be observed for Sybil attack and analysed over existing methods with the proposed method from the following Table 8.

Table 8 Average energy consumption for different consensus models (Sybil)

From this evaluation and Fig. 8, it can be estimated that the proposed model is able to reduce energy consumption by 20% than PoS [14], 15% than PoW [4], and 18% than PoPT [12] under Sybil attack. Similar performance was observed for spying attacks and compared with the existing methods and the proposed method, this can be observed in Table 9 as follows.

Fig. 8
figure 8

Energy consumption over Sybil attack

Table 9 Average energy consumption for different consensus models (Spying attack)

From this evaluation and Fig. 9, it can be estimated that the proposed model is able to reduce energy consumption by 26% than PoS [14], 18% than PoW [4], and 22% than PoPT [12] under Spying attack. This energy consumption is further evaluated for Spoofing attack and compared with the existing methods and the proposed method, this can be observed in Table 10 as follows.

Fig. 9
figure 9

Energy consumption over Spying attack

Table 10 Average energy consumption for different consensus models (Spoofing attack)

From this evaluation and Fig. 10, it is observed that the proposed model is able to reduce energy consumption by 41% than PoS [14], 29% than PoW [4], and 33% than PoPT [12] under Spoofing attack.

Fig. 10
figure 10

Energy consumption over Spoofing attack

The consolidated average analysis for energy required is observed in Fig. 11, where proposed model depicts better results. The reason behind this reduction in the above parameters, is the use of trust-based mining nodes, and hybrid consensus, which reduces the number of rounds needed for generating unique hash values, thereby reducing delay, and energy consumption when tested for different attack types.

Fig. 11
figure 11

Energy consumption for different models

5 Conclusion and future scope

In this paper, we proposed TISCMB model uses a combination of hybrid consensus, with trust-based miner selection which assists in improving the QoS performance of the blockchain network. Furthermore, due to the addition of self-correction, the network is able to reduce the probability of attacks, due to which the overall efficiency of blockchain storage is improved. This efficiency was evaluated in terms of transaction delay, and energy consumption under different attack types. It was observed that for Sybil attack, the proposed hybrid model is 20% faster than PoS [14], 23% faster than PoW [4], and 28% faster than PoPT [12]; and the proposed model is able to reduce energy consumption by 20% than PoS [14], 15% than PoW [4], and 18% than PoPT [12]. Similarly, for Spying attack, the proposed model is 18% faster than PoS [14], 20% faster than PoW [4], and 22% faster than PoPT [12], while the proposed hybrid model can reduce energy consumption by 26% than PoS [14], 18% than PoW [4], and 22% than PoPT [12]. Finally, for Spoofing attack, it is estimated that the proposed model is 14% faster than PoS [14], 16% faster than PoW [4], and 19% faster than PoPT [12], while, the proposed model can reduce energy consumption by 41% than PoS [14], 29% than PoW [4], and 33% than PoPT [12], which makes the proposed model highly useful and efficient under a wide variety of attacks. In future this work can be extended to different deep learning models for improving overall performance of miner node selection, which will further improve network lifetime, and speed of transactions, which will improve overall network scalability, flexibility, and effectiveness.