title: P2P consensus outside the main application?
body: <p>I have implemented a simulator (in Java) to show the performance of my protocol designed for distributed and peer-to-peer networks, in which transactions are processed via a consensus mechanism. Since it is a simulator, the nodes/peers are virtual (and not a real machine.)</p>
  <p>Is it possible to perform the consensus <strong>outside the main application</strong> and after finishing each round of consensus, the result of consensus is returned to the simulator? I mean by passing the required parameters (such as, number of nodes etc.) to the application which performs the consensus, then, it executes the consensus on validity of a transaction, and after that, it returns the result of the consensus to the simulator application.</p>
  <p>For example, if the consensus mechanism is Raft, the simulator application (my application in Java) sends the transactions to e.g. <a href="https://ratis.apache.org/" rel="nofollow noreferrer"><strong>Apache Ratis</strong></a> (which implements Raft consensus), or if the consensus is PBFT, the simulator application sends the transactions to e.g. <a href="https://sawtooth.hyperledger.org/docs/pbft/releases/latest/introduction-to-sawtooth-pbft.html" rel="nofollow noreferrer"><strong>Sawtooth PBFT</strong></a> (implemented by IBM Hyperledger) etc.</p>
  <p>I am not sure if it would be possible to transfer the transactions from the simulator application to the software which executes the consensus (like Apache Ratis or Sawtooth PBFT) by using a message-broker such as <strong>RabbitMQ</strong>...</p>
  <p>Is this a practical method? <strong>If so, the simulator can get free of implementing several different consensus mechanisms.</strong></p>
  <p>Following figure describes generally what I want:
  <a href="https://i.stack.imgur.com/KgZxQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KgZxQ.png" alt="enter image description here" /></a></p>
  <p><strong>P.S.</strong> <em>If the question is not yet clear enough, please let me know to modify it.</em></p>