{"id":13524069,"url":"https://github.com/ninegua/ic-blackhole","last_synced_at":"2025-05-13T20:30:45.119Z","repository":{"id":45769255,"uuid":"383687083","full_name":"ninegua/ic-blackhole","owner":"ninegua","description":"Once a canister sets its only controller to a black hole, it becomes immutable and more!","archived":false,"fork":false,"pushed_at":"2025-01-05T11:48:16.000Z","size":18,"stargazers_count":50,"open_issues_count":1,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T07:35:09.780Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Nix","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/ninegua.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}},"created_at":"2021-07-07T05:46:42.000Z","updated_at":"2025-03-21T05:45:06.000Z","dependencies_parsed_at":"2024-01-07T18:04:57.726Z","dependency_job_id":"3104d77c-d951-4def-8353-05fd27ad6575","html_url":"https://github.com/ninegua/ic-blackhole","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ninegua%2Fic-blackhole","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ninegua%2Fic-blackhole/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ninegua%2Fic-blackhole/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ninegua%2Fic-blackhole/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ninegua","download_url":"https://codeload.github.com/ninegua/ic-blackhole/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254020902,"owners_count":22000805,"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-01T06:01:06.698Z","updated_at":"2025-05-13T20:30:44.830Z","avatar_url":"https://github.com/ninegua.png","language":"Nix","funding_links":[],"categories":["Developer Tooling","Nix","Applications"],"sub_categories":["Monitoring","Canister tools"],"readme":"# Black hole Canister on the Internet Computer\n\n*A black hole is a region in space with a gravitational pull so strong that nothing, not even light, can escape through it.*\n\nOnce a canister sets its only controller to a black hole, it becomes immutable and more!\n\n## How to verify it is a black hole\n\nFirst, we can read the source code in [src/blackhole.mo](https://github.com/ninegua/ic-blackhole/blob/main/src/blackhole.mo).\nIt is about 30 lines, so should be easy to convince ourselves it is not doing anything fishy.\n\nNext, we need to make sure what is deployed on Internet Computer is compiled from this source code.\nTo do this, we can verify hash of Wasm binary from three sources: built by github, built locally, and what is deployed.\n\n```\n$ curl -Ls https://github.com/ninegua/ic-blackhole/releases/download/0.0.0/blackhole-opt.wasm|sha256sum\n210cf941e5ca77daac314a91517483ac171264527e3d0d713b92bb95239d7de0  -\n\n$ cat $(nix-build 2\u003e/dev/null)/bin/blackhole-opt.wasm |sha256sum\n210cf941e5ca77daac314a91517483ac171264527e3d0d713b92bb95239d7de0  -\n\n$ make dfx.json \u0026\u0026 dfx canister --network=ic --no-wallet info $(cat canister_ids.json|jq -r '.blackhole.ic')\nmake: 'dfx.json' is up to date.\nController: e3mmv-5qaaa-aaaah-aadma-cai\nModule hash: 0x210cf941e5ca77daac314a91517483ac171264527e3d0d713b92bb95239d7de0\n```\n\n## Versions\n\nWe may introduce more functionalities with each new version, and once deployed it becomes a new black hole.\n*Of course there are more than one black holes!*\n\n### Version 0.0.0\n\nBlack hole Canister ID: [`e3mmv-5qaaa-aaaah-aadma-cai`](https://ic.rocks/principal/e3mmv-5qaaa-aaaah-aadma-cai)\n\nThis version gives one interface `canister_status` that is identical to the IC management canister.\n\n```\nservice : {\n  canister_status: (record {canister_id: canister_id;}) -\u003e (canister_status);\n}\n```\n\nCanisters that make the black hole their controllers will make their canister status public.\nAnyone, including other canisters, can just call the black hole to find out the canister's status that otherwise remains hidden.\nInformation such as remaining cycles, module hash, etc. are now publicly and programmatically accessible, if the given canister has added the black hole as one of its controllers.\n\nWhy is it safe? Because the black hole canister itself is immutable, and cannot do anything to the canister it controls except revealing its status.\n\nSetting a black hole as the *sole* controller of a canister will make it *non-upgradable*.\nOne can still top-up its cycles via the ledger, but no one can change its code or behavior.\nBy the way, this is how the black hole will maintain its cycles balance, possibly through donations.\n\n*Making canister status public also implies that anyone can query the remaining cycle balance of your black holed canister.*\nThis exposure means one can easily figure out how much cycle your canister consumes per day or even per method call.\nAttackers may leverage such information and launch a targeted attack to drain your cycles.\nMake sure you understand the consequence and have counter measures in place (e.g. use automatic cycle top-up service such as [Tip Jar]).\n\n## How to give your canister to a black hole\n\n**WARNING: Be cautious with the steps. You might lose control to your canisters forever!**\n\nPick one of the black hole canister IDs published above, and run the following command (`e3mmv-5qaaa-aaaah-aadma-cai` aka version 0.0.0 is used here):\n\n```\ndfx canister --network=ic update-settings \\\n    --add-controller e3mmv-5qaaa-aaaah-aadma-cai \\\n    [CANISTER_ID]\n```\nYou will need at least dfx version 0.9.2 to be able to add a controller as shown above.\n\nThe above command makes the specified black hole a controller of your canister, but does not remove your access.\n\nTo set a black hole as your canister's **only** controller, run the above command with the following modification.  Again, this will **remove your ability to control your canister!**\n- dfx \u003e= 0.12.0: replace `--add-controller` with `--set-controller`\n- dfx 0.8.4 to 0.11.2: replace `--add-controller` with `--controller`\n\n[dfx]: https://sdk.dfinity.org/docs/developers-guide/install-upgrade-remove\n[ic-utils]: https://github.com/ninegua/ic-utils\n[Tip Jar]: https://tipjar.rocks\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fninegua%2Fic-blackhole","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fninegua%2Fic-blackhole","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fninegua%2Fic-blackhole/lists"}