# Object distribution/splitting

Submitted by 365degrees in nettle (edited )

It's been a while since I posted anything, since the Nettle rewrite hasn't really made anything noteworthy (other than speedups and a half-decent language).

This modification will distribute chunks of the network over multiple nodes, and is not backwards compatible.

## Splitting

A node picks two numerators and a denominator. The difference of the numerators over the denominator is effectively the percentage of the Nettle world the node operator wishes to store on the node:

```
| n1 - n2 + 1 |
| ----------- |
| d |
```

The numerators should be random, but the difference should be chosen appropriately.

## Client choices

When a client requests or puts a file, the client should first take the node's numbers (which I will get to in another post, probably named like "Node announcing protocol"). The client should hash the value and produce a number. I'd suggest CRC32 for the hash, it doesn't need to be secure, it should be a pseudorandom number effectively. 32 bits also fits into all reasonable computers made today without bignums. The client then scans its list of connections, choosing one where `n1 <= (hash mod d) <= n2`

. The client finally can get or put the object to the server.

## Examples

A node with `n1=1, n2=1, d=8`

would host one eighth of the Nettle content, specifically where the hash mod 8 is 1 and only 1.

A node with `n1=2, n2=4, d=4`

is far more generous, hosting three quarters of the Nettle world. The hash mod 4 can be 2, 3 or 4.