In a Pebble Network, at a given time, a set of transactions enter the network. Each entering transaction divides the nodes into primary, secondary and ternary. Each node records the timestamp for the transactions on the first see. A transaction, on reaching all the nodes in a network, announces the vector timestamp. The nodes in the network update their local timestamps, with reference to the transaction vector timestamp announced.
In the simulation of this network, we have considered each time step of entering of the transactions as a cycle. We give the number of cycles and the number of secondary nodes as an input. If more than one transaction reaches the same node in a cycle, they are queued and executed. The nodes are distinguished by their unique public keys, and so does the transactions. At the end of the simulation, we display all the nodes in the network, along with their local timestamps. Node connection latency and bad actor percentage of nodes part is yet to be implemented. This part includes the part of the nodes shifting away from their actual behaviour, and to simulate the network to see how it handles such behaviour of the nodes.
The parameters, like the number of cycles in the simulation, minimum & maximum number of transactions entering at a given time, total nodes in the network, the primary fanout etc are passed through the main function.
Pebble Network class contains properties that are global to all the nodes, like Bad actor percetage, total nodes , fanout etc. It also contains method for visualing and sending transaction between nodes.
Pebble Node objects contain method and properties that are specific to a particular node. Like Publickey, staked amount (in future), isBadActor, etc. Methods to receive transactions and functions for malicious behaviours etc.