{"id":48320934,"url":"https://github.com/effectstream/dust-registration-cli","last_synced_at":"2026-04-05T00:40:04.669Z","repository":{"id":346933991,"uuid":"1192210919","full_name":"effectstream/dust-registration-cli","owner":"effectstream","description":null,"archived":false,"fork":false,"pushed_at":"2026-03-26T18:36:43.000Z","size":128,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-26T23:52:06.054Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/effectstream.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":"2026-03-26T01:58:56.000Z","updated_at":"2026-03-26T18:36:45.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/effectstream/dust-registration-cli","commit_stats":null,"previous_names":["effectstream/dust-registration-cli"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/effectstream/dust-registration-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effectstream%2Fdust-registration-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effectstream%2Fdust-registration-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effectstream%2Fdust-registration-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effectstream%2Fdust-registration-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/effectstream","download_url":"https://codeload.github.com/effectstream/dust-registration-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effectstream%2Fdust-registration-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31420565,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T00:25:07.052Z","status":"ssl_error","status_checked_at":"2026-04-05T00:25:05.923Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2026-04-05T00:40:03.846Z","updated_at":"2026-04-05T00:40:04.623Z","avatar_url":"https://github.com/effectstream.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DUST Registration CLI\n\nCLI tool to register a Midnight DUST address from a Cardano wallet.\n\n## Prerequisites\n\n- Node.js v24+\n- A Blockfrost API key ([blockfrost.io](https://blockfrost.io))\n\n## Setup\n\n```bash\ncd cli\nnpm install\n```\n\n## Environment Variables\n\n\n| Variable             | Required | Description                                         |\n| -------------------- | -------- | --------------------------------------------------- |\n| `NETWORK`            | Yes      | Cardano network: `Preview`, `Preprod`, or `Mainnet` |\n| `BLOCKFROST_API_KEY` | Yes      | Blockfrost project ID for the selected network      |\n\n\nCreate a `.env` file or export directly:\n\n```bash\nexport NETWORK=Preview\nexport BLOCKFROST_API_KEY=previewXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n```\n\n## Commands\n\n### Create a new Cardano wallet\n\n```bash\nnode src/index.ts create-cardano-wallet --name my-wallet\n```\n\nGenerates a 24-word mnemonic and derives the wallet address.\n\n### Import an existing Cardano wallet\n\n```bash\nnode src/index.ts import-cardano-wallet --name my-wallet --mnemonic \"word1 word2 ... word24\"\n```\n\n### Create a Midnight wallet\n\n```bash\nnode src/index.ts create-midnight-wallet --name my-midnight\n```\n\nGenerates a random seed and derives the DUST address.\n\n### List wallets\n\n```bash\n# List all wallets\nnode src/index.ts list-wallets\n\n# Show first 10 CIP-1852 payment addresses for a specific wallet\nnode src/index.ts list-wallets --cardano-wallet my-wallet --n 10\n\n# Show staking addresses instead\nnode src/index.ts list-wallets --cardano-wallet my-wallet --n 10 --stake\n```\n\n`--n` controls how many account indices to derive (default: 10).\n\n### Find UTxOs\n\n```bash\n# Single account (default: account 0)\nnode src/index.ts find-utxos --wallet my-wallet\n\n# Query first 3 accounts with per-account breakdown\nnode src/index.ts find-utxos --wallet my-wallet --n 3\n```\n\nQueries Blockfrost for UTxOs including cNIGHT tokens. With `--n`, shows balances per account and a grand total.\n\n### Build registration transaction\n\n```bash\n# Using a stored Midnight wallet\nnode src/index.ts build-tx --cardano-wallet my-wallet --midnight-wallet my-midnight --account 0\n\n# Using a DUST address directly\nnode src/index.ts build-tx --cardano-wallet my-wallet --dust-address dust1abc123... --account 0\n```\n\nBuilds an unsigned transaction that mints a DUST NFT and creates the registration datum on-chain. `--account` selects the CIP-1852 account index, which determines the payment address and stake key used.\n\nThe DUST address can be provided in two ways (mutually exclusive):\n- `--midnight-wallet \u003cname\u003e` — loads the DUST address from a stored Midnight wallet\n- `--dust-address \u003caddress\u003e` — accepts a bech32m `dust1...` address directly\n\n### Sign transaction\n\n```bash\nnode src/index.ts sign-tx --wallet my-wallet --tx-file ~/.dust-cli/temp/unsigned-tx-xxx.json --account 0\n```\n\nThe `--account` must match the account used during `build-tx`. A mismatch is rejected with an error.\n\n### Submit transaction\n\n```bash\nnode src/index.ts submit-tx --tx-file ~/.dust-cli/temp/signed-tx-xxx.json --account 0 --poll\n```\n\nThe `--account` must match the account used during `build-tx`/`sign-tx`. The `--poll` flag waits for on-chain confirmation.\n\n### Check registration status\n\n```bash\nnode src/index.ts check-registration --wallet my-wallet --account 0\n```\n\nQueries the Midnight indexer for the DUST registration status of the staking address derived from the given account. Shows registration state, DUST address, NIGHT balance, generation rate, and current capacity.\n\n## Wallet Storage\n\nWallet files are stored in `~/.dust-cli/`:\n\n```\n~/.dust-cli/\n  cardano-wallets/   # Cardano wallet JSON files (contain mnemonics)\n  midnight-wallets/  # Midnight wallet JSON files (contain seeds)\n  temp/              # Unsigned/signed transaction files\n```\n\n\n## Build transaction\n\n#### Transaction structure\n\nThe CLI builds the exact same transaction as the dApp's `buildRegistrationTransaction` in `src/lib/dustTransactionsUtils.ts`, using Lucid Evolution:\n\n1. **Inputs** — all cNIGHT UTxOs from the wallet are collected as explicit inputs (token rotation)\n2. **Mint** — 1 DUST NFT minted via the `cnight_generates_dust` PlutusV3 minting policy with a `Create` redeemer (constructor 0)\n3. **Output** — sent to the validator address with an inline `DustMappingDatum` containing:\n  - `c_wallet`: `VerificationKey([stakeKeyHash])` — the wallet's stake key hash (28 bytes)\n  - `dust_address`: the Midnight DUST address bytes (SCALE-encoded BLS scalar, 33 bytes)\n4. **Required signers** — both the payment address and the stake/reward address\n5. **Output value** — 1,586,080 lovelace + 1 DUST NFT\n\n#### Contract data (hardcoded, extracted from dApp)\n\n\n| Item                        | Source                                                                                                       |\n| --------------------------- | ------------------------------------------------------------------------------------------------------------ |\n| Script CBOR (PlutusV3)      | `src/config/contract_blueprint.ts` — identical bytecode for testnet and mainnet                              |\n| `DustMappingDatum` type     | `{ c_wallet: VerificationKey([stakeKeyHash]) | Script([scriptHash]), dust_address: string }` (constructor 0) |\n| `DustAction` redeemer       | `Create` (constructor 0) / `Burn` (constructor 1)                                                            |\n| Policy ID                   | Hash of the PlutusV3 script                                                                                  |\n| Validator address           | Derived from the script via `addressFromValidator`                                                           |\n| `LOVELACE_FOR_REGISTRATION` | 1,586,080 lovelace                                                                                           |\n\n\n#### cNIGHT token identifiers per network\n\n\n| Network | Policy ID                                                  | Encoded Name           |\n| ------- | ---------------------------------------------------------- | ---------------------- |\n| Preview | `d2dbff622e509dda256fedbd31ef6e9fd98ed49ad91d5c0e07f68af1` | `4e49474854` (\"NIGHT\") |\n| Preprod | `d2dbff622e509dda256fedbd31ef6e9fd98ed49ad91d5c0e07f68af1` | `4e49474854` (\"NIGHT\") |\n| Mainnet | `0691b2fecca1ac4f53cb6dfb00b7013e561d1f34403b957cbb5af1fa` | `4e49474854` (\"NIGHT\") |\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feffectstream%2Fdust-registration-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feffectstream%2Fdust-registration-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feffectstream%2Fdust-registration-cli/lists"}