Blockstack: Windows Toolbox

It’s a good thing I got on the Blockstack Slack, because the approach I was taking was not sustainable. Sure, you can use windows subsystem for Linux and get pretty far along. I feel like I did. But once I ran into troubles the Slack team, Aaron specifically, helped me out by pointing to the just recently created Windows installer. It sets up a set of docker containers that run the Blockstack core, the browser, and a proxy service to allow you to use the browser on your windows machine without any problems*.

So I went through the setup of that and now have a fully functioning Blockstack browser on my windows box. I’m not sure if the windows installer is really ready for prime time, but I got the impression that the team would appreciate help tracking down issues with it. I’m sure if you join the Blockstack Slack and want to check it out, they’ll make it happen.

* I did have one problem as I tried to get it working, and it actually turned into an addressable issue that I filed against their packaging repository. The browser and the core communicate with each other using a password to keep things secure. But because of how that password is passed, there are certain characters that are not allowed. After we tracked down that that was keeping my browser and core from communicating with each other, I got things working fine and filed the issue to have that documented, so it doesn’t trip others up in the future.

Blockstack: Buying My First Bitcoin

I’m going to need funds to participate in the Blockstack ecosystem, and right now, it’s built on Bitcoin. So it’s time to buy myself some Bitcoin.

I decided to go with Coinbase, mostly due to name recognition. As it turns out, setup is pretty easy. Just pick a username/password and a way to fund your account. I went with linking a debit card, because it’s faster. Giving them bank routing info would be cheaper and slower. So I will set that up for future transactions.

Coinbase has two factor authentication built in, and has you link your phone number to the account before you even setup payment information, so they can enforce that security.

Once it was all arranged, I bought quite a small amount of bitcoin. In other words, it’s really not worth trying to crack into my account. Now, I should be able to transfer some of those bitcoin over to my Blockstack account in order to handle the transactions that will need to occur as I setup my development environment and flesh out an actual application.

Blockstack: Getting on Slack

The Blockstack team has a Slack instance set up for communicating. I know I’m going to need help getting my onename registered name transferred into my personal wallet, so I can do development. So I decided to jump on so that I could ask my questions, and be a part of the conversation. To do that you just have to give them an email address and an explanation of why you want to join their Slack. Once again, the response was nice and quick.

Besides getting support, it’s also cool to see that Blockstack is fully transparent about their day to day work. You can see their daily scrum notes, design discussions, engineering decisions, and work on Blockstack apps in the various public channels.

Blockstack: Registering a Name

Time to get ourselves a name. As we learned yesterday, we could get a name by registering one ourselves, using our own Bitcoin wallet. But I don’t have one yet, and besides, the Blockstack team has built Onename.com to make it free to register a named id. The price to register the name still must be paid in btc, but Onename is sponsoring names to help bootstrap the Blockstack ecosystem. So we’ll do that, and then work through how to transfer that name for use in the Blockstack CLI later.

Obviously, we’ll start at onename.com.

The UI is very simple and clean. I just signed up for an account, entering my email address and a password.

I was then immediately prompted to choose a name. As I already know I want rockhymas.id, I chose that.

At this point, Onename gave me the option to save my Onename backup file to Dropbox, or to download it. I went with Dropbox, to make my life easier.

Next I set up my Onename profile, with an image, name, location, and website.

Finally, Onename lets you verify your identity on Twitter, Facebook, and Github. The process here is pretty straightforward. You claim ownership by posting public statuses provided by Onename in each service using your account. Then point Onename at those statuses, so it can verify that you posted the status they provided and then you’re all verified.

Finally, the name registration has to go through. Onename tells you it will take about 12 hours for that to happen. After waiting 24 hours, I contacted support to see if I could find out why it was taking so long. Support was really responsive, and got back to me within half an hour to let me know that registrations can take longer and to give it another couple days. After waiting over the weekend, still no luck. Contacted support again, they escalated to the dev team and within a day the registration had gone through. It sounded like other registrations may have gotten backed up as well. Yay for bleeding edge software!

So, at this point, I have rockhymas.id registered in Blockstack. Whew! The picture above comes from the Blockstack Explorer, which is a little tool that makes it easy to see blocks on the Blockstack virtual chain, and any associated names, including their history. You can check mine out at https://explorer.blockstack.org/name/rockhymas.id.

