About ◈ Design ◈ Getting started ◈ Supporting the project ◈ Joining the discussion
This repository is where the IOTA Foundation's Research Team simulates tests on the autopeering module to study and evaluate its performance.
By making this repository open source, the goal is to allow you to run your own simulations and get involved with development.
To find out more details about autopeering, see the following resources:
- Coordicide White Paper by Coordicide Team, IOTA Foundation
- Coordicide update - Autopeering: Part 1 by Dr. Angelo Capossele
- How do we achieve a verifiably random network topology? by Dr. Hans Moog
You can also see a working example of autopeering in our prototype node software called GoShimmer.
The autopeering module is divided into two submodules:
-
Peer discovery: Responsible for operations such as discovering new peers and verifying their online status
-
Neighbor selection: Responsible for finding and managing neighbors
To complete this guide, you need to have at least version 1.13 of Go installed on your device.
To check if you have Go installed, run the following command:
go version
To get started, follow these steps to build and run the simulator.
-
Clone this repository
git clone https://github.com/iotaledger/autopeering-sim.git
-
Change into the
autopeering-sim
directorycd autopeering-sim
-
Build the executable file
go build -o sim
-
If you're using Windows, append the
.exe
file extension to thesim
file -
Run the simulation
./sim
-
Open a web browser and go to
http://localhost:8844
to see the simulator
The highlighted colors show the following:
Blue line: New connections between neighbors Red line: A dropped connection between neighbors Blue circle: A node that is accepting a peering request Green circle: A node that is sending a peering request
To analyse the results of the simulation, read the .csv
files in the data
directory:
- comvAnalysis: Proportion of nodes with a complete neighborhood and average number of neighbors as a function of time
- linkAnalysis: Probability Density Function (PDF) of the time a given link stays active
- msgAnalysis: Number of peering requests sent, accepted, rejected, received and the number of connections dropped of each peer, as well as their average
To generate graphs of the data, run the provided Python script.
You must have Python and PIP installed to run this script. The script generates graphs in .eps
files, so to view the graphs, you also need an application that can open these files.
-
Install the dependencies
pip install numpy matplotlib
-
Run the script
plot.py
script from thesimulation
directorypython plot.py
The graphs provide two figures:
- The proportion of nodes with a complete neighborhood and the average number of neighbors as a function of time
- The Probability Density Function (PDF) of the time a given link stays active
These parameters affect how the simulation behaves. As a result, changing these parameters has an affect on how long the protocol takes to converge.
To change any of these parameters, edit them in the config.json
file.
Parameter | Type | Description |
---|---|---|
NumberNodes |
int | Number of nodes that try to autopeer in the simulation |
Duration |
int | Duration of the simulation in seconds |
SaltLifetime |
int | How often the public salt changes for each node in seconds |
VisualEnabled |
bool | Whether the visualization server is enabled |
DropOnUpdate |
bool | Whether to drop all connections to neighbors each time the SaltLifetime parameter expires |
The messages exchanged during autopeering are serialized using Protocol Buffers. To generate the corresponding Go files after changing the protobuf files, use the following command:
make compile
If you want to contribute to the code, consider posting a bug report, feature request or a pull request.
See the contributing guidelines for more information.
If you want to get involved in the community, need help getting started, have any issues related to the repository or just want to discuss blockchain, distributed ledgers, and IoT with other people, feel free to join our Discord.