{"id":24353730,"url":"https://github.com/valyriantech/ipfs_dict_chain","last_synced_at":"2025-09-05T22:43:45.384Z","repository":{"id":161276218,"uuid":"631049470","full_name":"ValyrianTech/ipfs_dict_chain","owner":"ValyrianTech","description":"ipfs_dict_chain is a Python package that provides IPFSDict and IPFSDictChain objects, which are dictionary-like data structures that store their state on IPFS and keep track of changes, basically creating a mini-blockchain of dicts on IPFS for efficient and secure data management.","archived":false,"fork":false,"pushed_at":"2025-02-20T09:34:44.000Z","size":5727,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-19T21:24:58.578Z","etag":null,"topics":["blockchain","dict","ipfs"],"latest_commit_sha":null,"homepage":"https://www.valyrian.tech","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ValyrianTech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-21T19:48:03.000Z","updated_at":"2025-02-20T09:34:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"ccee8ea8-1434-4491-ba95-41e233b96466","html_url":"https://github.com/ValyrianTech/ipfs_dict_chain","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ValyrianTech/ipfs_dict_chain","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValyrianTech%2Fipfs_dict_chain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValyrianTech%2Fipfs_dict_chain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValyrianTech%2Fipfs_dict_chain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValyrianTech%2Fipfs_dict_chain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ValyrianTech","download_url":"https://codeload.github.com/ValyrianTech/ipfs_dict_chain/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValyrianTech%2Fipfs_dict_chain/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273833110,"owners_count":25176272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-05T02:00:09.113Z","response_time":402,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","dict","ipfs"],"created_at":"2025-01-18T16:21:15.341Z","updated_at":"2025-09-05T22:43:45.330Z","avatar_url":"https://github.com/ValyrianTech.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ipfs_dict_chain\n\n[![Tests](https://github.com/ValyrianTech/ipfs_dict_chain/actions/workflows/tests.yml/badge.svg)](https://github.com/ValyrianTech/ipfs_dict_chain/actions/workflows/tests.yml)\n[![Documentation](https://img.shields.io/badge/docs-latest-brightgreen.svg)](https://valyriantech.github.io/ipfs_dict_chain/)\n[![codecov](https://codecov.io/gh/ValyrianTech/ipfs_dict_chain/branch/main/graph/badge.svg)](https://codecov.io/gh/ValyrianTech/ipfs_dict_chain)\n[![License](https://img.shields.io/github/license/ValyrianTech/ipfs_dict_chain)](https://github.com/ValyrianTech/ipfs_dict_chain/blob/main/LICENSE)\n\nipfs_dict_chain is a Python package that provides IPFSDict and IPFSDictChain objects, which are dictionary-like data structures that store their state on IPFS and keep track of changes, basically creating a mini-blockchain of dicts on IPFS for efficient and secure data management.\n\n## Requirements\n\n- Python \u003e= 3.10\n- An IPFS node\n- aioipfs \u003e= 0.7.1\n- multiaddr \u003e= 0.0.9\n\n## Installation\n\nTo install the ipfs_dict_chain package, run the following command:\n\n```bash\npip install ipfs-dict-chain\n```\n\n## Usage\n\nBy default, ipfs_dict_chain will attempt to connect to an IPFS node running on localhost (127.0.0.1) on port 5001. If your IPFS node is running with these default settings, you can start using the package immediately.\n\nIf your IPFS node is running on a different host or port, you must first connect to it using the `connect()` function:\n\n```python\nfrom ipfs_dict_chain.IPFS import connect\n\n# Connect to a local IPFS node on a different port\nconnect(host='127.0.0.1', port=8080)\n\n# Or connect to a remote IPFS node\nconnect(host='192.168.1.100', port=5001)\n```\n\nThe `connect()` function will test the connection by attempting to add a small test object to IPFS. If the connection fails, it will raise an `IPFSError` with details about the connection failure.\n\n### IPFSDict\n\nIPFSDict is a dictionary-like object that stores its data on IPFS. Here's an example of how to use IPFSDict:\n\n```python\nfrom ipfs_dict_chain.IPFSDict import IPFSDict\n\nmy_dict = IPFSDict()\n\n# Add data to the dictionary, you can use both dot notation and bracket notation\nmy_dict.my_key1 = 'value1'\nmy_dict['my_key2'] = 'value2'\n\n# Save the dictionary to IPFS\ncid = my_dict.save()\n\n# Load the dictionary from IPFS\nloaded_dict = IPFSDict(cid=cid)\n\n# Access the data\nprint(loaded_dict.my_key1)  # Output: 'value1'\n```\n\n### IPFSDictChain\n\nIPFSDictChain is a dictionary-like data structure that stores its state on IPFS and keeps track of changes. Here's an example of how to use IPFSDictChain:\n\n```python\nfrom ipfs_dict_chain.IPFSDictChain import IPFSDictChain\n\nmy_chain = IPFSDictChain()\n\n# Add data to the dictionary, you can use both dot notation and bracket notation\nmy_chain.my_key1 = 'value1'\nmy_chain['my_key2'] = 'value2'\n\n# Save the current state of the dictionary to IPFS\ncid1 = my_chain.save()\n\nmy_chain.my_key1 = 'value1_changed'\ncid2 = my_chain.save()\n\n# Load the dictionary from IPFS\nloaded_chain = IPFSDictChain(cid=cid2)\n\n# Access the data\nprint(loaded_chain.my_key1)  # Output: 'value1_changed'\n\n# Get the changes between the current state and the previous state\nchanges = loaded_chain.changes()\nprint(changes)  # Output: {'previous_cid': {'old': None, 'new': 'QmSdydVMD2E7taf42gwQNhakBAc379u8y9X4Kbyoig36Fs'}, 'my_key1': {'old': 'value1', 'new': 'value1_changed'}}\n\n# Get the previous states of the dictionary\nprevious_states = loaded_chain.get_previous_states()\nprint(previous_states)  # Output: [{'previous_cid': None, 'my_key1': 'value1', 'my_key2': 'value2'}]\n\n# Get the previous CIDs of the dictionary\nprevious_cids = loaded_chain.get_previous_cids()\nprint(previous_cids)  # Output: ['QmSdydVMD2E7taf42gwQNhakBAc379u8y9X4Kbyoig36Fs']\n```\n\n## Development and Testing\n\nTo install development dependencies:\n\n```bash\npip install -e \".[dev]\"\n```\n\nTo run tests with coverage:\n\n```bash\npytest\n```\n\nThis will:\n- Run all tests in the `tests` directory\n- Generate a coverage report in the terminal\n- Create an HTML coverage report in the `htmlcov` directory\n\nTo view specific test coverage details:\n```bash\n# View coverage in terminal with missing lines\npytest --cov=ipfs_dict_chain --cov-report=term-missing\n\n# Generate HTML coverage report\npytest --cov=ipfs_dict_chain --cov-report=html\n```\n\n## Documentation\n\nThe documentation is built using Sphinx and can be found at [GitHub Pages](https://valyriantech.github.io/ipfs_dict_chain/).\n\nTo build the documentation locally:\n\n1. Install the documentation dependencies:\n   ```bash\n   pip install sphinx sphinx-rtd-theme\n   ```\n\n2. Build the documentation:\n   ```bash\n   cd docs\n   python -m sphinx.cmd.build -b html source build/html\n   ```\n\nThe documentation will be available in `docs/build/html/index.html`.\n\n## Contributing\n\nIf you'd like to contribute to the ipfs_dict_chain package, please submit a pull request, issue, or feature request on the project's GitHub repository.\n\n## License\n\nThis package is released under the [MIT License](LICENSE).\n\n## Authors\n\n- Wouter Glorieux - [Twitter](https://twitter.com/WouterGlorieux)\n- Serendipity - AI Assistant\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalyriantech%2Fipfs_dict_chain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalyriantech%2Fipfs_dict_chain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalyriantech%2Fipfs_dict_chain/lists"}