Resolving a Starname

This is how to get the information attached to a starname.

A starname can have two different formats:

  • *domain

  • name*domain

What is a valid starname format?

A Starname needs to match the following format:

  • left*right, matching the regex ^[-.a-z0-9]{0,63}*[-a-z0-9]{1,32}$ . Please note the left part can be an empty string so benjamin*cosmostation and *cosmostation are two valid starnames which can be resolved.

If you look for a Starname which has an invalid format, you will fail to resolve. You can check before resolving that the format is matching the regex.

I know someone's starname, how do I know the associated info?

With a web browser, Starname explorer Big Dipper

You can easily check a starname with a web browser using the url: https://big-dipper.iov-mainnet-2.iov.one/starname/<your_starname>

For exemple, you can check https://big-dipper.iov-mainnet-2.iov.one/starname/*benjamin

On a web browser, you can see the friendly UI version of the starname at https://starname.me/<your_starname>, for exemple: https://starname.me/*benjamin

With the REST API

You can query the crypto-addresses associated with a starname ( fondation-aphp*iov as example) by running the command :

curl -X POST "https://iovnscli-rest-api.iov-mainnet-2.iov.one/starname/query/resolve" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d '{"starname":"fondation-aphp*iov"}'

If the starname looks like *mybusiness for example, you will run the same command :

curl -X POST "https://iovnscli-rest-api.iov-mainnet-2.iov.one/starname/query/resolve" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d '{"starname":"*benjamin"}'

The result of this POST is a JSON with the Starname data.

With the IOVNS CLI

You can query the crypto-addresses associated with a starname ( fondation-aphp*iov as example) by running the command :

iovnscli query starname resolve --starname fondation-aphp*iov

If the starname looks like *mybusiness for example, you will run the same command :

iovnscli query starname resolve --starname *benjamin

The result of this POST is a JSON with the Starname data.

The Starname data

These commands will return the information attached to the starname in a JSON format. To get the specific data you are looking for, you can simply parse the JSON data. It will look like this

{
    "account":{
        "domain":"iov",
        "name":"fondation-aphp",
        "owner":"star12uv6k3c650kvm2wpa38wwlq8azayq6tlh75d3y",
        "valid_until":1633046400,
        "resources":[
            {
                "uri":"asset:eth",
                "resource":"0x795997519227f64879977d1a53625707f29b25b2"
            },
            {"
                uri":"asset:btc",
                "resource":"14AcAvkYz9eUP226NpGvTf62uP4Du2NnZJ"
            },
            {
                "uri":"asset:bch",
                "resource":"bitcoincash:qzmddu0vq53dkeej9nwt6jm8nyzlfxgn2vnh46k77u"
            },
            {
                "uri":"asset:ltc",
                "resource":"M8N2BjsijFyQTYVAq7WXZGmC5dmLUbBefb"
            },
            {
                "uri":"asset:xtz",
                "resource":"tz1XAMyU4VtmMyber79FF56RESdrAcuN886z"
            },
            {
                "uri":"asset:atom",
                "resource":"cosmos18qvxu5t9h29pwhf6jtf0a2lpwt4y026e09tln9"
            }
        ],
        "certificates":null,
        "broker":"",
        "metadata_uri":""
    }
}

Typically, you will be using the Resolver to look for the specific address of the recipient for the asset you want to send.

For exemple, you want to send BTC to *benjamin. You are therefore looking for the BTC address associated with the Starname *benjamin.

  • You send the request to resolve starname *benjamin (via REST or CLI), and you receive the Starname JSON data.

  • Because you are sending BTC, you are looking for the data associated with the uri: asset:btc. For all common coins, the uri is asset:xxx where xxx is the ticker of the coin. You can see here all the Asset Tickers.

  • At this point, get the value of the field resources. It is an array of pair uri, resource. Search for the pair where the uri is matching asset:btc and return the value of the field resource. If you don't find any matching uri, then it means that there is no BTC address associated with this Starname yet.

Last updated