Chapter 7
Exchanging informations and data

Initial version: 2024-03-07
Last update: 2024-03-12

Blockchain doesn't make any sense if there is only one node. At the begining we agreed that there must be many independent and centraly uncontroled nodes to ensure correctness and truth of common data they store. The main assumption is that even if a group of nodes try to fraud existing data, the remaining majority having true data will prevent forgery. To make it possible nodes must exchange somehow informations and than do they best to store only true data and find a consensus what is truth.

Table of contents


Six degrees of separation


To exchange data in a higly distributed system consisting of peer nodes the only resonable approach implements human-like news or gossip sharing method. The source of information pass it to nearest group of people it best knows. This is how recursive process begins: every recipent pass each news also only to nearest group of people it best knows. They do the same with people they know, etc. This is how after a few steps an information from a source reaches even the most distant recipent. How many step is few steps?

Concept of reaching any possible node by a chain of others is not new and exists also in human society. Six degrees of separation (don't be confused with the six degrees of freedom which refers to mechanical properties of a rigid body) is the idea that all people are six or fewer social connections away from each other. As a result, a chain of "friend of a friend" statements can be made to connect any two people in a maximum of six steps (thus you need no more than five individuals). It is also known as the six handshakes rule (see [wiki_sdos]).

We should select any person from the 1.5 billion inhabitants of the Earth – anyone, anywhere at all. [...] using no more than five individuals, one of whom is a personal acquaintance, [you] could contact the selected individuals using nothing except the network of personal acquaintances. For example, "Look, you know Mr. X.Y., please ask him to contact his friend Mr. Q.Z., whom he knows, and so forth." [sergre]

Watts and Strogatz showed that the average path length (APL) between two nodes in a random network is equal to $ln N / ln K$, where $N$ is a total number of nodes and $K$ represents number of acquaintances per node. Thus if $N = 300,000,000$ (90% of the US population) and $K = 30$ then Degrees of Separation = APL = 19.5 / 3.4 = 5.7 and if $N = 7,200,000,000$ (90% of the world population) and $K = 30$ then Degrees of Separation = APL = 22.7 / 3.4 = 6.7. (It is assumed that 10% of population are too young to participate.) [wikisdos, watstr]

As we are talking right now about social connections let me deviate from the main topic and briefly mention Dunbar's number.

Dunbar's number is a suggested cognitive limit to the number of people with whom one can maintain stable social relationships – relationships in which an individual knows who each person is and how each person relates to every other person. This number was first proposed in the 1990s by British anthropologist Robin Dunbar, who found a correlation between primate brain size and average social group size. He proposed that humans can comfortably maintain 150 stable relationships. [wikidunb]

Think about this next time when you will brag all around how many followers on social media you have. Most of them are ghost people who even may don't know or remember that thay follow you.




Connections management


Both in human and digital word management of connections requires few actions.

Establishing a new relationship

From a human point of view to establishing social connection requires the kind of conversation that is necessary to let new people join the existing group. A specific form of the protocol depends on the group's character – it would be different for proffesionals, different for colleagues, different for friends, etc. Regardles on details new member always undergoes a kind of initiation procedure to familiarize with the gropu's members, its history, shared system of values and all rules they are expected to preserve.

In blockchain you can relize this with the following message passing protocol:


[New node]: Hi, I'm new node. I want to join your network.
[Old node]: Hello, welcome. I have just added you to my list of nodes I know.
[Old node]: Here you have this list. I'm sending you all data related to our blockchain I maintain at this moment. 


To keep social connection active and stable you have to perform two other conversations types: status updating and news sharing.

Status update

Status update messages are not intended to share huge amount of data. They are just dedicated to keep existing relationships alive. In human's everyday live this is also very often used to share news like: I'm getting married or I crashed my car but in most cases this if for what we have a status field in most media services where you put some information related rather to current, quickly passing moments like: The weather today is depressing me or Have a nice day to everyone I know. This way you attract the attention of all the participants informing them you are alive without sending any essential information.

In blockchain you can relize this with the following message passing protocol:


[Node 1]: Hi, I'm still here.
[Node 2]: Great, got it.


This kind of conversation is known as a ping message or simply ping. Sometimes the first phase in named ping while the second is named pong. In the simplest form it is offen shorten to sending one message:


[Node 1]: Hi, I'm still here.


Probably for this reason there is also alternative name: heart beet as listening to the heartbeat does not require any confirmations.

News share

In this type of messaging a substantial informations are exchanged among the participants. Depending on the type of data the conversation takes different scenario.

In blockchain you can relize this with the following message passing protocol:


xxx


Formal conversation specification


In this subsection I will give a precise description of communication between nodes. I will present type of messages they pass, their structure, type of data etc. Fell free to skip this subsection if you are not interested in technical details. They are not strictly necessary to understand how blockchain works, and any time in the future you will see you need it, you can return here back.

XXX

Problems you should be aware of


You should know that in any distributed peer-to-peer system:
  • each node can connect, disconnect and reconnect with the system at any given time without any attempt to warn other nodes;
  • each node independently maintains a list of peers it communicates with and this list is not the same for all nodes;
  • each node communicat with other nodes sending and receiving messages of various, well defined type;
  • the time when messages are send and receive has totaly random nature;
  • messages are not guaranteed to arrive at the destination node, they may never reach it;
  • contrary to previous, messages may arrive more than once;
  • messages may arrive in a different order than they were sent.


General architecture


xxx

Implementation


In this section you will see my implementation of a simple gossip like application. Here I will present the idea that forms the main framework of the application. The full code you will find in repository .

Using such a framework instead of sending rumors you can send meaningful messages according to some protocol as it was discussed above. Utilizing it in blockchain application is indispensable. How I did it you ma find in repository

Summary


In this chapter you learned about different type of massages you should think of implementing blockchain. They will allow you to initiate a new node, exchange informations and data between nodes and keep the closes peer to be aware of your existance.

You also saw simple application to spread messages in highly distributed and decentralized way on which basis you may implement your blockchain.