Raft might be an answer. Yes, it's a bit of overkill considering the fact that you don't need to apply any state for storing. But you might need to apply some state for validation, for example, checking that all nodes have unique ID. And it's really robust in terms of leader election procedures. Anyway you can check wrapper that i implemented for easy Raft usage: https://github.com/filinvadim/easy-raft