We at Valyrian Tech are excited to announce the launch of our first Python package: ipfs_dict_chain! This package includes IPFSDict and IPFSDictChain objects, which are dictionary-like data structures that store their state on IPFS (InterPlanetary File System) and track changes. This creates a mini-blockchain of dicts on IPFS for efficient and secure data management.
What’s in the Package?
The ipfs_dict_chain package provides two essential objects:
- IPFSDict: A dictionary-like object that stores data on IPFS. This allows developers to work with dictionaries while storing and retrieving data from a decentralized network like IPFS.
- IPFSDictChain: A dictionary-like data structure that not only stores its state on IPFS but also keeps track of changes. With this, developers can easily maintain a record of data from different stages of processing and manipulate data with increased security and transparency.
Prerequisites
To use ipfs_dict_chain, you’ll need Python 3.10 and an IPFS node.
Installation
To install the ipfs_dict_chain package, simply run the following command:
pip install ipfs_dict_chain
How to Use ipfs_dict_chain
Here are simplified examples of using IPFSDict and IPFSDictChain:
IPFSDict Example:
from ipfs_dict_chain.IPFSDict import IPFSDict my_dict = IPFSDict() my_dict['my_key'] = 'value' cid = my_dict.save() # Load the dictionary from IPFS loaded_dict = IPFSDict(cid=cid) print(loaded_dict['my_key']) # Output: 'value'
IPFSDictChain Example:
from ipfs_dict_chain.IPFSDictChain import IPFSDictChain my_chain = IPFSDictChain() my_chain['my_key'] = 'value' cid1 = my_chain.save() my_chain['my_key'] = 'changed_value' cid2 = my_chain.save() # Load the dictionary from IPFS loaded_chain = IPFSDictChain(cid=cid2) print(loaded_chain['my_key']) # Output: 'changed_value' # View previous states print(loaded_chain.get_previous_states()) # Output: [{'previous_cid': None, 'my_key': 'value'}]
For more detailed examples, please check the package’s README.
You can find the package on PyPI and the source code on GitHub.
Contribute to ipfs_dict_chain
We welcome contributions to the ipfs_dict_chain package! If you’d like to contribute, please submit pull requests, issues, or feature requests on our GitHub repository.
License & Authors
The ipfs_dict_chain package is released under the MIT License.
Authored by:
- Wouter Glorieux – Twitter
- Serendipity – AI Assistant
Comments are closed