Blockstack: Exploring the CLI

Ok, it’s day two. Time to play around with the tools we installed.

We’ll be using the command line interface to lookup names, price names, find our deposit key, see which names we own, and get more information on names registered in Blockstack.

I don’t have my own name yet, but we can lookup other names registered with Blockstack, like so:

$ blockstack lookup fredwilson.id
{
    "profile": {
        "@type": "Person",
        "account": [
            {
                "@type": "Account",
                "identifier": "fredwilson",
                "proofType": "http",
                "service": "twitter"
            },
            {
                "@type": "Account",
                "identifier": "fred.wilson.963871",
                "proofType": "http",
                "service": "facebook"
            },
            {
                "@type": "Account",
                "identifier": "1Fbi3WDPEK6FxKppCXReCPFTgr9KhWhNB7",
                "role": "payment",
                "service": "bitcoin"
            }
        ],
        "address": {
            "@type": "PostalAddress",
            "addressLocality": "New York City"
        },
        "description": "I am a VC",
        "image": [
            {
                "@type": "ImageObject",
                "contentUrl": "https://s3.amazonaws.com/kd4/fredwilson1",
                "name": "avatar"
            },
            {
                "@type": "ImageObject",
                "contentUrl": "https://s3.amazonaws.com/dx3/fredwilson",
                "name": "cover"
            }
        ],
        "name": "Fred Wilson",
        "website": [
            {
                "@type": "WebSite",
                "url": "http://avc.com"
            }
        ]
    },
    "zonefile": "{\"avatar\": {\"url\": \"https://s3.amazonaws.com/kd4/fredwilson1\"}, \"bio\": \"I am a VC\", \"bitcoin\": {\"address\": \"1Fbi3WDPEK6FxKppCXReCPFTgr9KhWhNB7\"}, \"cover\": {\"url\": \"https://s3.amazonaws.com/dx3/fredwilson\"}, \"facebook\": {\"proof\": {\"url\": \"https://facebook.com/fred.wilson.963871/posts/10100401430876108\"}, \"username\": \"fred.wilson.963871\"}, \"graph\": {\"url\": \"https://s3.amazonaws.com/grph/fredwilson\"}, \"location\": {\"formatted\": \"New York City\"}, \"name\": {\"formatted\": \"Fred Wilson\"}, \"twitter\": {\"proof\": {\"url\": \"https://twitter.com/fredwilson/status/533040726146162689\"}, \"username\": \"fredwilson\"}, \"v\": \"0.2\", \"website\": \"http://avc.com\"}"
}

I want a name, so I can see how much it would cost by using the price command (at the time of this writing, registering rockhymas.id would cost me about $40 in btc):

$ blockstack price rockhymas.id
{                                                       
    "name_price": {                                     
        "btc": 0.00025,                                 
        "satoshis": 25000                               
    },                                                  
    "preorder_tx_fee": {                                
        "btc": 0.0028148,                               
        "satoshis": 281480                              
    },                                                  
    "register_tx_fee": {                                
        "btc": 0.0028148,                               
        "satoshis": 281480                              
    },                                                  
    "total_estimated_cost": {                           
        "btc": 0.0115092,                               
        "satoshis": 1150920                             
    },                                                  
    "total_tx_fees": 1125920,                           
    "update_tx_fee": {                                  
        "btc": 0.0056296,                               
        "satoshis": 562960                              
    },                                                  
    "warnings": [                                       
        "Insufficient funds; fees are rough estimates." 
    ]                                                   
}                                                       

If I wanted to buy it, I would need some btc in my account. To see which account the btc would be withdrawn from, I can use the deposit command:

$ blockstack deposit
{
    "address": "38FDVrfrexyoG3JNTCQkh8dpJbHT44YFuQ",
    "message": "Send bitcoins to the address specified."
}

The names command lets me see which names I currently have registered to this wallet (none, of course):

$ blockstack names
{
    "addresses": [
        {
            "address": "3MhaGGag9bKUM1yekMh24WGcteg3qAvgyo",
            "names_owned": []
        }
    ],
    "names_owned": []
}

