Skip to content

Instantly share code, notes, and snippets.

@melvincarvalho
Last active January 19, 2024 01:30
Show Gist options
  • Save melvincarvalho/09b8d8dfdb6d89a9043fae26e9312b1e to your computer and use it in GitHub Desktop.
Save melvincarvalho/09b8d8dfdb6d89a9043fae26e9312b1e to your computer and use it in GitHub Desktop.
nip135.md

NIP-135

DNSTR - Domain Name Mapping for Nostr Public Keys

draft optional author:melvincarvalho

This NIP defines a way to associate a Nostr public key with a domain name.

For example:

  • npub1hn4zhxzsd5w4m5kvq326gqnsrc6zcakhparw8pee4tw7wlxw70ysawhtl5.nostr maps to alice.com
  • bcea2b98506d1d5dd2cc0455a402701e342c76d70f46e38739aadde77ccef3c9.nostr maps to bob.net

This is useful for services and individuals who wish to associate their Nostr public key with a domain name for easy referencing, identification, or branding purposes.

Nostr event

A kind 31034 event is used.

The content SHOULD contain the domain name as a string.

The following tags are defined as REQUIRED:

  • d - should be the empty string reserved for future use.

Example event:

{
    "id": "exampleid1234567890",
    "pubkey": "examplepubkey1234567890",
    "content": "example.com",
    "kind": 31034,
    "created_at": 1682327852,
    "tags": [
        [
            "d",
            ""
        ]
    ],
    "sig": "exampleSignature"
}

Services and tools that wish to make use of this NIP SHOULD first verify the authenticity of the event by checking the signature and then map the domain name specified in the content to npub.nostr or pubkey.nostr.

Implementation

In order to lookup a .nostr domain you simply query the pubkey with kind=31034 and use the field in the content as the domain. Some lookup services may choose to fallback to profile web page or nip-05 origin, as desired.

Use Case

By having a Nostr public key mapped to a domain name, users and services can easily share, reference, or verify the authenticity of a domain based on its associated Nostr public key.

For instance, if Alice wants to verify that example.com is genuinely associated with a specific Nostr public key, she can look up the Nostr event with kind 31034 and verify the domain name in the content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment