Osmo Labs · Computer science · Ages 8 to 14

How Does Decentralized Storage Work? The Bytecar Lab

What if the millions of cars parked around a city could store our photos and files? Split a file into pieces, spread it across cars, then watch cars drive away and find out whether you can still rebuild it.

How does decentralized storage work? Instead of one big computer holding your file, the file is cut into pieces and spread across many machines. In this lab the machines are parked cars, an idea from the Gravitybrain STEM Program called Bytecar. Split a file, send cars driving away, and test whether you can still rebuild it.

How to use it: choose copies or erasure coding, then drag the "Cars offline" slider. Tap any car, or press Peek inside a car, to see what it is holding.

Decentralized storage explained

The Bytecar idea

Cars sit still most of the day. Researchers have worked this out several ways: the parking expert Donald Shoup estimated cars are parked about 95% of the time in the US, and a calculation using the UK's RAC Foundation figures gives about 96.5% (Streetsblog). Modern cars also carry computers. Bytecar asks a founder-style question: could all those parked cars lend a little storage space to the city, like a giant shared hard drive on wheels?

Step 1: split the file into pieces

Real systems already do this. IPFS, a real peer-to-peer network, chunks data into blocks and gives each one an ID made from its content, called a CID, so anyone can check a block has not been changed. Hadoop, used by big companies to store huge datasets, splits files into blocks of typically 128 MB. In the lab you choose 2 to 6 pieces, labelled A, B, C and so on.

Step 2: add redundancy

If each piece lives on only one car and that car drives away, your file is broken. So storage systems add redundancy, meaning extra data that lets you survive losses. There are two main ways.

  • Replication (copies). Store each piece on several cars. Hadoop's design describes a replication factor of three as the common case, placing copies on different racks so that even a whole rack failing does not lose data. With copies, you need at least one copy of every piece.
  • Erasure coding (parity pieces). Add a few extra pieces made with maths, so that any k of the pieces rebuild the file. Backblaze, a cloud storage company, cuts each file into 17 pieces plus 3 parity pieces and can rebuild it from any 17 of the 20. Storj, a decentralized storage network, uses erasure coding instead of replication, and its docs explain that for similar safety it uses much less disk space than lots of copies.

Step 3: availability, the maths of "can I get it now?"

If each car is away with chance p (the slider), then with replication a single piece is lost only if all r copies are away: chance pr. The whole file is readable with chance (1 − pr)k. For erasure coding, the lab adds up the chances that at least k of the n pieces are online (a binomial probability). That is the "Chance readable" number. The "Can you rebuild it?" readout is what is happening in your city right now, which can be lucky or unlucky.

Step 4: speed and storage overhead

Your phone downloads the pieces from different cars at the same time, so a file split into 4 pieces comes down about 4 times faster than from one car. The price is storage: 3 copies use 3× the space, while 4 data plus 2 parity pieces use only 1.5×.

Step 5: privacy with encryption

Would you want a stranger's car to hold your diary? Storj's docs describe client-side encryption: the data is scrambled on your own device before it leaves, and the key never goes to the storage provider, so the people storing pieces cannot read them. Untick "Encrypt pieces" in the lab and peek inside a car to see why this matters.

Try this: three experiments

  1. Only one copy. Four pieces, one copy each, 20% of cars away. The chance of reading the file is only about 41%, because all four cars must be home. Press Shuffle the city a few times. Then raise the copies to 2 and 3. How fast does the chance climb?
  2. Rush hour. Now 60% of cars are away, with 3 copies of each piece. The chance falls to about 38%. Raise the replication factor to the maximum of 5: even then it only reaches about 72%, while using 5× the storage. Copies alone struggle when most cars are gone. What else could you change?
  3. Erasure coding. Four data pieces and four parity pieces, with 40% of cars away, give about an 83% chance using 2× the storage. Switch to copies with a replication factor of 2, which also uses 2×: the chance drops to about 50%. Same space, very different safety. This is why big storage companies love erasure coding.

The honest trade-offs

Good engineers look for the problems in their own ideas. Bytecar is a concept, not a real product, and it would face real challenges:

  • Cars leave together. The lab assumes each car is away at random. In real life, thousands leave at rush hour, so availability could drop all at once. Spreading pieces across neighbourhoods with different schedules could help, like Hadoop spreading copies across racks.
  • Battery. A parked car's electronics run from its battery. Serving data all day could drain it, so cars might only help while plugged in or for short periods.
  • Bandwidth and cost. Cars need a mobile or Wi-Fi connection to send data, and someone has to pay for that data.
  • Repairs. If a car is sold or scrapped, its pieces are gone for good, so the network must notice and rebuild them on new cars. IPFS's docs make a similar point: data only stays available while nodes keep it.
  • Trust. Owners must agree to take part, and users must trust that encryption is done properly.