And I can see more info about a given name’s registration using whois:

$ blockstack whois fredwilson.id
{
    "block_preordered_at": 374084,
    "block_renewed_at": 374084,
    "expire_block": 489247,
    "has_zonefile": true,
    "last_transaction_height": 374084,
    "last_transaction_id": "2986ec31ec957692d7f5bc58a3b02d2ac2d1a60039e9163365fc954ff51aeb5a",
    "owner_address": "1F2nHEDLRJ39XxAvSxwQhJsaVzvS5RHDRM",
    "owner_script": "76a91499e7f97f5d2c77b4f32b4ed9ae0f0385c45aa5c788ac",
    "zonefile_hash": "1a587366368aaf8477d5ddcea2557dcbcc67073e"
}

There is much more to the command line interface, right now we’re just dipping our toes in the water, figuring out the basics. Next up, let’s register a Blockstack name in the .id namespace.

Blockstack: First Steps

So I’m diving headfirst into Blockstack, because, well, why not?

The idea here is that Blockstack is building a new operating system on top of the blockchain technology, which was first and most famously used as part of Bitcoin.

A blockchain is a secure, open ledger of records updated via distributed consensus that removes the need for a centralized (i.e. “single point of failure”) authority. Bitcoin uses the blockchain to record transactions.

Blockstack is extending the blockchain in a few key ways. First, it introduces the idea of a virtual blockchain that sits on top of an existing blockchain. This allows changing the underlying blockchain, making Blockstack resistant to blockchain failure. Second, the blockchain tracks pointers to the actual data being tracked, rather than the data itself. This keeps the chain relatively small, while expanding the potential uses to large, internet scale applications. Third, like NameCoin before it, Blockstack uses the blockchain to assign human readable names to computer addressable locations. This provides secure identity and ownership of digital assets.

Ok, that was my best entry level summary of a new technology and company that I admittedly barely understand. How did I do?

Well, even if I botched that up, I still think it’s cool, so I’m going to document how I’m getting started with Blockstack. This is day one. Day one is all about installing the tools. Here are the steps I followed:

  1. Install the Windows Subsystem for Linux
    • Enable-WindowsOptionalFeature
      $ Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
    • restart Windows
    • run bash, which installs Ubuntu on Windows
    • Create root username and password
  2. Install Blockstack
    $ wget -qO - https://raw.githubusercontent.com/blockstack/packaging/master/repo-key.pub | sudo apt-key add -
    $ echo "echo 'deb http://packages.blockstack.com/repositories/ubuntu/ xenial main' > /etc/apt/sources.list.d/blockstack.list" | sudo -E bash -
    $ sudo apt update
    $ sudo apt install blockstack
  3. Install node.js
    $ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
    $ sudo apt-get install -y nodejs
  4. Install the Blockstack browser
    $ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
    $ sudo apt install blockstack-browser
  5. Install regtest environment and integration test dependencies
    $ sudo apt install software-properties-common
    $ sudo add-apt-repository ppa:bitcoin/bitcoin
    $ sudo apt update
    $ sudo apt install sqlite3 bitcoind
  6. Test blockstack install
    $ blockstack info 

    This command failed with the error: “Failed to contact blockstack daemon. Please ensure that it is running with the ‘api’ command.” My next attempt was to start the blockstack daemon:

    $ blockstack api start

    This command also failed, with the error: “Wallet does not exist. Please create one with blockstack setup”. So I need to setup a wallet. Turns out there is a command for that as well:

    $ blockstack setup

    In doing this, it needs a password to protect your wallet. I saved that to my password manager, and also saved off new wallet information generated by this command.

    Now I could run

    $ blockstack api start
    Enter wallet password:
    {
        "status": true
    }

    And it works!

    And finally, I could run

    $ blockstack info
    {
        "cli_version": "0.14.4.2",
        "consensus_hash": "bc799939a8de6f258a55ea3ef9c32953",
        "last_block_processed": 482868,
        "last_block_seen": 482874,
        "queues": {},
        "server_alive": true,
        "server_host": "node.blockstack.org",
        "server_port": 6264,
        "server_version": "0.14.4.2"
    }

    And it works too!

So there you have it. We’re up and running with Blockstack. Next up, exploring the command line interface.