<p>In the RAFT algorithm if a candidate who wants to become a leader in the network then his proposed "term value" will be checked at the beginning.
1) If it's less than the present "term value" then he will not be selected as a leader.
2) If it's more than the current "term value" then his current "index value" will be checked.
a) If his index value is less than the current index value then he won't be selected.
b) If his index value is more than current index value then he will be selected as leader.</p>

<p>In this case "Candidate 4" will be leader as in every round his term value is not lesser than current term value and his index is updated to current node.</p>

CC BY-SA 4.0
2018-09-06T14:15:17.193Z
2018-09-06T14:20:46.983Z
2018-09-06T14:20:46.983Z
VforVendetta
<p>Suppose a network of 5 nodes uses RAFT consensus protocol. Each nodes maintains a transactions log which consists of a list of the log entries. Each log entry again consists of index and term. All of them are marked themselves as leader candidate and send the request Vote (term, index). The current log entries (i.e. list of term and index values) of all the leader candidate nodes as follows - </p>

<p><a href="https://i.sstatic.net/ZYeq0.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ZYeq0.png" alt="enter image description here"></a></p>

<p>Then who will be the leader ?</p>

CC BY-SA 4.0
2019-08-11T16:26:46.897Z
I'm voting to close this question as off-topic because it has nothing to do with bitcoin or blockchains.
Ava Chow
<consensus>
How to select a leader in RAFT consensus protocol
Anonymous
# How to select a leader in RAFT consensus protocol

(Asked by: username_0 on 2018-08-31)

Suppose a network of 5 nodes uses RAFT consensus protocol. Each nodes maintains a transactions log which consists of a list of the log entries. Each log entry again consists of index and term. All of them are marked themselves as leader candidate and send the request Vote (term, index). The current log entries (i.e. list of term and index values) of all the leader candidate nodes as follows -

[![enter image description here](https://i.sstatic.net/ZYeq0.png)](https://i.sstatic.net/ZYeq0.png)

Then who will be the leader ?

**Tags:** consensus

> **Comments:**
> **username_1**: I'm voting to close this question as off-topic because it has nothing to do with bitcoin or blockchains.  

---

## 1 answers

### Answer by username_2 on 2018-09-06. Score: 0

In the RAFT algorithm if a candidate who wants to become a leader in the network then his proposed "term value" will be checked at the beginning.
1) If it's less than the present "term value" then he will not be selected as a leader.
2) If it's more than the current "term value" then his current "index value" will be checked.
a) If his index value is less than the current index value then he won't be selected.
b) If his index value is more than current index value then he will be selected as leader.

In this case "Candidate 4" will be leader as in every round his term value is not lesser than current term value and his index is updated to current node.


---