Founder challenge

The real-world problem: the world makes more photos, videos and data every year, and storing it takes big data centres that use land and electricity. Meanwhile, millions of cars, phones and computers sit idle with spare space.

  1. Notice: in the lab, find the cheapest setting (lowest storage used) that still gives a 99% chance of reading the file with 30% of cars away.
  2. Imagine: which idle devices near you could share storage? Parked cars, school computers at night, set-top boxes? What would make owners say yes?
  3. Build and test with the sim: try your best setting at rush hour (60% away). Does it survive? What would you change?
  4. Pitch your fix in 3 sentences: who has the problem, what your idea does, and why it is better than what exists now.

For parents and teachers

Ages: Children aged 8 to 10 can play the presets and explain why more copies make a file safer. Ages 11 to 14 can check the "Chance readable" numbers by hand with (1 − pr)k, which links computing to probability (Classes 6 to 9 in India, Grades 6 to 9 in the US). It is a friendly way into distributed storage for kids and into how cloud storage works for kids, without any accounts or downloads.

Classroom ideas:

  • Play it unplugged: cut a short message into four cards, make copies, hand them to classmates, then send some "cars" out of the room. Can the class rebuild the message?
  • Discuss privacy: why does encryption matter if strangers hold your data? Who should keep the key?
  • Debate the trade-offs above and ask students to redesign Bytecar to fix one of them.
  • Pair this lab with the solar panel output calculator to talk about the energy that data storage needs.

Children who enjoy this can explore the Technology and Cybersecurity planets in the Osmo app, where real technology news is rewritten at three reading levels. See all ten Osmo planets, try our free science worksheets, or read how to teach kids entrepreneurship.

Frequently asked questions

How does decentralized storage work, explained simply?

Instead of keeping your file on one company's computer, decentralized storage cuts it into pieces and spreads them over many independent computers, often owned by different people. Extra copies or extra parity pieces are added so the file survives when some computers are switched off. The pieces are usually encrypted first, so the people storing them cannot read them. To open the file, your device fetches enough pieces and joins them back together.

How does cloud storage work, for kids?

When you save a photo to the cloud, it travels over the internet to big buildings full of computers called data centres. The company saves it on several hard drives, often in different places, so one broken drive does not lose your photo. When you open it again, your device asks for it back. Decentralized storage is similar, but the computers belong to lots of different people instead of one company.

What is a distributed system?

A distributed system is a group of computers that work together over a network so they look like one system to the person using it. Search engines, online games, cloud storage and video streaming all run on distributed systems. The hard part is that some computers are always failing or offline, so the system has to keep working anyway, which is exactly what the Bytecar lab lets you test.

What is the difference between replication and erasure coding?

Replication stores whole extra copies, so three copies use three times the space. Erasure coding adds a few clever parity pieces: with 17 data pieces and 3 parity pieces, as Backblaze uses, any 17 of the 20 rebuild the file, and it uses only about 1.18 times the space. Erasure coding saves space, but rebuilding needs some maths and more pieces at once.

Is Bytecar a real product?

No. Bytecar is a project idea from the Gravitybrain STEM Program for students to explore: using spare storage in parked cars as a city-wide storage network. Real decentralized storage networks such as IPFS and Storj do exist, but they run on computers, not cars. The lab is a thinking tool for testing whether the idea could work and what problems it would face.

Sources

  1. Streetsblog USA: It's true, the typical car is parked 95 percent of the time (Shoup, RAC Foundation and Reinventing Parking methods)
  2. IPFS Docs: How IPFS works (blocks, CIDs and the DHT)
  3. IPFS Docs: Persistence, permanence and pinning
  4. Backblaze: Backblaze Open-sources Reed-Solomon Erasure Coding Source Code
  5. Storj Docs: File redundancy (erasure coding versus replication)
  6. Storj Docs: Understanding decentralized cloud storage (client-side encryption)
  7. Apache Hadoop: HDFS Architecture (block replication)

Built by the Osmo team from Gravitybrain STEM Program project ideas. Simulations are simplified models for learning, not engineering tools. Spotted an error? Tell us.

Osmo · STEM news for kidsTry free