Overview

This is an Open source consensus implementation specifically designed for the the context of D-MANETs. This implementation is based on a variant of the One-Third-Rule Heard-Of algorithm , extending it with JOMS.

Quick Links

Pre-Requirements

Before start using this consensus implementation, JOMS provider is required to be installed and configured on hosts. For installing JOMS, please refer here.

Top...

Download
Web Template
Do you know?
“Rare are the [DTN] protocols that were implemented, tested in real-life and proven to be free of lethal stealthy assumptions.”

Do not worry! you are in the right place. The source code of this consensus implementation with many examples are now distributed under the terms of the GNU General Public License. The source code consists of about 3000 lines of code. So good luck, and here is:

Top...

Getting started

Here, I will present a code example demonstrating how to write a consensus application for D-MANETs. It is intended to be the quickest path to the consensus experience in such networks. So, sit back, relax and give the following example some thought.

Step 1: Import the required Packages
import casa.consensus.consensusImpl.*;
import participantTable.*;
import nodes.ConsensusNode;
Step 2: Create a ConsensusFactory. In general, consensus applications begin all by looking up an instance of this class
ConsensusFactory cFactory=new ConsensusFactory();
Step 3: Now you can start using the ConnectionFactory instance to create Session and ConsensusNode instances
// Session
Session session=cFactory.createSession(...);
// ConsensusNode
ConsensusNode node=cFactory.createConsensusNode(...);
Step 4: Start the Session
session.start(...);
Step 5: Sending Votes
node.voting(...);
Step 6: Send the Decision
node.decide(...);
Step 7: A ParticipantTable instance can be initialized as follows
ParticipantTable pTable=ParticipantTableSingleton.getInstance();
Step 8: The ParticipantTable can be used to lookup/list known ConsensusNode(s)
//lookup a consensus node
ConsensusNode node = pTable.lookup(...);
//list consensus nodes
Collection nodes = pTable.list(...);

Top...

The Console

You want to test our consensus implementation in real conditions but you do not want to burn yourself out writing too many applications. Okay, here is the solution. I offer you an interactive tools, called Console. This console provides you with the most commonly commands, i.e., create Sessions/ConsensusNodes, start/list Sessions, send Votes/Decides and the ParticipantTable commands. The console’s source code is available at consensusImpl/console directory.


Scenario

You can check the scenario in the following figure: there are four devices, named here A, B, C and D. All of these hosts are well-configured. And now, the following steps describe how to run the Console in the this scenario:


Web Template

Step 1: Launch the console on A, B, C and D
java -cp consensusimpl-0.0.1-jar-with-dependencies.jar casa.consensus.consensusImpl.console.TCPConsole
Step 2: Access to the console on A, B, C and D
// The port number could be changed using the configuration file
telnet localhost 8800

Congratulation! you can now use it. The following examples demonstrate how to use some of the console commands:

To see the full list of console's commands on any device, type:
co help
On any device, in order to declare itself as a consensus node type:
co node
On the device A, to create a session named “election_A” in which all the known consensus nodes can participate (i.e., A,B,C and D) type:
co start election_A
On the device B, in order to participate in the session "election_A" and vote "B", type:
co vote election_A B
On the device C, in order to list the sessions in which it can participate, type:
co list
On the device D, in order to list all the consensus nodes that it knows about (i.e., list the entries of the ParticipantTable)
co participant

Top...