SAFE Network - Test 12b (Network offline, end of test)

@polpolrene Glad the vault is ticking along well there; our in-house tests are looking promising too at the moment :slight_smile:

Regarding the network size estimation, we recently made a change which could help with this. The format of the node’s name in the log messages will now also include its section prefix too. The new format will look like

Node(abcdef..(10101))

The name is abcdef.. and (once the vault is relocated on joining) won’t change for the lifetime of the vault. The section’s name is defined by the prefix 10101 and it can change over time. We use hex notation for the name and binary for the prefix.

When the network only has one section, i.e. when we’re starting the seed nodes, the prefix is empty, so our example node would show Node(abcdef..()). As the network fills, that section splits into 0 and 1 and our node will end up in 1 because its name begins with a which is 1010. As the splits continue with more nodes joining, our node will be a member of section 10, then 101, then 1010, and so on.

So the point is, that to get a very rough calculation of network size you can use your vault’s name at any point to do this.

On average, sections will have

1.5 * (min_section_size + SPLIT_BUFFER)

vaults where the min_section_size is the Vault’s GROUP_SIZE (currently 8) and SPLIT_BUFFER is 1. So the average section will have 13.5 vaults.

The number of bits in your vault’s section prefix can be used to estimate the number of sections in the network:

2 ^ prefix.bit_count()

So for prefix 10101 we can estimate that there are 2 ^ 5 (i.e. 32) sections, meaning there are roughly 432 vaults.

I can’t emphasise enough how rough this calculation is! Anyway, running this wee snippet, here are the results:

Prefix length:  0 bits => network size very roughly     13 nodes
Prefix length:  1 bits => network size very roughly     27 nodes
Prefix length:  2 bits => network size very roughly     54 nodes
Prefix length:  3 bits => network size very roughly    108 nodes
Prefix length:  4 bits => network size very roughly    216 nodes
Prefix length:  5 bits => network size very roughly    432 nodes
Prefix length:  6 bits => network size very roughly    864 nodes
Prefix length:  7 bits => network size very roughly   1728 nodes
Prefix length:  8 bits => network size very roughly   3456 nodes
Prefix length:  9 bits => network size very roughly   6912 nodes
Prefix length: 10 bits => network size very roughly  13824 nodes
Prefix length: 11 bits => network size very roughly  27648 nodes
Prefix length: 12 bits => network size very roughly  55296 nodes
Prefix length: 13 bits => network size very roughly 110592 nodes
Prefix length: 14 bits => network size very roughly 221184 nodes
Prefix length: 15 bits => network size very roughly 442368 nodes
Prefix length: 16 bits => network size very roughly 884736 nodes
16 Likes