Introducing R1FS. Unleashing Decentralized Data-Sharing.
Education
What if you could seamlessly store, discover, and retrieve data in a fully decentralized manner - without complex configurations or third-party dependencies? Meet R1fsDemoPlugin, a compact yet powerful demonstration of how Ratio1’s private IPFS-based file system (R1FS) and ChainStore (aka CSTORE) collaborate to make peer-to-peer data sharing a breeze.
WARNING: Geeky-nerdy content inside 🤯
TL;DR: we have a few workers (participants) that have to “allow” each other otherwise they will not have access to the shared in-memory decentralized database (aka ChainStore). Each time a node creates a R1FS in our demo it will announce it via a hash set (in memory and decentralized) so that the other nodes are aware that someone shared something (R1FS creates the file, generates the content unique identifier but this CID has to arrive in other workers apps via CSTORE)
Then repeat 😄
Why does this matter?
So, here are some concrete applications of our Ratio1 R1FS:
Decentralized federated training for custom or foundation models
Multiple nodes can securely exchange partial model weights or aggregated learning statistics via R1FS, ensuring each node’s raw data remains private. This opens doors for collaborative machine learning projects across different organizations or domains without compromising individual data sovereignty.
Data analytics with distributed federated processing
Rather than consolidating massive datasets in a single location, each node can store and process its local data partition, advertising the results or intermediate analytics through ChainStorage. This approach drastically reduces data transfer overhead and allows real-time, large-scale computations across a network of peers.
Community-driven EDS: Allow multiple researchers or analysts to concurrently publish their local findings (e.g., aggregated summaries or visualizations) to R1FS. Everyone benefits from insights without needing direct, bulk data transfers, boosting collaborative insights in crowdsourced analytics.
Multi-institution collaboration: Different labs or companies (even cross-disciplinary) can securely share configurations, data subsets, or progress updates. The R1FS + ChainStorage duo helps maintain a mutualized view of ongoing work, while each participant retains full control of their proprietary information.
Collaborative data collection
Deploy on multiple IoT devices or analytics nodes - each sending local stats into R1FS and announcing them. Every node sees everyone else’s data in near real-time.
Decentralized document exchange
Need to exchange large files or critical documents? Store them in R1FS and have your network retrieve them directly from whichever node has them - no single point of failure.
Cross-node configuration
Share configuration or state files across distributed systems. One node’s update automatically becomes available to all others, ensuring frictionless synchronization.
What Is the R1fsDemoPlugin?
The R1fsDemoPlugin is a demonstration plugin designed to:
Generate random data and store it in R1FS, Ratio1's private, IPFS-like storage system.
Publish the resulting CID (Content Identifier) of that data to the Ratio1 ChainStore (hash-set), allowing all participating peers to discover it.
Periodically watch for new CIDs published by other peers, retrieve the corresponding files, and process them (in our example, a simple YAML dump).
In short, it’s a straightforward illustration of how to broadcast data - be it YAML-based or any other type of file - to a distributed network where everyone can find and download it. Whether you’re spinning up one node or an entire swarm, R1fsDemoPlugin ensures that all participants can both announce and consume each other’s shared data in near real-time.
1. Storing Data in R1FS
When you want to share data:
Randomized Info: The plugin generates a UUID plus a random integer.
Serialization: That info is serialized to YAML.
Commit to R1FS: Using r1fs.add_yaml(), it’s stored in R1FS - instantly returning a CID to reference the newly added content.
cid = self.r1fs.add_yaml(data)
Note: R1FS supports various formats and methods ranging from basic add_file(), get_file() to add_json(), add_pickle(), etc. For the demo, we’re using YAML for clarity, but the concept is identical for other data formats.
2. Announcing via ChainStorage
Once a piece of data is safely tucked away in R1FS, its CID is announced to the network:
hkey='r1fs-demo' functions like a namespace for the key-value store (just like a hash set).
key=self.my_id is the plugin’s unique identifier (we often use the node alias or instance ID).
value=cid is the pointer to the actual data stored in R1FS.
Now, any peer can run chainstore_hgetall('r1fs-demo') to fetch all announced CIDs, including the one just published.
3. Discovering & Downloading Remote CIDs
Periodically, the plugin checks for CIDs announced by others via dct_data = self.chainstore_hgetall('r1fs-demo')
It then filters out its own announcements (to avoid re-fetching the data it just created) and retrieves the files using fn = self.r1fs.get_file(cid)
If the file is YAML, the plugin dumps the content to the logs (or does something more interesting in a real-world scenario). R1FS handles the underlying peer-to-peer content exchange, ensuring the file is fetched from whichever node advertises it.
The Main process() Loop
Every 30 seconds (or however it’s configured), the process() method is called. It does two critical things:
share_local_data(): Checks if it’s been an hour since the last data share. If so, it creates new random data, stores it in R1FS, and publishes the CID via the ChainStore.
show_remote_shared_data():Looks up new CIDs published by other peers, retrieves them, and logs the data for visibility.
This ensures that every node in the system gently trickles out new data and picks up fresh content from others, making the entire network’s data flow both fluid and robust.
Putting It All Together
Below is an example pipeline (think of it as a Ratio1 “app”) that directs each node to run this plugin. With just one step - launch the pipeline on at least two nodes - you’re already set to see data seamlessly shared across nodes.
Simply load this pipeline on any two (or more!) Ratio1 nodes to start the R1fsDemoPlugin on each. Once running, the plugin will take care of storing random data, announcing the CID, and discovering what others share. You can also programmatically launch a pipeline using Python code.
Note: Always make sure your SDK is paired with your node
After updating your SDK via
Just run a simple configuration checking using
And you will receive something like

