ev on Nostr: # Bogbits spec v0.2 Copy and paste from --- I have an idea for blob distribution that ...
# Bogbits spec v0.2
Copy and paste from
https://nips.zulipchat.com/---
I have an idea for blob distribution that I think is pretty simple, and I'm not sure if anyone has ever done this before. It'd be good to use an existing thing if it already exists.
Imagine you create a hash of a file.
Next you chop the file up in to tiny chunks, like 1024 bytes or whatever. You hash all of the chunks and create an array that is like:
<thishash><nexthash>
You distribute the hash of the file to your peers, and a hash of the stringified array. You can request the array via the array hash.
Then you iterate over this array broadcasting nexthash until you have all of it from your peers. You push all of the content into a file as it comes in, since you're only requesting one hash at a time and then concatenating it when it arrives.
Eventually you have the entire file, but you might randomly select relays to request it from.
Does anything do this already? I imagine Bittorrent is similar, but probably uses a more complicated algorithm. Maybe IPFS comes close to this, but I don't think it includes the hash of the original file.
Critiques welcome.
---
I guess you could just iterate over the entire thing blasting out nexthash very fast, then store everything that comes back to you that is unique, and then try to put it together over and over until you have everything, broadcasting what never came in.
Eventually the program could fail or timeout if you never get all of the parts back from the network.
Published at
2023-06-01 16:53:06Event JSON
{
"id": "11fac7bfce3500cbbc2d00ad1a4c16779d7a7033bd15d57e68e381881280eac4",
"pubkey": "8b278ad86bf6a418dba942ff04fa8ed372303ab1b5e4286b785f7a5cdc07b277",
"created_at": 1685638386,
"kind": 1,
"tags": [],
"content": "# Bogbits spec v0.2\n\nCopy and paste from https://nips.zulipchat.com/\n\n---\n\nI have an idea for blob distribution that I think is pretty simple, and I'm not sure if anyone has ever done this before. It'd be good to use an existing thing if it already exists.\n\nImagine you create a hash of a file.\n\nNext you chop the file up in to tiny chunks, like 1024 bytes or whatever. You hash all of the chunks and create an array that is like:\n\n\u003cthishash\u003e\u003cnexthash\u003e\n\nYou distribute the hash of the file to your peers, and a hash of the stringified array. You can request the array via the array hash.\n\nThen you iterate over this array broadcasting nexthash until you have all of it from your peers. You push all of the content into a file as it comes in, since you're only requesting one hash at a time and then concatenating it when it arrives.\n\nEventually you have the entire file, but you might randomly select relays to request it from.\n\nDoes anything do this already? I imagine Bittorrent is similar, but probably uses a more complicated algorithm. Maybe IPFS comes close to this, but I don't think it includes the hash of the original file.\n\nCritiques welcome.\n\n---\n\nI guess you could just iterate over the entire thing blasting out nexthash very fast, then store everything that comes back to you that is unique, and then try to put it together over and over until you have everything, broadcasting what never came in.\n\nEventually the program could fail or timeout if you never get all of the parts back from the network.",
"sig": "1c65a7549877c9c421fbab495a0bf36b31533d268b31c746b5837572683237372faf0c77746d6cec132ed59aaac6f86f6bec8475a010a21f9d29c8d9e87345c2"
}