{"id":13677494,"url":"https://github.com/bregydoc/blackholeDB","last_synced_at":"2025-04-29T11:31:01.345Z","repository":{"id":57496614,"uuid":"161022282","full_name":"bregydoc/blackholeDB","owner":"bregydoc","description":"BlackholeDB is a simple distributed key-value DB based on IPFS protocol.","archived":false,"fork":false,"pushed_at":"2019-07-31T17:36:48.000Z","size":172,"stargazers_count":124,"open_issues_count":2,"forks_count":1,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-11-11T19:41:09.347Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","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/bregydoc.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}},"created_at":"2018-12-09T09:05:09.000Z","updated_at":"2024-04-17T09:07:44.000Z","dependencies_parsed_at":"2022-09-02T04:25:13.492Z","dependency_job_id":null,"html_url":"https://github.com/bregydoc/blackholeDB","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bregydoc%2FblackholeDB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bregydoc%2FblackholeDB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bregydoc%2FblackholeDB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bregydoc%2FblackholeDB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bregydoc","download_url":"https://codeload.github.com/bregydoc/blackholeDB/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251493749,"owners_count":21598161,"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","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":[],"created_at":"2024-08-02T13:00:43.033Z","updated_at":"2025-04-29T11:31:01.037Z","avatar_url":"https://github.com/bregydoc.png","language":"Go","funding_links":[],"categories":["Blockchain"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"logo.png\" width=\"70%\" height=\"auto\"/\u003e\n\u003c/p\u003e\n\n# Black Hole DB (WIP)\n\nBlackHoleDB (or only HoleDB) is a conceptual Key-Value distributed Database.\nHoleDB uses [IPFS](https://ipfs.io) as decentralized filesystem,\nand [BadgerDB](https://github.com/dgraph-io/badger) as store for local key value pairs.\n\n**Warning:** BlackHole is work in progress, please don't use it in production.\n\n## How it Works\n\nBlackHoleDB creates an encrypted file into IPFS filesystem and this return an Qm name (the decentralized path),\nthis Qm path is saved into BadgerDB instance as value where the key is the initial key choose. When you want get your\nvalue from the distributed web BlackHoleDB get the Qm linked your key (from BadgerDB) and with this Qm path HoleDB gets\nthe encrypted file from IPFS and finally it decrypted it.\n\nExample code:\n\n```go\noptions := blackhole.DefaultOptions\ndb, err := blackhole.Open(options)\nif err != nil {\n\tpanic(err)\n}\n\nkey := \"answer\"\n\nerr = db.Set(key, []byte(\"Hello World, from BlackHoleDB\"))\nif err != nil {\n\tpanic(err)\n}\n\ndata, err := db.Get(key)\nif err != nil {\n\tpanic(err)\n}\n\nfmt.Println(\"Answer: \", string(data))\n// Answer: Hello World, from BlackHoleDB\n\n```\n\n## About Options Configuration\n\nYou can configure the params of your blackhole instance,\nyou can see the struct related above.\n\n```go\ntype Options struct {\n\tPrivateKey         []byte // Your encoding key\n\tEndPointConnection string // Your IPFS Node endpoint\n\tPrincipalNode      string // Useless now (WIP)\n\n\tLocalDBDir      string // Your Local Badger DB\n\tLocalDBValueDir string // Your Local Badger DB\n}\n```\n\nThe default configuration is:\n\n```go\nvar DefaultOptions *Options = \u0026Options{\n\tLocalDBDir:         \"/tmp/badger\",\n\tLocalDBValueDir:    \"/tmp/badger\",\n\tEndPointConnection: \"localhost:5001\",\n}\n// Note: You need to define your privateKey like this:\n// opts.PrivateKey, _ = hex.DecodeString(\"44667768254d593b7ea48c3327c18a651f6031554ca4f5e3e641f6ff1ea72e98\")\n```\n\n## Basic Usage Example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/bregydoc/blackholeDB\"\n)\n\nfunc main() {\n\tdb, err := blackhole.Open(blackhole.DefaultOptions)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdefer db.Close()\n\n\terr = db.Set(\"answer\", []byte(\"42\"))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tanswer, err := db.Get(\"answer\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(\"The answer of the life is: \", string(answer))\n\t// The answer of the life is:  42\n}\n```\n\n## TODO\n\n- [ ] Improve the security\n- [ ] Make Blackhole a metaDB. Save all param configurations on Distributed web (IPFS)\n- [ ] Use [MsgPack](https://msgpack.org/index.html) to serialize the data\n- [ ] Create an ORM layer to save complex structs\n\n## Contributing to BlackHoleDB\n\nBlackHoleDB is an open source project and contributors are welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbregydoc%2FblackholeDB","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbregydoc%2FblackholeDB","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbregydoc%2FblackholeDB/lists"}