Indexing @handles

Building an indexer

These instructions explain the protocol logic and instructions for extracting and validating names so you can properly index them and determine the first instance of each name.


Fetch the data

These instructions assume you have access to the entire ordinals data structure with basic details like content type, ID, as well as the content.

Validate that the inscription's content type is any of these:

  • text/plain

  • application/JSON

Fetch text as the raw text contents of an inscription. For example, the text would be the raw contents returned at https://ordinals.com

Extracting the name from JSON5

Validate the text according to the JSON5 standard.

To check if the inscription is JSON, try parsing the text. If an error is thrown (invalid JSON), extract the plain text using the ruleset under "Validate Names".

Check that the JSON has the required keys:

  • p equals "@handles"

  • op equals "data"

  • name is present and is type string

Once the name is extracted, follow the steps and proceed to the Validate names steps.

Validate names

  • Validate that the string begins with an @

  • Validate accepted characters: (Letters (English), Numbers, Underscore (_), and hyphens (-) only

  • Validate length is between 2 and 21 characters (to include the @)

  • Turn the string into lowercase

  • Delete everything after the first whitespace or newline (\n)

  • Trim all whitespace and newlines

Last updated