Then you just copy the 0xai internal address and give it to your node via the container add_allowed command:
Where certainly the 0xai_xxxxxxxxxxxxxxxxxxxxxxxxxx is the address copied from your r1ctl config show client command. As we result you should obtain something similar with this output below where you can clearly see in the allowed addresses whitelist your client address. If this command fails then it means your node is not running or it is running under other docker container name than r1node (only if you make custom special installs)

Note: running the docker exec r1node add_allowed or the docker exec r1node get_node_info commands will show a list of several (quite a few actually) nodes that are allowed on your node by default - these are the oracles that supervise your node and make sure you get your Proof-of-Availability rewards as well as your Proof-of-AI rewards for the specific jobs you receive.
For this tutorial, make sure you have allowed the SDK and the Edge Nodes to communicate. Follow the allowance scheme below.

After a short wait, you’ll see the plugin logs start streaming details about new data being stored and discovered. It’s a trivial example that packs a big punch in demonstrating decentralized workflows.
Conclusion
The R1fsDemoPlugin perfectly showcases how R1FS and ChainStorage can unify to create a frictionless, fully decentralized data-sharing environment. Whether you’re dealing with simple YAML blobs or entire directories, the principle remains the same:
Store your content in a swarm-based file system.
Broadcast its location in a distributed key-value store.
Synchronize among peers - everyone picks up what they need, when they need it.
Give it a spin, watch the logs, and see how elegantly your nodes learn about and acquire each other’s data. As you gain confidence, you’ll find it easy to layer more complex features like tokens, advanced access rules, or concurrency on top of the same basic approach.
Ready to try it yourself? Load the plugin, tweak the data-sharing interval, or store custom data - then sit back and let R1FS and ChainStorage do their magic.
Full R1FS Demo Plugin Code
Below is the complete code for the R1fsDemoPlugin. Feel free to copy and adapt it in your Ratio1 deployment. n
Note: Please be aware that this plugin code is already bundled within the Ratio1 Edge Nodes as a “template” plugin so you do not need to execute, try or do anything with it. The plugin itself cannot and will not run outside the Edge Node ecosystem/environment.
That’s it! The R1fsDemoPlugin provides a neat, self-contained example of the decentralized power offered by Ratio1’s ecosystem. Happy experimenting - and welcome to the future of peer-to-peer data sharing.

Andrei Ionut Damian
Feb 21, 2025