IOTA: The Fast Probabilistic Consensus simulator

  • Friday, 27 September 2019 15:53
One Step Closer to Coordicide: IOTA Releases Fast Probabilistic Consensus SimulatorIn a previous blogpost, the IOTA Research Department, with the collaboration of one of our research grant recipients, Dr. Sebastian Mueller, published simulation results of the FPC protocol, short for Fast Probabilistic Consensus, which was proposed by Dr. Serguei Popov and Dr. Bill Buchanan.Today, we are excited to share with you the source code of the simulator we use to produce some of the results of FPC. Releasing the FPC simulator to the public allows us to include the community, open up the technology and encourage to get it tested in the wild.Our simulator is written in Go and you can access the code from the following repository:https://github.com/iotaledger/fpc-simThe simulator is optimized to assess how FPC behaves under certain conditions. We streamlined the source code to vote on single transactions. In the simulation, nodes can behave either honest or adverse.For each transaction, we define the average initial opinion of the honest nodes, a strategy for the adversaries, as well as other parameters. We briefly discuss some of those parameters in the following section.View of the networkIn the FPC paper, we assume that every node has a complete view of the network, but we are also interested in what happens if we assume a partial view of the network instead. In other words, we want to analyze how the lack of complete knowledge about all other nodes in the network affects the ability to reach consensus.To study this scenario, we have included a Watts-Strogatz model, which allows simulating the network as a graph with small-world properties. Two parameters are added for the creation of these graphs:Firstly a parameter δ, which sets the proportion of the network a node can peer with, and a parameter γ which is the rewiring probability. The graph is created in the following way: firstly we create a ring graph in which each node neighbors with the closest δN-1 neighbors, where N is the total number of nodes.Then for half of these connections, a new peer is selected randomly from the remaining nodes with the rewiring probability γ. Note that for γ=0 we obtain a ring graph, which maximizes the diameter of the graph for a fixed δ. The latter can be understood as a worst-case scenario given a Watts-Strogatz graph.Effects of the two parameters in the Watts-Strogatz model.RandomnessWe include the possibility of reducing the likelihood of receiving a random number. This allows the study of the performance of the protocol in case a random threshold is not provided for every round. This is of particular relevance for understanding how much randomness the FPC protocol requires.Adversary’s strategiesFurthermore, we provide the possibility to include two cautious adversary strategies. In the first, the adversary attempts to attack the integrity of the opinions, i.e. flip the initial opinion by continuously voting the initial minority opinion. In the second, the adversary attempts to attack the network by trying to create an agreement failure and break the consensus between the nodes.Metrics and EvaluationCurrently, the simulator supports the following main metrics for which we also provide evaluation scripts:TerminationRate: The rate at which all honest nodes conclude before the maximum allowed round.AgreementRate: The rate at which all honest nodes conclude with the same opinionIntegrityRate: The rate at which all honest nodes conclude with the same opinion and where the final opinion is the same as the original majority.EtaEvolution: A histogram of the honest η-values for each round for nodes that have not yet concluded.For these, we include three evaluation scripts, written in Python with Matplotlib.plot.py and plot2d.py: These two scripts allow evaluation with 1 and 2 vectors of inputs respectively. We employ the script to extract the data from CSV-output files that are produced by the simulation code.For example, in the figures below, we apply the plot.py script for displaying the data that has been obtained by assessing the effects of a partial network view. In the first figure, we take a conservative viewpoint and assume the graph takes the form of a ring. It can be seen that a partial network view is sufficient for the nodes to come to an agreement.Termination and agreement rates with δFor the second figure, we randomized the topology by considering that some of the connections are rewired with probability γ. We show that the agreement rate can be significantly increased whilst keeping the network view small.Agreement rate with γ, for various values of δplot_eps.py: This script provides a heatmap of the distribution of the η-values with time. For example, in the next figure, you can see the evolution of the etas if a large proportion of nodes are adverse.Heatmap of the Evolution of the η-values.In addition, the following metrics can also be extracted and their output is provided as CSV files:MeanTerminationRound: Average round when FPC terminatedMedianTerminationRound: Median round when FPC terminatedTerminationRound: Number of rounds necessary to complete FPC in histogram formMeanLastRound: Mean last round across all nodesLastRoundHisto: Histogram of nodes’ individual termination roundsOnesProportion: The proportion of 1s after the protocol terminatesOnesPropEvolution: Evolution of the proportion of 1sThe IOTA Research team is constantly working on improving the simulation code and adding new features. If you are curious and want to learn more about it, feel free to start experimenting with this code! Also, if you would like to contribute, you could implement new adversary strategies as well as defensive mechanisms. More info on how to build and run the simulator can be found in the README file of the repository.Releasing the Fast Probabilistic Consensus Simulator is another step forward in the Coordicide project. It allows us to engage with the community and researchers interested in the technology alike. Through this, individuals around the world have another avenue to contribute to the effort or even to apply for grants here.We hope you will enjoy the development of this simulator as much as we do. As always, we welcome your comments and questions either here or in #tanglemath on IOTA’s official Discord server.The Fast Probabilistic Consensus simulator was originally published in IOTA on Medium, where people are continuing the conversation by highlighting and responding to this story.

Additional Info

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.

Disclaimer: As a news and information platform, also aggregate headlines from other sites, and republish small text snippets and images. We always link to original content on other sites, and thus follow a 'Fair Use' policy. For further content, we take great care to only publish original material, but since part of the content is user generated, we cannot guarantee this 100%. If you believe we violate this policy in any particular case, please contact us and we'll take appropriate action immediately.

Our main goal is to make crypto grow by making news and information more accessible for the masses.