Registering a name on the command line

Yesterday, I registered my first name with v0.14 of the Blockstack CLI. I’m following the instructions from https://blockstack.org/docs to see what we’re missing.

This is the name: devname0.id

Registration went very smoothly (great job @jude!) but the instructions became a bit unclear once I got to the section about updating the DNS settings for the name.

There wasn’t any information about how to generate the zone file. I tried using the master branch of dns-zone-file-py library as follows:

  1. Clone the repo

  2. Run the following commands

    records = {‘uri’: [{‘priority’: 1, ‘target’: ‘https://www.larrysalibra.com/blockstack-data/devname0.id/profile.json’, ‘name’: ‘@’, ‘weight’: 10, ‘ttl’: ‘1D’}]}
    zone_file = make_zone_file(records, origin=“devname0.id”, ttl=“3600”)
    print zone_file
    $ORIGIN devname0.id
    $TTL 3600
    @ 1D URI 1 10 “https://www.larrysalibra.com/blockstack-data/devname0.id/profile.json

  3. Copy and save the output into a file zonefile.txt

Next I ran blockstack update devname0.id zonefile.txt, which told me my zonefile wasn’t in the proper format. I compared it to the zonefile format generated by onename.com for larry.id and adjusted it to match. (Note: It turns out the master branch of dns-zone-file-py wasn’t up to date.)

Running blockstack update devname0.id zonefile.txt again succeeded:

{
    "message": "The name has been queued up for update and will take ~1 hour to process. You can check on the status at any time by running 'blockstack info'.", 
    "success": true, 
    "transaction_hash": "5cef0a7ebac5ec019c2c7b129ef6798cce6d85928efaa40a640dcc6075062e3d", 
    "value_hash": "a88cbc639d18170d847bb80950de27000caf6696"
}

While I wait for that to confirm, I’ve generated a signed profile as follows:

  1. pip install blockstack-profiles
  2. Obtain public key using blockstack wallet

Data public key: 0215236d51d7e835699b15d092d946e9010c0329eb9086e7fa6d4de698856d77d2
3. Create a JSON structure with profile components:

profile_components = [
    {"name": "Johnny Appleseed"},
    {"birthDate": "1980-01-01"}
]
  1. Generate signed tokens records:

    from blockstack_profiles import sign_token_records
    token_records = sign_token_records(profile_components, “0215236d51d7e835699b15d092d946e9010c0329eb9086e7fa6d4de698856d77d2”)

I saved the result in token_records and uploaded it to
https://www.larrysalibra.com/blockstack-data/devname0.id/profile.json

Now to wait for confirmations and see if it works. :smiley:

1 Like

How long did it take for the confirmations.

The confirmation of the update only took an hour or so - however I had difficulties creating and signing my profile (you can probably spot some errors in my last few steps. :blush: Got it working this afternoon but haven’t yet had a chance to update the thread with the proper steps.

As I mentioned above, I took the wrong steps for creating and signing the profile.

These steps are what worked for me:

Step 1. pip install blockstack-profiles (I did this in the same virtualenv that I have blockstack installed in)
Step 2. Obtain the owner_privkey (NOT the data public key as described above) from the blockstack wallet command.
Step 3. Create JSON structure of profile components…unlike above these should be in a single JSON object. We’ll need to update the instructions found in the readme (reproduced below)

Instead, I copied the profile of a name managed by onename.com and changed values:

Step 4. Sign the above profile with sign_token_records:
>>> from blockstack_profiles import sign_token_records
>>> priv_key = <hidden>
>>> profile_components = [{ ... "address": { ... "addressLocality": "USA", ... "@type": "PostalAddress" ... }, ... "@type": "Person", ... "description": "Grower of apple trees", ... "name": "Johnny Appleseed", ... "image": [ ... { ... "name": "avatar", ... "@type": "ImageObject", ... "contentUrl": "https://www.larrysalibra.com/blockstack-data/devname0.id/avatar.jpg" ... } ... ] ... }]
>>> token_records = sign_token_records(profile_components, priv_key)
>>> json_out = json.dumps(token_records)
>>> print json_out

Step 5. Save the contents of json_out to https://www.larrysalibra.com/blockstack-data/devname0.id/profile.json

After doing this, I can use blockstack lookup devname0.id to lookup the profile file without issue:

(blockstack-venv)Tesla:devname0.id larry$ blockstack lookup devname0.id
{
    "profile": {
        "@type": "Person", 
        "address": {
            "@type": "PostalAddress", 
            "addressLocality": "USA"
        }, 
        "description": "Grower of apple trees", 
        "image": [
            {
                "@type": "ImageObject", 
                "contentUrl": "https://www.larrysalibra.com/blockstack-data/devname0.id/avatar.jpg", 
                "name": "avatar"
            }
        ], 
        "name": "Johnny Appleseed"
    }, 
    "zonefile": "$ORIGIN devname0.id\n$TTL 3600\n_http._tcp URI 10 1 \"https://www.larrysalibra.com/blockstack-data/devname0.id/profile.json\"\n"
}
(blockstack-venv)Tesla:devname0.id larry$

I can also view devname0.id's profile in the Blockstack browser’s private alpha:

Success! (Almost!)

The webapp onename.com doesn’t seem to like my new name.


1 Like

Thanks a lot for these instructions. Have a few questions though, what value can be used for the URI value? It tells blockstack where to find the profile correct? Can this be a local file? Will the profile be automatically uploaded to the blockstack nodes?

Any valid URI - I don’t believe there’s anything other than convention right now that limits it to an http[s] URI.

Yes.

No. Currently, you have to upload the profile file to it’s location on your own.

Hi Larry, thanks for taking the time to write this up! Looks great!

I have just two small nitpicks. First, according to the URI resource record RFC [1], the name field should be _http._tcp, not @. It shouldn’t make a difference to the CLI tool, but it could impact people who want to use their zone files with DNS providers. Second, the TTL field must be a decimal number (per the same RFC). I can extend the zone file parser to interpret 1D as 86400 automatically, though :slight_smile:

[1] https://tools.ietf.org/html/rfc7553

1 Like