Should you name your nfts?
Tags: nft, procedural, content
Published: 2022-02-03 20:32:20

This question was asked the other day in the [Skull in Love Discord](https://discord.gg/uYaCrUsMNM). My first thought was "sure, why not?". Then as I thought about it further, I realised that it is quite a bit. In this article I would like to expand on that thought and show an approach how to name even 10,000 NFT items.

If you look at various collections, you will notice that most of them do not name their NFT items. There is an increasing counter that serves as the name (e.g. Cryptopunk #4211). While this is useful, it does not really encourage identification with the items or the collection. This is not necessarily a problem, as it is often  not intended. However, giving NFT items a name can also have advantages:

- It creates an identification with the NFT item. This is especially useful if you want to create a collection that has meaning and not just be flipped.
- It serves as an additional layer for rarity or traits. There may be names that are rarer, contain titles, or have other collectible characteristics.
- Names can tell a story that strengthens the overall value of the collection and the underlying idea.

## The challenge

So why do so few artists bother to name their NFT items? In my opinion, the most obvious reason is the added layer of complexity. If you want to create a collection of 10,000 items, you also have to come up with 10,000 names. This is no easy task. Here I would like to suggest a way out of this complexity - something called grammar.

## Grammars

Grammars are a concept from theoretical computer science and describe how a language is structured. It defines literals, i.e. the smallest building blocks of a language (e.g. letters, numbers, syllables) and gives rules on how to combine them to form words and sentences. This logic can be applied to our given problem. The resulting grammar describes a language whose words and phrases form the names for our NFT items. To illustrate this, let me show an example from our NFT collection, ["Loot from a Chest"](https://lootfromachest.com). Loot from a Chest is a collection of 10,000 procedurally generated swords in a fantasy world called Aeliv. 

The first thing you should think about is the logic of the language you want to create. Which sentences should end up being formally correct and which should not? In our case, we want to give names to the swords. Formally correct names are, for example:

- Longsword
- Shiny Sword
- Sword of Brikandal
- Thorma's heavy Sword

There are many more possibilities, but you get the idea. From these names you can deduce some logic how to build them

- <adjective>sword
- <adjective> Sword
- Sword of <name>
- <name>'s <adjective> Sword

To simplify things, let us assume that we only have these 4 rules. Now we just need literals and we can start creating names. Here is an example of a list of literals:

- `<adjective>`: [heavy, golden, long, short, ...]
- `<name>`: [Brikandal, Thorma, Shrivel, Pouch, ...]

This already gives a nice list of unique names:

- Shortsword
- Shrivel's golden Sword
- Long sword
- Sword of Pouch

In fact, with these 4 rules and 8 literals, we can create quite a few unique names. Note that while they are unique, they may not be perceived as unique, which is a common problem with procedurally generated content. We will deal with this in a later section of this article. First, let us see how we implement our grammar. We will use a tool called [tracery](https://tracery.io) from [galaxykate](https://twitter.com/GalaxyKate).

## Implementing a grammar

Let's create a new nodejs project. Go to your terminal and type in

```
mkdir naming-nfts
cd naming-nfts
npm i -y
npm i tracery-grammar
touch index.js
```

In your index.js, add this boilerplate code

```
const tracery = require('tracery-grammar');

const grammar = tracery.createGrammar({
  // ...
});

grammar.addModifiers(tracery.baseEngModifiers); 
```

We need to import the tracery module. The grammar variable contains, well, our grammar. And we add modifiers to make our lives easier. This allows us to capitalise and pluralise words. Now we need to create our literals and rules. In tracery, these concepts are mixed. Let's apply our rules from Loot from a Chest to tracery.

```
const adjectives = ['heavy', 'golden', 'long', 'short'];
const names = ['Brikandal', 'Thorma', 'Shrivel', 'Pouch'];
const rules = ['#adjective#sword', '#adjective# Sword', 'Sword of #name#', '#name#'s #adjective# Sword'];

const grammar = tracery.createGrammar({
  adjectives,
  names,
  rules
});

grammar.addModifiers(tracery.baseEngModifiers); 
console.log(grammar.flatten('#rules#')); // --> "Heavy Sword"
```

Every time you call 'flatten', tracery traces the grammar (hence the name). We start with the #rules# symbol. This can have one of 4 possible states. Starting from this state, we use various other rules (e.g. #adjective# and #name#) to fill in actual literals and produce a name. However, the names are not unique. First, we have too few literals to cover even a fraction of 10,000 unique names. And second, we have too few rules for the names to be perceived as unique. Let's deal with the literals first, since this is easy to fix.

## Improving the grammar

Basically, you need to find more possible states for your literal classes (i.e. adjectives and names). There are many random word generators you can use to accomplish this. As an example, let me show you unique-names-generator (NPM).

```
const { adjectives, names } = require('unique-names-generator');

const rules = ['#adjective#sword', '#adjective# Sword', 'Sword of #name#', '#name#'s #adjective# Sword'];

const grammar = tracery.createGrammar({
  adjectives,
  names,
  rules
});

grammar.addModifiers(tracery.baseEngModifiers); 
console.log(grammar.flatten('#rules#')); // --> "Winona's big Sword"
```

Instead of creating our own adjectives and names, we use the dictionaries provided by unique-names-generator. This package is great because it is configurable, extensible, and provides a large number of combinations out of the box. But there are many other packages you can use. Choose one that works best for you.

## Adding diversity

Now let's tackle the problem of items not perceived as unique. This is something that can not be easily solved with a package. Perception is hard to measure and therefore hard to improve. However, we know that diversity affects uniqueness and therefore how unique your names are perceived. So what you want to do is increase diversity. You can do this by adding more rules or changing rules that are too similar. In the example given, we find that `<adjective>sword` and `<adjective> Sword` are too similar for people to perceive them as unique, even though they are unique. Often you need to get creative and try a few things. Keep rules that work and update or remove rules that do not. Eventually you will find a grammar that gives you a variety of names for your NFT items. Here is an example of 10 random names from our grammar that names swords for Loot from a Chest:

- Combat Gladius
- Noble Dagger of Grotdag
- Silver Dagger
- Blade of Rudbrag
- Dagger of the Night
- Breaking Blade
- Mighty Spear
- Steelaxe
- Gladius
- Heavy Sword of Nimildan

## Final thoughts

Naming NFT items can be a fun activity and will likely help create a connection between your audience and your collection. Naming things is one of the most difficult problems, but can be tackled with a concept called grammar and tools like tracery and random name generators (there are many of them). You can even create complex descriptions and stories using this approach. It can be a challenge to make them seem unique, so remember to diversify your rules that make up the grammar, and you are good to go. I hope this helps you get started or even consider naming your items other than #4211, and if so, please let me know how you did!

If you have not checked out "Loot from a Chest" yet, you really should :) Join our Discord at https://discord.gg/aS3vQcQQUC or visit our website at https://lootfromachest.com.

![Map of Aeliv](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l9739ed27uhohde399m4.png)

_Feel free to leave comments. I hope this helps you in your digital endeavour. If not, drop me a line and I'll be happy to help :)_

**DISCLAIMER**:

Not naming items is no dealbreaker. There are many successful NFT projects out there that do not name their items. This article argues that naming might be strategy to further increase engagement and shows how to deal with the complex task of naming 10,000+ items, so that they are still perceived as unique.