{"id":31786165,"url":"https://github.com/bitkarrot/higher","last_synced_at":"2025-10-10T12:48:32.292Z","repository":{"id":316126439,"uuid":"1061726897","full_name":"bitkarrot/higher","owner":"bitkarrot","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-22T21:04:16.000Z","size":307,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-22T21:24:16.354Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitkarrot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-22T09:54:13.000Z","updated_at":"2025-09-22T21:04:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"6f1db645-ee7d-4563-bcfe-fe31a64197a2","html_url":"https://github.com/bitkarrot/higher","commit_stats":null,"previous_names":["bitkarrot/higher"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/bitkarrot/higher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitkarrot%2Fhigher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitkarrot%2Fhigher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitkarrot%2Fhigher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitkarrot%2Fhigher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitkarrot","download_url":"https://codeload.github.com/bitkarrot/higher/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitkarrot%2Fhigher/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279003889,"owners_count":26083641,"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-10-10T02:00:06.843Z","response_time":62,"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":[],"created_at":"2025-10-10T12:48:29.833Z","updated_at":"2025-10-10T12:48:32.286Z","avatar_url":"https://github.com/bitkarrot.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"public/TeamHigher.jpg\" alt=\"Higher Relay\" align=\"right\" width=\"180\" /\u003e\n\n# Higher: Nostr Relay for Hierarchical Determinstic (HD) Keys\n\nThis relay software specializes in providing a Nostr relay with access to keys derived from a master key. Any keys which are not derived from the master key will be rejected for write events. Optional: Allow nostr.json from a domain to allow additional keys to have read/write access to the relay. This Relay is based on the khatru library framework.\n\n## Implementation of HD Keys\n\nThis relay implements Hierarchical Deterministic (HD) key authorization using BIP-32/BIP-44-style derivation. It validates incoming keys for event write/read and Blossom uploads against a configured HD master.\n\n**Key implementation files**\n- `keyderivation/hdkey.go`\n- `main.go` (authorization logic in `RejectEvent`, `RejectFilter`, and Blossom `RejectUpload`)\n\n**Master key configuration**\n- Exactly one of the following must be set in `.env` (validated in `LoadConfig()`):\n  - `RELAY_MNEMONIC` — BIP-39 mnemonic\n  - `RELAY_SEED_HEX` — hex-encoded 32-byte seed\n- The relay initializes the HD master in `initDeriver()` and keeps the deriver in a global `deriver` for access checks.\n\n**Derivation scheme**\n- Nostr BIP44 coin type `1237`, path: `m/44'/1237'/0'/0/index`\n  - `44'` — BIP44 purpose\n  - `1237'` — Nostr coin type\n  - `0'` — account 0\n  - `0` — external chain\n  - `index` — address index (non-hardened), starting at 0\n\n**Implemented in `keyderivation/hdkey.go`**\n- `NewNostrKeyDeriver(...)` — builds a deriver from mnemonic or seed\n- `DeriveKeyBIP32(index)` — derives a key pair at the path above\n- `GetMasterKeyPair()` — returns the root (master) key\n\n### See more at \n- [HD Keys Implementation](./HD_KEYS.md)\n- [Access Control Flow](./ACCESS_CONTROL.md)\n\n## Examples\n\n- Key Derivation (Nostr HD Keys): see `examples/keyderivation/` — [README](./examples/keyderivation/README.md)\n\n## Features\n\nSettings can be customized in [`.env.example`](./.env.example):\n- Specify Relay Master as Mnemonic or seed hex. Also can specify max derivation index.\n- Optional: Restrict Read to only derived keys\n- Optional: Team domain - to allow pubkeys in nostr.json\n- Blossom\n   - added read and write timeouts\n   - prevent slow header attacks, max header size\n   - max size upload\n   - added /mirror endpoint to allow for syncing content with other relays\n   - added /list endpoint to allow for listing content for a specific user\n- Relay Kinds - add support to limit kinds allowed, kinds specified in .env file\n- Frontend\n   - added front page with relay and blossom information\n\n\n## Table of Contents\n\n- [Prerequisites](#prerequisites)\n- [Setting Environment Variables](#setting-environment-variables)\n- [Compiling the Application](#compiling-the-application)\n- [Running the Application as a Service](#running-the-application-as-a-service)\n\n## Prerequisites\n\n- A Linux-based operating system\n- Go installed on your system\n- A Webserver (like nginx) if blossom is enabled\n\n## Setting Environment Variables\n\n1.  Create a `.env` file in the root directory of your project.\n\n2.  Add your environment variables to the `.env` file. For example:\n\n    ```env\n\n    RELAY_NAME=\"Higher\"\n    RELAY_PUBKEY=\"72e2d6ea.......\"\n    RELAY_DESCRIPTION=\"Nostr Relay for Hierarchical determinstic keys\"\n\n    DB_ENGINE=\"lmdb\" # lmdb, badger, postgres\n    DB_PATH=\"db/\" # only needed for lmdb, badger\n\n   ### only needed for postgres\n    POSTGRES_USER=higher\n    POSTGRES_PASSWORD=password\n    POSTGRES_DB=relay\n    POSTGRES_HOST=localhost\n    POSTGRES_PORT=5437\n\n    TEAM_DOMAIN=\"higher.bitkarrot.co\"\n    BLOSSOM_ENABLED=\"true\"\n    BLOSSOM_PATH=\"blossom/\"\n    BLOSSOM_URL=\"http://localhost:3334\"\n\n    ```\n\n## Compiling the Application\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/bitkarrot/higher.git\n   cd higher\n   ```\n\n2. Build the application:\n\n   ```bash\n   go build -o higher-relay\n   ```\n\n## Running the Application as a Service\n\n1. Create a systemd service file:\n\n   ```bash\n   sudo nano /etc/systemd/system/higher-relay.service\n   ```\n\n2. Add the following content to the service file: (update paths and usernames as needed)\n\n   ```ini\n   [Unit]\n   Description=Higher Relay\n   After=network.target\n\n   [Service]\n   ExecStart=/path/to/yourappname\n   WorkingDirectory=/path/to/higher-relay\n   EnvironmentFile=/path/to/higher-relay/.env\n   Restart=always\n   User=ubuntu\n\n   [Install]\n   WantedBy=multi-user.target\n   ```\n\n3. Reload the systemd daemon:\n\n   ```bash\n   sudo systemctl daemon-reload\n   ```\n\n4. Enable and start the service:\n\n   ```bash\n   sudo systemctl enable higher-relay\n   sudo systemctl start higher-relay\n   ```\n\n5. Check the status of the service:\n\n   ```bash\n   sudo systemctl status higher-relay\n   ```\n\n## Conclusion\n\nYour relay will be running at localhost:3334. Feel free to serve it with nginx or any other reverse proxy.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitkarrot%2Fhigher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitkarrot%2Fhigher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitkarrot%2Fhigher/lists"}