Skip to content

Multi-Mostro Support: Replace Hardcoded Pubkey with Dynamic Mostro Selection and Custom Node Addition #435

@grunch

Description

@grunch

Current Context

Currently, the Mostro mobile application has a hardcoded pubkey for a test Mostro node. As the ecosystem grows, different communities are consolidating their own Mostro nodes, so we need to allow users to select between multiple Mostro instances and optionally add custom nodes.

Objective

Implement a Mostro selection system that allows users to choose between pre-configured Mostro nodes from consolidated communities, while also enabling advanced users to add custom Mostro nodes with appropriate risk warnings.

Proposed Solution

  1. Replace single hardcoded pubkey with array of hardcoded pubkeys

    • Define a curated list of trusted Mostro nodes from established communities
    • This list will be maintained in the app codebase
  2. Implement dual selection mechanism:

    • Primary UI: Dropdown/selector showing verified Mostro nodes from the hardcoded list
    • Secondary option: "Add custom Mostro" button/option for manual pubkey entry
  3. Fetch profile metadata (NIP-01 kind 0):

    • On app startup, fetch kind 0 event for each hardcoded Mostro pubkey
    • For custom added Mostros, fetch kind 0 after user provides pubkey
    • Extract name and picture from profile
    • Display this information in the selector for visual identification
  4. Custom Mostro addition with risk warning:

    • Provide UI for users to input a custom Mostro pubkey
    • Before saving, display a warning modal/dialog explaining the risks
    • Warning should inform users that unverified nodes may be malicious or unreliable
    • Require explicit user confirmation to proceed
  5. Selection and custom nodes persistence:

    • Save the user's selected Mostro
    • Persist custom added Mostros separately from hardcoded list
    • Restore both selection and custom nodes in subsequent sessions

Technical Details

Suggested data structure:

interface MostroNode {
  pubkey: string;
  name?: string;  // Obtained from kind 0
  picture?: string;  // Obtained from kind 0
  description?: string;  // Optional, from kind 0
  relays?: string[];  // Relays to listen for this Mostro
  isDefault?: boolean;
  isTrusted: boolean;  // true for hardcoded, false for custom
  addedAt?: number;  // timestamp for custom nodes
}

// Hardcoded list in app
const TRUSTED_MOSTRO_NODES: string[] = [
  "pubkey1...",  // Test Mostro
  "pubkey2...",  // Community A Mostro
  "pubkey3...",  // Community B Mostro
];

Flow on app startup:

  1. Load hardcoded list of trusted Mostros
  2. Load custom Mostros from local storage
  3. For each pubkey (trusted + custom), fetch kind 0 from Nostr relays
  4. Populate UI with name + picture (thumbnail) for each Mostro
  5. Visually distinguish trusted vs custom nodes in the UI
  6. If no kind 0 exists, display truncated pubkey as fallback

Custom Mostro addition flow:

  1. User clicks "Add custom Mostro" option
  2. User inputs pubkey (with validation for correct format)
  3. App attempts to fetch kind 0 for preview
  4. Display warning modal with risk disclaimer
  5. User confirms or cancels
  6. If confirmed, add to custom nodes list and persist

Acceptance Criteria

  • Single hardcoded pubkey is replaced with an array of hardcoded pubkeys
  • App defines at least 2-3 trusted Mostro nodes in the hardcoded array
  • UI for Mostro selection is implemented showing all available nodes
  • "Add custom Mostro" functionality is implemented
  • Custom pubkey input validates format before proceeding
  • Risk warning modal is displayed when adding custom Mostro
  • Warning clearly explains potential risks of unverified nodes
  • User must explicitly confirm warning to proceed
  • App fetches kind 0 profiles on startup for all nodes
  • name and picture of each Mostro are displayed in the selector
  • UI visually distinguishes between trusted and custom nodes
  • Fallback UI exists if kind 0 is not available
  • User selection persists between sessions
  • Custom Mostros persist separately from hardcoded list
  • App connects correctly to the selected Mostro (trusted or custom)

UI/UX Suggestions

Trusted nodes display:

  • Show with a "verified" or "trusted" indicator
  • Group at the top of the selection list

Custom nodes display:

  • Show with a "custom" or "unverified" indicator
  • Optionally allow users to remove custom nodes
  • Consider showing when the node was added

Risk warning content (suggested):

Warning: Adding Custom Mostro Node

You are about to add a Mostro node that is not verified by the Mostro development team.

Risks:
- The node operator could be malicious
- Trades may not be honored
- Your privacy could be compromised
- The node may be unreliable or offline

Only add custom nodes if you trust the operator or are running your own node.

Do you want to proceed?
[Cancel] [I Understand, Add Node]

Additional Considerations

  • Relays: Where to search for kind 0? Specific relays per Mostro or common relays?
  • Validation: How to validate that a pubkey is actually an operational Mostro node before adding?
  • Node health: Consider displaying status/health for both trusted and custom nodes
  • Onboarding: For new users, which Mostro from the hardcoded list will be the default?
  • Updates: How will new trusted nodes be added to the hardcoded list? (app updates only?)
  • Custom node management: Should users be able to edit/remove custom nodes after adding?
  • Export/Import: Consider allowing users to export/import their custom node list

References

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions