Browse Source

Making Gaia experience better

Signed-off-by: Mary Anthony <mary@blockstack.com>
feat/clarity-updates
Mary Anthony 6 years ago
parent
commit
43ea7c610e
  1. 7
      Gemfile.lock
  2. 4
      README.md
  3. 2
      _config.yml
  4. 2
      _data/navigation_home.yml
  5. 9
      _site/2017/05/25/post63.html
  6. 4
      _site/404.html
  7. 141
      _site/android/tutorial.html
  8. 238
      _site/browser/blockstack_storage.html
  9. 76
      _site/browser/browser-introduction.html
  10. 10
      _site/browser/faq_general.html
  11. 123
      _site/browser/hello-blockstack.html
  12. 10
      _site/browser/ids-introduction.html
  13. 238
      _site/browser/multi-player-storage.html
  14. 142
      _site/browser/todo-list.html
  15. 4
      _site/changelog/index.html
  16. 10
      _site/common/construction.html
  17. 4
      _site/contact/index.html
  18. 20
      _site/core/atlas/howitworks.html
  19. 35
      _site/core/atlas/howtouse.html
  20. 15
      _site/core/atlas/overview.html
  21. 22
      _site/core/faq_developer.html
  22. 10
      _site/core/faq_technical.html
  23. 40
      _site/core/install-api.html
  24. 34
      _site/core/memcached.html
  25. 15
      _site/core/naming/architecture.html
  26. 10
      _site/core/naming/comparison.html
  27. 10
      _site/core/naming/creationhowto.html
  28. 30
      _site/core/naming/did.html
  29. 10
      _site/core/naming/forks.html
  30. 10
      _site/core/naming/introduction.html
  31. 10
      _site/core/naming/manage.html
  32. 10
      _site/core/naming/namespaces.html
  33. 30
      _site/core/naming/pickname.html
  34. 20
      _site/core/naming/register.html
  35. 30
      _site/core/naming/resolving.html
  36. 176
      _site/core/naming/search.html
  37. 40
      _site/core/naming/subdomains.html
  38. 151
      _site/core/naming/tutorial_subdomains.html
  39. 80
      _site/core/wire-format.html
  40. 7
      _site/feed.xml
  41. 6
      _site/index.html
  42. 160
      _site/ios/tutorial.html
  43. 4
      _site/news/index.html
  44. 4
      _site/thanks/index.html
  45. 5
      _storage/gaia_redirect.md

7
Gemfile.lock

@ -38,8 +38,6 @@ GEM
sass (~> 3.4)
jekyll-seo-tag (2.5.0)
jekyll (~> 3.3)
jekyll-sitemap (1.2.0)
jekyll (~> 3.3)
jekyll-titles-from-headings (0.5.1)
jekyll (~> 3.3)
jekyll-watch (1.5.1)
@ -83,12 +81,11 @@ DEPENDENCIES
jekyll-livereload
jekyll-paginate (~> 1.1)
jekyll-seo-tag
jekyll-sitemap
jekyll-titles-from-headings
tzinfo-data
RUBY VERSION
ruby 2.3.3p222
ruby 2.5.1p57
BUNDLED WITH
1.16.3
1.16.6

4
README.md

@ -17,7 +17,7 @@ To run locally:
Use this format to turn on production features:
```
JEKYLL_ENV=production bundle exec jekyll serve --config _config.yml,staticman.yml
JEKYLL_ENV=production bundle exec jekyll serve --config _config.yml
```
## Deploy via Netlify
@ -27,7 +27,7 @@ To deploy to Netlify:
1. Build the site.
```
JEKYLL_ENV=production jekyll build --config _config.yml,staticman.yml
JEKYLL_ENV=production bundle exec jekyll build --config _config.yml
```
2. Force add the `_site` directory.

2
_config.yml

@ -151,7 +151,7 @@ collections:
core:
output: true
basepath: "blockstack/blockstack-core/blob/master/docs"
gaia:
storage:
output: true
basepath: "blockstack/gaia/blob/master/docs"
browser:

2
_data/navigation_home.yml

@ -23,7 +23,7 @@
- title: Implement Storage with GAIA
desc: Backend storage drivers and interactions between developer APIs and the Gaia service.
icon: database
doc: common/construction
doc: storage/gaia_redirect
- title: Blockstack Community
desc: view upcoming events, become a contributor or evangelist.

9
_site/2017/05/25/post63.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Site tags | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Site tags" />
<meta name="author" content="John Black" />
<meta property="og:locale" content="en_US" />
@ -19,7 +19,7 @@
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2017-05-25T00:00:00-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/2017/05/25/post63.html","author":{"@type":"Person","name":"John Black"},"headline":"Site tags","dateModified":"2017-05-25T00:00:00-07:00","description":"Site tags","datePublished":"2017-05-25T00:00:00-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/2017/05/25/post63.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/2017/05/25/post63.html","headline":"Site tags","dateModified":"2017-05-25T00:00:00-07:00","datePublished":"2017-05-25T00:00:00-07:00","author":{"@type":"Person","name":"John Black"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/2017/05/25/post63.html"},"description":"Site tags","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -161,7 +161,7 @@
<h2 id="example-of-code-block">Example Of Code Block</h2>
<p>In accumsan lacus ac neque maximus dictum. Phasellus eleifend leo id mattis bibendum. Curabitur et purus turpis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;</p>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt">&lt;head&gt;</span>
<div class="language-html highlighter-rouge"><pre class="highlight"><code><span class="nt">&lt;head&gt;</span>
<span class="nt">&lt;meta</span> <span class="na">charset=</span><span class="s">"utf-8"</span><span class="nt">&gt;</span>
<span class="nt">&lt;meta</span> <span class="na">http-equiv=</span><span class="s">"X-UA-Compatible"</span> <span class="na">content=</span><span class="s">"IE=edge"</span><span class="nt">&gt;</span>
<span class="nt">&lt;meta</span> <span class="na">name=</span><span class="s">"viewport"</span> <span class="na">content=</span><span class="s">"width=device-width, initial-scale=1"</span><span class="nt">&gt;</span>
@ -169,7 +169,8 @@
<span class="nt">&lt;link</span> <span class="na">rel=</span><span class="s">"shortcut icon"</span> <span class="na">type=</span><span class="s">"image/png"</span> <span class="na">href=</span><span class="s">"/assets/img/favicon.png"</span> <span class="nt">&gt;</span>
<span class="nt">&lt;script </span><span class="na">src=</span><span class="s">"/assets/js/main.js"</span><span class="nt">&gt;&lt;/script&gt;</span>
<span class="nt">&lt;/head&gt;</span>
</code></pre></div></div>
</code></pre>
</div>
<h2 id="text-and-quote">Text and Quote</h2>
<p>Cras at dolor eget urna varius faucibus tempus in elit. Cras a dui imperdiet, tempus metus quis, pharetra turpis. Phasellus at massa sit amet ante semper fermentum sed eget lectus. Quisque id dictum magna turpis.</p>

4
_site/404.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Feeling Lost | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Feeling Lost" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,7 +17,7 @@
<meta property="og:url" content="https://docs.blockstack.org/404.html" />
<meta property="og:site_name" content="Blockstack" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/404.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Feeling Lost","description":"Docs","@type":"WebPage","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/404.html","headline":"Feeling Lost","author":{"@type":"Person","name":"Blockstack"},"description":"Docs","@type":"WebPage","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->

141
_site/android/tutorial.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Android SDK Tutorial (Pre-release) | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Android SDK Tutorial (Pre-release)" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/android/tutorial.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/android/tutorial.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Android SDK Tutorial (Pre-release)","dateModified":"2018-10-17T09:26:44-07:00","description":"Android SDK Tutorial (Pre-release)","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/android/tutorial.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/android/tutorial.html","headline":"Android SDK Tutorial (Pre-release)","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/android/tutorial.html"},"description":"Android SDK Tutorial (Pre-release)","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -195,13 +195,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-android/blob/master/docs/tutorial.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>
@ -292,9 +292,10 @@ Depending on your network connection, this can take between 15-30 minutes.</p>
Before you begin, verify you have installed <code class="highlighter-rouge">npm</code> using the <code class="highlighter-rouge">which</code> command to
verify.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>which npm
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>which npm
/usr/local/bin/npm
</code></pre></div></div>
</code></pre>
</div>
<p>If you don’t find <code class="highlighter-rouge">npm</code> in your system, <a href="https://www.npmjs.com/get-npm">install
it</a>.</p>
@ -331,14 +332,16 @@ existing projects.</p>
<li>
<p>Install Yeoman.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> npm <span class="nb">install</span> <span class="nt">-g</span> yo
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> npm install -g yo
</code></pre>
</div>
</li>
<li>
<p>Install the Blockstack application generator.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> npm <span class="nb">install</span> <span class="nt">-g</span> generator-blockstack
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> npm install -g generator-blockstack
</code></pre>
</div>
</li>
</ol>
@ -356,24 +359,27 @@ modify the <code class="highlighter-rouge">hello-world</code> to interact with t
<li>
<p>Create a <code class="highlighter-rouge">hello-blockstack</code> directory.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nb">mkdir </span>hello-blockstack
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> mkdir hello-blockstack
</code></pre>
</div>
</li>
<li>
<p>Change into your new directory.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nb">cd </span>hello-blockstack
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nb">cd </span>hello-blockstack
</code></pre>
</div>
</li>
<li>
<p>Use Yeoman and the Blockstack application generator to create your initial <code class="highlighter-rouge">hello-blockstack</code> application.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> yo blockstack:react
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> yo blockstack:react
</code></pre>
</div>
<p>You should see several interactive prompts.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nv">$ </span>yo blockstack:react
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nv">$ </span>yo blockstack:react
<span class="o">==========================================================================</span>
We are constantly looking <span class="k">for </span>ways to make yo better!
May we anonymously report usage statistics to improve the tool over <span class="nb">time</span>?
@ -382,8 +388,8 @@ modify the <code class="highlighter-rouge">hello-world</code> to interact with t
_-----_ ╭──────────────────────────╮
| | │ Welcome to the │
|--<span class="o">(</span>o<span class="o">)</span><span class="nt">--</span>| │ Blockstack app │
<span class="nt">---------</span> │ generator! │
|--<span class="o">(</span>o<span class="o">)</span>--| │ Blockstack app │
--------- │ generator! │
<span class="o">(</span> _U_ <span class="o">)</span> ╰──────────────────────────╯
/___A___<span class="se">\ </span> /
| ~ |
@ -391,26 +397,28 @@ modify the <code class="highlighter-rouge">hello-world</code> to interact with t
|° Y
? Are you ready to build a Blockstack app <span class="k">in </span>React? <span class="o">(</span>Y/n<span class="o">)</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Respond to the prompts to populate the initial app.</p>
<p>After the process completes successfully, you see a prompt similar to the following:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="o">[</span>fsevents] Success:
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="o">[</span>fsevents] Success:
<span class="s2">"/Users/theuser/repos/hello-blockstack/node_modules/fsevents/lib/binding/Release/node-v59-darwin-x64/fse.node"</span>
is installed via remote npm notice created a lockfile as package-lock.json.
You should commit this file. added 1060 packages <span class="k">in </span>26.901s
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Run the initial application.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nv">$ </span>npm start
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nv">$ </span>npm start
<span class="o">&gt;</span> hello-blockstack@0.0.0 start /Users/moxiegirl/repos/hello-blockstack
<span class="o">&gt;</span> webpack-dev-server
&gt; hello-blockstack@0.0.0 start /Users/moxiegirl/repos/hello-blockstack
&gt; webpack-dev-server
Project is running at http://localhost:8080/
webpack output is served from /
@ -427,7 +435,8 @@ modify the <code class="highlighter-rouge">hello-world</code> to interact with t
<span class="o">[</span>2] <span class="o">(</span>webpack<span class="o">)</span>/buildin/global.js 509 bytes <span class="o">{</span>0<span class="o">}</span> <span class="o">[</span>built]
<span class="o">[</span>3] <span class="o">(</span>webpack<span class="o">)</span>/buildin/module.js 517 bytes <span class="o">{</span>0<span class="o">}</span> <span class="o">[</span>built]
webpack: Compiled successfully.
</code></pre></div> </div>
</code></pre>
</div>
<p>The system opens a browser displaying your running application.</p>
@ -472,13 +481,14 @@ application directory.</p>
<p>This endpoint on the web version of your app will redirect Android users back
to your mobile app.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nv">$ </span><span class="nb">touch </span>public/redirect.html
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nv">$ </span>touch public/redirect.html
</code></pre>
</div>
</li>
<li>
<p>Open <code class="highlighter-rouge">redirect.html</code> and add code to the endpoint.</p>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="cp">&lt;!DOCTYPE html&gt;</span>
<div class="language-html highlighter-rouge"><pre class="highlight"><code> <span class="cp">&lt;!DOCTYPE html&gt;</span>
<span class="nt">&lt;html&gt;</span>
<span class="nt">&lt;head&gt;</span>
<span class="nt">&lt;title&gt;</span>Hello, Blockstack!<span class="nt">&lt;/title&gt;</span>
@ -494,7 +504,8 @@ application directory.</p>
<span class="nt">&lt;body&gt;</span>
<span class="nt">&lt;/body&gt;</span>
<span class="nt">&lt;/html&gt;</span>
</code></pre></div> </div>
</code></pre>
</div>
<p>Blockstack apps are identified by their domain names. The endpoint will
receive a get request with the query parameter <code class="highlighter-rouge">authResponse=XXXX</code> and
@ -773,7 +784,7 @@ the SDK. This SDK includes a themed “Sign in with Blockstack” button
<p>When you are done, your imports should appear as follows:</p>
<div class="language-kotlin highlighter-rouge"><div class="highlight"><pre class="highlight"><code>
<div class="language-kotlin highlighter-rouge"><pre class="highlight"><code>
<span class="k">import</span> <span class="nn">android.support.v7.app.AppCompatActivity</span>
<span class="k">import</span> <span class="nn">android.os.Bundle</span>
@ -784,27 +795,29 @@ the SDK. This SDK includes a themed “Sign in with Blockstack” button
<span class="k">import</span> <span class="nn">org.blockstack.android.sdk.Scope</span>
<span class="k">import</span> <span class="nn">org.blockstack.android.sdk.UserData</span>
<span class="k">import</span> <span class="nn">java.net.URI</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Add a variable for the Blockstack session before <code class="highlighter-rouge">onCreate</code>.</p>
<div class="language-kotlin highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">class</span> <span class="nc">MainActivity</span> <span class="p">:</span> <span class="n">AppCompatActivity</span><span class="p">()</span> <span class="p">{</span>
<div class="language-kotlin highlighter-rouge"><pre class="highlight"><code><span class="kd">class</span> <span class="nc">MainActivity</span> <span class="p">:</span> <span class="n">AppCompatActivity</span><span class="p">()</span> <span class="p">{</span>
<span class="k">private</span> <span class="kd">var</span> <span class="py">_blockstackSession</span><span class="p">:</span> <span class="n">BlockstackSession</span><span class="p">?</span> <span class="p">=</span> <span class="k">null</span>
<span class="k">override</span> <span class="k">fun</span> <span class="nf">onCreate</span><span class="p">(</span><span class="nv">savedInstanceState</span><span class="p">:</span> <span class="nc">Bundle</span><span class="p">?)</span> <span class="p">{</span>
<span class="k">override</span> <span class="k">fun</span> <span class="nf">onCreate</span><span class="p">(</span><span class="n">savedInstanceState</span><span class="p">:</span> <span class="n">Bundle</span><span class="p">?)</span> <span class="p">{</span>
<span class="k">super</span><span class="p">.</span><span class="n">onCreate</span><span class="p">(</span><span class="n">savedInstanceState</span><span class="p">)</span>
<span class="n">setContentView</span><span class="p">(</span><span class="n">R</span><span class="p">.</span><span class="n">layout</span><span class="p">.</span><span class="n">activity_main</span><span class="p">)</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Replace the existing the <code class="highlighter-rouge">onCreate</code> function with the following:</p>
<div class="language-kotlin highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="k">override</span> <span class="k">fun</span> <span class="nf">onCreate</span><span class="p">(</span><span class="nv">savedInstanceState</span><span class="p">:</span> <span class="nc">Bundle</span><span class="p">?)</span> <span class="p">{</span>
<div class="language-kotlin highlighter-rouge"><pre class="highlight"><code> <span class="k">override</span> <span class="k">fun</span> <span class="nf">onCreate</span><span class="p">(</span><span class="n">savedInstanceState</span><span class="p">:</span> <span class="n">Bundle</span><span class="p">?)</span> <span class="p">{</span>
<span class="k">super</span><span class="p">.</span><span class="n">onCreate</span><span class="p">(</span><span class="n">savedInstanceState</span><span class="p">)</span>
<span class="n">setContentView</span><span class="p">(</span><span class="n">R</span><span class="p">.</span><span class="n">layout</span><span class="p">.</span><span class="n">activity_main</span><span class="p">)</span>
@ -829,7 +842,7 @@ the SDK. This SDK includes a themed “Sign in with Blockstack” button
<span class="p">})</span>
<span class="n">signInButton</span><span class="p">.</span><span class="n">setOnClickListener</span> <span class="p">{</span> <span class="nv">view</span><span class="p">:</span> <span class="nc">View</span> <span class="p">-&gt;</span>
<span class="n">signInButton</span><span class="p">.</span><span class="n">setOnClickListener</span> <span class="p">{</span> <span class="n">view</span><span class="p">:</span> <span class="n">View</span> <span class="p">-&gt;</span>
<span class="n">blockstackSession</span><span class="p">().</span><span class="n">redirectUserToSignIn</span> <span class="p">{</span> <span class="n">userData</span> <span class="p">-&gt;</span>
<span class="k">if</span> <span class="p">(</span><span class="n">userData</span><span class="p">.</span><span class="n">hasValue</span><span class="p">)</span> <span class="p">{</span>
<span class="n">runOnUiThread</span> <span class="p">{</span>
@ -839,11 +852,12 @@ the SDK. This SDK includes a themed “Sign in with Blockstack” button
<span class="p">}</span>
<span class="p">}</span>
<span class="k">if</span> <span class="p">(</span><span class="n">intent</span><span class="o">?.</span><span class="n">action</span> <span class="p">==</span> <span class="n">Intent</span><span class="p">.</span><span class="n">ACTION_VIEW</span><span class="p">)</span> <span class="p">{</span>
<span class="c1">// handle the redirect from sign in</span>
<span class="n">handleAuthResponse</span><span class="p">(</span><span class="n">intent</span><span class="p">)</span>
<span class="c1">// handle the redirect from sign in
</span> <span class="n">handleAuthResponse</span><span class="p">(</span><span class="n">intent</span><span class="p">)</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
<p>This new <code class="highlighter-rouge">onCreate</code> does several things:</p>
@ -863,13 +877,14 @@ the SDK. This SDK includes a themed “Sign in with Blockstack” button
<li>
<p>Add a private function to reflect when a user successfully signs in.</p>
<div class="language-kotlin highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="k">private</span> <span class="k">fun</span> <span class="nf">onSignIn</span><span class="p">(</span><span class="nv">userData</span><span class="p">:</span> <span class="nc">UserData</span><span class="p">)</span> <span class="p">{</span>
<div class="language-kotlin highlighter-rouge"><pre class="highlight"><code> <span class="k">private</span> <span class="k">fun</span> <span class="nf">onSignIn</span><span class="p">(</span><span class="n">userData</span><span class="p">:</span> <span class="n">UserData</span><span class="p">)</span> <span class="p">{</span>
<span class="n">userDataTextView</span><span class="p">.</span><span class="n">text</span> <span class="p">=</span> <span class="s">"Signed in as ${userData.decentralizedID}"</span>
<span class="n">signInButton</span><span class="p">.</span><span class="n">isEnabled</span> <span class="p">=</span> <span class="k">false</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Handle sign in requests with an <code class="highlighter-rouge">onNewIntent</code> function if the activity was already opened when signing in</p>
@ -877,19 +892,20 @@ the SDK. This SDK includes a themed “Sign in with Blockstack” button
<p>Retrieve the authentication token from the custom protocol handler call and
send it to the Blockstack session.</p>
<div class="language-kotlin highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="k">override</span> <span class="k">fun</span> <span class="nf">onNewIntent</span><span class="p">(</span><span class="nv">intent</span><span class="p">:</span> <span class="nc">Intent</span><span class="p">?)</span> <span class="p">{</span>
<div class="language-kotlin highlighter-rouge"><pre class="highlight"><code> <span class="k">override</span> <span class="k">fun</span> <span class="nf">onNewIntent</span><span class="p">(</span><span class="n">intent</span><span class="p">:</span> <span class="n">Intent</span><span class="p">?)</span> <span class="p">{</span>
<span class="k">super</span><span class="p">.</span><span class="n">onNewIntent</span><span class="p">(</span><span class="n">intent</span><span class="p">)</span>
<span class="k">if</span> <span class="p">(</span><span class="n">intent</span><span class="o">?.</span><span class="n">action</span> <span class="p">==</span> <span class="n">Intent</span><span class="p">.</span><span class="n">ACTION_VIEW</span><span class="p">)</span> <span class="p">{</span>
<span class="n">handleAuthResponse</span><span class="p">(</span><span class="n">intent</span><span class="p">)</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Create a handler for the authentication response.</p>
<div class="language-kotlin highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="k">private</span> <span class="k">fun</span> <span class="nf">handleAuthResponse</span><span class="p">(</span><span class="nv">intent</span><span class="p">:</span> <span class="nc">Intent</span><span class="p">)</span> <span class="p">{</span>
<div class="language-kotlin highlighter-rouge"><pre class="highlight"><code> <span class="k">private</span> <span class="k">fun</span> <span class="nf">handleAuthResponse</span><span class="p">(</span><span class="n">intent</span><span class="p">:</span> <span class="n">Intent</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">val</span> <span class="py">response</span> <span class="p">=</span> <span class="n">intent</span><span class="p">.</span><span class="n">dataString</span>
<span class="k">if</span> <span class="p">(</span><span class="n">response</span> <span class="p">!=</span> <span class="k">null</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">val</span> <span class="py">authResponseTokens</span> <span class="p">=</span> <span class="n">response</span><span class="p">.</span><span class="n">split</span><span class="p">(</span><span class="sc">':'</span><span class="p">)</span>
@ -899,8 +915,8 @@ the SDK. This SDK includes a themed “Sign in with Blockstack” button
<span class="n">blockstackSession</span><span class="p">().</span><span class="n">handlePendingSignIn</span><span class="p">(</span><span class="n">authResponse</span><span class="p">,</span> <span class="p">{</span> <span class="n">userData</span> <span class="p">-&gt;</span>
<span class="k">if</span> <span class="p">(</span><span class="n">userData</span><span class="p">.</span><span class="n">hasValue</span><span class="p">)</span> <span class="p">{</span>
<span class="c1">// The user is now signed in!</span>
<span class="n">runOnUiThread</span> <span class="p">{</span>
<span class="c1">// The user is now signed in!
</span> <span class="n">runOnUiThread</span> <span class="p">{</span>
<span class="n">onSignIn</span><span class="p">(</span><span class="n">userData</span><span class="p">.</span><span class="n">value</span><span class="o">!!</span><span class="p">)</span>
<span class="p">}</span>
<span class="p">}</span>
@ -908,12 +924,13 @@ the SDK. This SDK includes a themed “Sign in with Blockstack” button
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Add the convenience method to access the blockstack session.</p>
<div class="language-kotlin highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="k">fun</span> <span class="nf">blockstackSession</span><span class="p">()</span> <span class="p">:</span> <span class="nc">BlockstackSession</span> <span class="p">{</span>
<div class="language-kotlin highlighter-rouge"><pre class="highlight"><code> <span class="k">fun</span> <span class="nf">blockstackSession</span><span class="p">()</span> <span class="p">:</span> <span class="n">BlockstackSession</span> <span class="p">{</span>
<span class="kd">val</span> <span class="py">session</span> <span class="p">=</span> <span class="n">_blockstackSession</span>
<span class="k">if</span><span class="p">(</span><span class="n">session</span> <span class="p">!=</span> <span class="k">null</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="n">session</span>
@ -921,17 +938,18 @@ the SDK. This SDK includes a themed “Sign in with Blockstack” button
<span class="k">throw</span> <span class="n">IllegalStateException</span><span class="p">(</span><span class="s">"No session."</span><span class="p">)</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Verify your final <code class="highlighter-rouge">MainActivity.kt</code> code looks like this:</p>
<div class="language-kotlin highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="kd">class</span> <span class="nc">MainActivity</span> <span class="p">:</span> <span class="n">AppCompatActivity</span><span class="p">()</span> <span class="p">{</span>
<div class="language-kotlin highlighter-rouge"><pre class="highlight"><code> <span class="kd">class</span> <span class="nc">MainActivity</span> <span class="p">:</span> <span class="n">AppCompatActivity</span><span class="p">()</span> <span class="p">{</span>
<span class="k">private</span> <span class="kd">var</span> <span class="py">_blockstackSession</span><span class="p">:</span> <span class="n">BlockstackSession</span><span class="p">?</span> <span class="p">=</span> <span class="k">null</span>
<span class="k">override</span> <span class="k">fun</span> <span class="nf">onCreate</span><span class="p">(</span><span class="nv">savedInstanceState</span><span class="p">:</span> <span class="nc">Bundle</span><span class="p">?)</span> <span class="p">{</span>
<span class="k">override</span> <span class="k">fun</span> <span class="nf">onCreate</span><span class="p">(</span><span class="n">savedInstanceState</span><span class="p">:</span> <span class="n">Bundle</span><span class="p">?)</span> <span class="p">{</span>
<span class="k">super</span><span class="p">.</span><span class="n">onCreate</span><span class="p">(</span><span class="n">savedInstanceState</span><span class="p">)</span>
<span class="n">setContentView</span><span class="p">(</span><span class="n">R</span><span class="p">.</span><span class="n">layout</span><span class="p">.</span><span class="n">activity_main</span><span class="p">)</span>
@ -947,7 +965,7 @@ the SDK. This SDK includes a themed “Sign in with Blockstack” button
<span class="p">})</span>
<span class="n">signInButton</span><span class="p">.</span><span class="n">setOnClickListener</span> <span class="p">{</span> <span class="nv">view</span><span class="p">:</span> <span class="nc">View</span> <span class="p">-&gt;</span>
<span class="n">signInButton</span><span class="p">.</span><span class="n">setOnClickListener</span> <span class="p">{</span> <span class="n">view</span><span class="p">:</span> <span class="n">View</span> <span class="p">-&gt;</span>
<span class="n">blockstackSession</span><span class="p">().</span><span class="n">redirectUserToSignIn</span> <span class="p">{</span> <span class="n">userData</span> <span class="p">-&gt;</span>
<span class="k">if</span> <span class="p">(</span><span class="n">userData</span><span class="p">.</span><span class="n">hasValue</span><span class="p">)</span> <span class="p">{</span>
<span class="n">runOnUiThread</span> <span class="p">{</span>
@ -961,14 +979,14 @@ the SDK. This SDK includes a themed “Sign in with Blockstack” button
<span class="p">}</span>
<span class="p">}</span>
<span class="k">private</span> <span class="k">fun</span> <span class="nf">onSignIn</span><span class="p">(</span><span class="nv">userData</span><span class="p">:</span> <span class="nc">UserData</span><span class="p">)</span> <span class="p">{</span>
<span class="k">private</span> <span class="k">fun</span> <span class="nf">onSignIn</span><span class="p">(</span><span class="n">userData</span><span class="p">:</span> <span class="n">UserData</span><span class="p">)</span> <span class="p">{</span>
<span class="n">userDataTextView</span><span class="p">.</span><span class="n">text</span> <span class="p">=</span> <span class="s">"Signed in as ${userData.decentralizedID}"</span>
<span class="n">signInButton</span><span class="p">.</span><span class="n">isEnabled</span> <span class="p">=</span> <span class="k">false</span>
<span class="p">}</span>
<span class="k">override</span> <span class="k">fun</span> <span class="nf">onNewIntent</span><span class="p">(</span><span class="nv">intent</span><span class="p">:</span> <span class="nc">Intent</span><span class="p">?)</span> <span class="p">{</span>
<span class="k">override</span> <span class="k">fun</span> <span class="nf">onNewIntent</span><span class="p">(</span><span class="n">intent</span><span class="p">:</span> <span class="n">Intent</span><span class="p">?)</span> <span class="p">{</span>
<span class="k">super</span><span class="p">.</span><span class="n">onNewIntent</span><span class="p">(</span><span class="n">intent</span><span class="p">)</span>
<span class="k">if</span> <span class="p">(</span><span class="n">intent</span><span class="o">?.</span><span class="n">action</span> <span class="p">==</span> <span class="n">Intent</span><span class="p">.</span><span class="n">ACTION_VIEW</span><span class="p">)</span> <span class="p">{</span>
@ -976,7 +994,7 @@ the SDK. This SDK includes a themed “Sign in with Blockstack” button
<span class="p">}</span>
<span class="p">}</span>
<span class="k">private</span> <span class="k">fun</span> <span class="nf">handleAuthResponse</span><span class="p">(</span><span class="nv">intent</span><span class="p">:</span> <span class="nc">Intent</span><span class="p">)</span> <span class="p">{</span>
<span class="k">private</span> <span class="k">fun</span> <span class="nf">handleAuthResponse</span><span class="p">(</span><span class="n">intent</span><span class="p">:</span> <span class="n">Intent</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">val</span> <span class="py">response</span> <span class="p">=</span> <span class="n">intent</span><span class="p">.</span><span class="n">dataString</span>
<span class="k">if</span> <span class="p">(</span><span class="n">response</span> <span class="p">!=</span> <span class="k">null</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">val</span> <span class="py">authResponseTokens</span> <span class="p">=</span> <span class="n">response</span><span class="p">.</span><span class="n">split</span><span class="p">(</span><span class="sc">':'</span><span class="p">)</span>
@ -986,8 +1004,8 @@ the SDK. This SDK includes a themed “Sign in with Blockstack” button
<span class="n">blockstackSession</span><span class="p">().</span><span class="n">handlePendingSignIn</span><span class="p">(</span><span class="n">authResponse</span><span class="p">,</span> <span class="p">{</span> <span class="n">userData</span> <span class="p">-&gt;</span>
<span class="k">if</span> <span class="p">(</span><span class="n">userData</span><span class="p">.</span><span class="n">hasValue</span><span class="p">)</span> <span class="p">{</span>
<span class="c1">// The user is now signed in!</span>
<span class="n">runOnUiThread</span> <span class="p">{</span>
<span class="c1">// The user is now signed in!
</span> <span class="n">runOnUiThread</span> <span class="p">{</span>
<span class="n">onSignIn</span><span class="p">(</span><span class="n">userData</span><span class="p">.</span><span class="n">value</span><span class="o">!!</span><span class="p">)</span>
<span class="p">}</span>
<span class="p">}</span>
@ -996,7 +1014,7 @@ the SDK. This SDK includes a themed “Sign in with Blockstack” button
<span class="p">}</span>
<span class="p">}</span>
<span class="k">fun</span> <span class="nf">blockstackSession</span><span class="p">()</span> <span class="p">:</span> <span class="nc">BlockstackSession</span> <span class="p">{</span>
<span class="k">fun</span> <span class="nf">blockstackSession</span><span class="p">()</span> <span class="p">:</span> <span class="n">BlockstackSession</span> <span class="p">{</span>
<span class="kd">val</span> <span class="py">session</span> <span class="p">=</span> <span class="n">_blockstackSession</span>
<span class="k">if</span><span class="p">(</span><span class="n">session</span> <span class="p">!=</span> <span class="k">null</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="n">session</span>
@ -1007,7 +1025,8 @@ the SDK. This SDK includes a themed “Sign in with Blockstack” button
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
</ol>

238
_site/browser/blockstack_storage.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Blockstack Storage Tutorial | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Blockstack Storage Tutorial" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/browser/blockstack_storage.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/browser/blockstack_storage.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Blockstack Storage Tutorial","dateModified":"2018-10-17T09:26:44-07:00","description":"Blockstack Storage Tutorial","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/browser/blockstack_storage.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/browser/blockstack_storage.html","headline":"Blockstack Storage Tutorial","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/browser/blockstack_storage.html"},"description":"Blockstack Storage Tutorial","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -195,13 +195,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-browser/blob/master/docs/blockstack_storage.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>
@ -259,9 +259,10 @@ the application, you need to have already <a href="ids-introduction">registered
<p>The tutorial relies on the <code class="highlighter-rouge">npm</code> dependency manager. Before you begin, verify
you have installed <code class="highlighter-rouge">npm</code> using the <code class="highlighter-rouge">which</code> command.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>which npm
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>which npm
/usr/local/bin/npm
</code></pre></div></div>
</code></pre>
</div>
<p>If you don’t find <code class="highlighter-rouge">npm</code> in your system, <a href="https://www.npmjs.com/get-npm">install
it</a>. Finally, if you get stuck at any point
@ -278,14 +279,16 @@ existing projects.</p>
<li>
<p>Install Yeoman.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> npm <span class="nb">install</span> <span class="nt">-g</span> yo
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> npm install -g yo
</code></pre>
</div>
</li>
<li>
<p>Install the Blockstack application generator.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> npm <span class="nb">install</span> <span class="nt">-g</span> generator-blockstack
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> npm install -g generator-blockstack
</code></pre>
</div>
</li>
</ol>
@ -299,24 +302,27 @@ existing projects.</p>
<li>
<p>Create a the <code class="highlighter-rouge">publik</code> directory.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nb">mkdir </span>publik
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> mkdir publik
</code></pre>
</div>
</li>
<li>
<p>Change into your new directory.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nb">cd </span>publik
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nb">cd </span>publik
</code></pre>
</div>
</li>
<li>
<p>Use Yeoman and the Blockstack application generator to create your initial <code class="highlighter-rouge">publik</code> application.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> yo blockstack:react
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> yo blockstack:react
</code></pre>
</div>
<p>You should see several interactive prompts.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nv">$ </span>yo blockstack:react
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nv">$ </span>yo blockstack:react
? <span class="o">==========================================================================</span>
We<span class="s1">'re constantly looking for ways to make yo better!
May we anonymously report usage statistics to improve the tool over time?
@ -334,24 +340,27 @@ existing projects.</p>
´ ` |° ´ Y `
? Are you ready to build a Blockstack app in React? (Y/n)
</span></code></pre></div> </div>
</span></code></pre>
</div>
</li>
<li>
<p>Respond to the prompts to populate the initial app.</p>
<p>After the process completes successfully, you see a prompt similar to the following:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="o">[</span>fsevents] Success:
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="o">[</span>fsevents] Success:
<span class="s2">"/Users/theuser/repos/publik/node_modules/fsevents/lib/binding/Release/node-v59-darwin-x64/fse.node"</span>
is installed via remote npm notice created a lockfile as package-lock.json.
You should commit this file. added 1060 packages <span class="k">in </span>26.901s
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Run the initial application.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> npm start
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> npm start
</code></pre>
</div>
<p>The system prompts you to accept incoming connections.</p>
@ -395,21 +404,23 @@ stored on Gaia are made visible to others via the <code class="highlighter-rouge
<li>
<p>Locate the <code class="highlighter-rouge">handleSignIn</code> handler method.</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">handleSignIn</span><span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">handleSignIn</span><span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">e</span><span class="p">.</span><span class="nx">preventDefault</span><span class="p">();</span>
<span class="nx">redirectToSignIn</span><span class="p">();</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Modify the method to this:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">handleSignIn</span><span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">handleSignIn</span><span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">e</span><span class="p">.</span><span class="nx">preventDefault</span><span class="p">();</span>
<span class="kd">const</span> <span class="nx">origin</span> <span class="o">=</span> <span class="nb">window</span><span class="p">.</span><span class="nx">location</span><span class="p">.</span><span class="nx">origin</span>
<span class="kr">const</span> <span class="nx">origin</span> <span class="o">=</span> <span class="nb">window</span><span class="p">.</span><span class="nx">location</span><span class="p">.</span><span class="nx">origin</span>
<span class="nx">redirectToSignIn</span><span class="p">(</span><span class="nx">origin</span><span class="p">,</span> <span class="nx">origin</span> <span class="o">+</span> <span class="s1">'/manifest.json'</span><span class="p">,</span> <span class="p">[</span><span class="s1">'store_write'</span><span class="p">,</span> <span class="s1">'publish_data'</span><span class="p">])</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
<p>By default, authentication requests include the <code class="highlighter-rouge">store_write</code> scope which
enables storage. This is what allows you to store information to Gaia.</p>
@ -443,17 +454,18 @@ delete grocery lists.</p>
<p>A single file collection stores items as an array nested inside each grocery
list:</p>
<div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// grocerylists.json</span>
<div class="language-js highlighter-rouge"><pre class="highlight"><code><span class="c1">// grocerylists.json</span>
<span class="p">{</span>
<span class="s2">"3255"</span><span class="p">:</span> <span class="p">{</span>
<span class="s2">"items"</span><span class="p">:</span> <span class="p">[</span>
<span class="s2">"3255"</span><span class="err">:</span> <span class="p">{</span>
<span class="s2">"items"</span><span class="err">:</span> <span class="p">[</span>
<span class="s2">"1 Head of Lettuce"</span><span class="p">,</span>
<span class="s2">"Haralson apples"</span>
<span class="p">]</span>
<span class="p">},</span>
<span class="c1">// ...more lists with items</span>
<span class="p">}</span>
</code></pre></div></div>
</code></pre>
</div>
<p>This is conceptually the simplest way to manage grocery lists. When you read a
<code class="highlighter-rouge">/grocerylists.json</code> file with <code class="highlighter-rouge">getFile()</code>, you get back one or more grocery
@ -492,26 +504,28 @@ or remove a grocery list; updating a list has no impact.</p>
<p>The <code class="highlighter-rouge">Person</code> object holds a Blockstack profile. Add <code class="highlighter-rouge">putFile</code>, <code class="highlighter-rouge">getFile</code>,
and <code class="highlighter-rouge">lookupProfile</code> after <code class="highlighter-rouge">Person</code>.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> When you are done, the import statement should look like the following:
</code></pre></div> </div>
<div class="highlighter-rouge"><pre class="highlight"><code> When you are done, the import statement should look like the following:
</code></pre>
</div>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="k">import</span> <span class="p">{</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="kr">import</span> <span class="p">{</span>
<span class="nx">isSignInPending</span><span class="p">,</span>
<span class="nx">loadUserData</span><span class="p">,</span>
<span class="nx">Person</span><span class="p">,</span>
<span class="nx">getFile</span><span class="p">,</span>
<span class="nx">putFile</span><span class="p">,</span>
<span class="nx">lookupProfile</span>
<span class="p">}</span> <span class="k">from</span> <span class="s1">'blockstack'</span><span class="p">;</span>
</code></pre></div> </div>
<span class="p">}</span> <span class="nx">from</span> <span class="s1">'blockstack'</span><span class="p">;</span>
</code></pre>
</div>
</li>
<li>
<p>Replace the <code class="highlighter-rouge">constructor()</code> initial state so that it holds the key properties required by the app.</p>
<p>This code constructs a Blockstack <code class="highlighter-rouge">Person</code> object to hold the profile. Your constructor should look like this:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="kd">constructor</span><span class="p">(</span><span class="nx">props</span><span class="p">)</span> <span class="p">{</span>
<span class="k">super</span><span class="p">(</span><span class="nx">props</span><span class="p">);</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">constructor</span><span class="p">(</span><span class="nx">props</span><span class="p">)</span> <span class="p">{</span>
<span class="kr">super</span><span class="p">(</span><span class="nx">props</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">state</span> <span class="o">=</span> <span class="p">{</span>
<span class="na">person</span><span class="p">:</span> <span class="p">{</span>
@ -529,7 +543,8 @@ or remove a grocery list; updating a list has no impact.</p>
<span class="na">isLoading</span><span class="p">:</span> <span class="kc">false</span>
<span class="p">};</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>Locate the <code class="highlighter-rouge">render()</code> method.</li>
<li>
@ -538,10 +553,10 @@ or remove a grocery list; updating a list has no impact.</p>
<p>The following code echos the <code class="highlighter-rouge">person.name</code> and <code class="highlighter-rouge">person.avatarURL</code>
properties from the profile on the display:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">render</span><span class="p">()</span> <span class="p">{</span>
<span class="kd">const</span> <span class="p">{</span> <span class="nx">handleSignOut</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">props</span><span class="p">;</span>
<span class="kd">const</span> <span class="p">{</span> <span class="nx">person</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">;</span>
<span class="kd">const</span> <span class="p">{</span> <span class="nx">username</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">;</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">render</span><span class="p">()</span> <span class="p">{</span>
<span class="kr">const</span> <span class="p">{</span> <span class="nx">handleSignOut</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">props</span><span class="p">;</span>
<span class="kr">const</span> <span class="p">{</span> <span class="nx">person</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">;</span>
<span class="kr">const</span> <span class="p">{</span> <span class="nx">username</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">;</span>
<span class="k">return</span> <span class="p">(</span>
<span class="o">!</span><span class="nx">isSignInPending</span><span class="p">()</span> <span class="o">&amp;&amp;</span> <span class="nx">person</span> <span class="p">?</span>
@ -554,8 +569,8 @@ or remove a grocery list; updating a list has no impact.</p>
<span class="nx">src</span><span class="o">=</span><span class="p">{</span> <span class="nx">person</span><span class="p">.</span><span class="nx">avatarUrl</span><span class="p">()</span> <span class="p">?</span> <span class="nx">person</span><span class="p">.</span><span class="nx">avatarUrl</span><span class="p">()</span> <span class="p">:</span> <span class="nx">avatarFallbackImage</span> <span class="p">}</span>
<span class="nx">className</span><span class="o">=</span><span class="s2">"img-rounded avatar"</span>
<span class="nx">id</span><span class="o">=</span><span class="s2">"avatar-image"</span>
<span class="o">/&gt;</span>
<span class="o">&lt;</span><span class="nx">div</span> <span class="nx">className</span><span class="o">=</span><span class="s2">"username"</span><span class="o">&gt;</span>
<span class="sr">/</span><span class="err">&gt;
</span> <span class="o">&lt;</span><span class="nx">div</span> <span class="nx">className</span><span class="o">=</span><span class="s2">"username"</span><span class="o">&gt;</span>
<span class="o">&lt;</span><span class="nx">h1</span><span class="o">&gt;</span>
<span class="o">&lt;</span><span class="nx">span</span> <span class="nx">id</span><span class="o">=</span><span class="s2">"heading-name"</span><span class="o">&gt;</span><span class="p">{</span> <span class="nx">person</span><span class="p">.</span><span class="nx">name</span><span class="p">()</span> <span class="p">?</span> <span class="nx">person</span><span class="p">.</span><span class="nx">name</span><span class="p">()</span>
<span class="p">:</span> <span class="s1">'Nameless Person'</span> <span class="p">}</span><span class="o">&lt;</span><span class="sr">/span</span><span class="err">&gt;
@ -575,8 +590,8 @@ or remove a grocery list; updating a list has no impact.</p>
<span class="nx">value</span><span class="o">=</span><span class="p">{</span><span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">.</span><span class="nx">newStatus</span><span class="p">}</span>
<span class="nx">onChange</span><span class="o">=</span><span class="p">{</span><span class="nx">e</span> <span class="o">=&gt;</span> <span class="k">this</span><span class="p">.</span><span class="nx">handleNewStatusChange</span><span class="p">(</span><span class="nx">e</span><span class="p">)}</span>
<span class="nx">placeholder</span><span class="o">=</span><span class="s2">"Enter a status"</span>
<span class="o">/&gt;</span>
<span class="o">&lt;</span><span class="sr">/div</span><span class="err">&gt;
<span class="sr">/</span><span class="err">&gt;
</span> <span class="o">&lt;</span><span class="sr">/div</span><span class="err">&gt;
</span> <span class="o">&lt;</span><span class="nx">div</span> <span class="nx">className</span><span class="o">=</span><span class="s2">"col-md-12"</span><span class="o">&gt;</span>
<span class="o">&lt;</span><span class="nx">button</span>
<span class="nx">className</span><span class="o">=</span><span class="s2">"btn btn-primary btn-lg"</span>
@ -592,7 +607,8 @@ or remove a grocery list; updating a list has no impact.</p>
</span> <span class="o">&lt;</span><span class="sr">/div&gt; : nul</span><span class="err">l
</span> <span class="p">);</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
<p>This code allows the application to post statuses. It also displays the
user’s Blockstack ID. To display this, your app must extract the ID from the
@ -604,18 +620,19 @@ user profile data.</p>
<p>You’ll use the Blockstack <code class="highlighter-rouge">loadUserData()</code> method to access the <code class="highlighter-rouge">username</code>.</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">componentWillMount</span><span class="p">()</span> <span class="p">{</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">componentWillMount</span><span class="p">()</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">setState</span><span class="p">({</span>
<span class="na">person</span><span class="p">:</span> <span class="k">new</span> <span class="nx">Person</span><span class="p">(</span><span class="nx">loadUserData</span><span class="p">().</span><span class="nx">profile</span><span class="p">),</span>
<span class="na">username</span><span class="p">:</span> <span class="nx">loadUserData</span><span class="p">().</span><span class="nx">username</span>
<span class="p">});</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Add two methods to handle the status input events:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">handleNewStatusChange</span><span class="p">(</span><span class="nx">event</span><span class="p">)</span> <span class="p">{</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">handleNewStatusChange</span><span class="p">(</span><span class="nx">event</span><span class="p">)</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">setState</span><span class="p">({</span><span class="na">newStatus</span><span class="p">:</span> <span class="nx">event</span><span class="p">.</span><span class="nx">target</span><span class="p">.</span><span class="nx">value</span><span class="p">})</span>
<span class="p">}</span>
@ -625,12 +642,13 @@ user profile data.</p>
<span class="na">newStatus</span><span class="p">:</span> <span class="s2">""</span>
<span class="p">})</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Add a <code class="highlighter-rouge">saveNewStatus()</code> method to save the new statuses.</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">saveNewStatus</span><span class="p">(</span><span class="nx">statusText</span><span class="p">)</span> <span class="p">{</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">saveNewStatus</span><span class="p">(</span><span class="nx">statusText</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">let</span> <span class="nx">statuses</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">.</span><span class="nx">statuses</span>
<span class="kd">let</span> <span class="nx">status</span> <span class="o">=</span> <span class="p">{</span>
@ -640,7 +658,7 @@ user profile data.</p>
<span class="p">}</span>
<span class="nx">statuses</span><span class="p">.</span><span class="nx">unshift</span><span class="p">(</span><span class="nx">status</span><span class="p">)</span>
<span class="kd">const</span> <span class="nx">options</span> <span class="o">=</span> <span class="p">{</span> <span class="na">encrypt</span><span class="p">:</span> <span class="kc">false</span> <span class="p">}</span>
<span class="kr">const</span> <span class="nx">options</span> <span class="o">=</span> <span class="p">{</span> <span class="na">encrypt</span><span class="p">:</span> <span class="kc">false</span> <span class="p">}</span>
<span class="nx">putFile</span><span class="p">(</span><span class="s1">'statuses.json'</span><span class="p">,</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">stringify</span><span class="p">(</span><span class="nx">statuses</span><span class="p">),</span> <span class="nx">options</span><span class="p">)</span>
<span class="p">.</span><span class="nx">then</span><span class="p">(()</span> <span class="o">=&gt;</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">setState</span><span class="p">({</span>
@ -648,7 +666,8 @@ user profile data.</p>
<span class="p">})</span>
<span class="p">})</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Save the <code class="highlighter-rouge">Profile.jsk</code> file.</p>
@ -675,7 +694,7 @@ the statuses back to the user as a blog entry.</p>
<li>
<p>Right after this opening <code class="highlighter-rouge">div</code> element, add this block.</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="o">&lt;</span><span class="nx">div</span> <span class="nx">className</span><span class="o">=</span><span class="s2">"col-md-12 statuses"</span><span class="o">&gt;</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="o">&lt;</span><span class="nx">div</span> <span class="nx">className</span><span class="o">=</span><span class="s2">"col-md-12 statuses"</span><span class="o">&gt;</span>
<span class="p">{</span><span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">.</span><span class="nx">isLoading</span> <span class="o">&amp;&amp;</span> <span class="o">&lt;</span><span class="nx">span</span><span class="o">&gt;</span><span class="nx">Loading</span><span class="p">...</span><span class="o">&lt;</span><span class="sr">/span&gt;</span><span class="err">}
</span> <span class="p">{</span><span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">.</span><span class="nx">statuses</span><span class="p">.</span><span class="nx">map</span><span class="p">((</span><span class="nx">status</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">(</span>
<span class="o">&lt;</span><span class="nx">div</span> <span class="nx">className</span><span class="o">=</span><span class="s2">"status"</span> <span class="nx">key</span><span class="o">=</span><span class="p">{</span><span class="nx">status</span><span class="p">.</span><span class="nx">id</span><span class="p">}</span><span class="o">&gt;</span>
@ -684,16 +703,17 @@ the statuses back to the user as a blog entry.</p>
</span> <span class="p">)</span>
<span class="p">)}</span>
<span class="o">&lt;</span><span class="sr">/div</span><span class="err">&gt;
</span></code></pre></div> </div>
</span></code></pre>
</div>
<p>This loads existing state. Your code needs to fetch statuses on page load.</p>
</li>
<li>
<p>Add a new method called <code class="highlighter-rouge">fetchData()</code> after the <code class="highlighter-rouge">statuses.unshift(status)</code> section.</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code>
<span class="nx">fetchData</span><span class="p">()</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">setState</span><span class="p">({</span> <span class="na">isLoading</span><span class="p">:</span> <span class="kc">true</span> <span class="p">})</span>
<span class="kd">const</span> <span class="nx">options</span> <span class="o">=</span> <span class="p">{</span> <span class="na">decrypt</span><span class="p">:</span> <span class="kc">false</span> <span class="p">}</span>
<span class="kr">const</span> <span class="nx">options</span> <span class="o">=</span> <span class="p">{</span> <span class="na">decrypt</span><span class="p">:</span> <span class="kc">false</span> <span class="p">}</span>
<span class="nx">getFile</span><span class="p">(</span><span class="s1">'statuses.json'</span><span class="p">,</span> <span class="nx">options</span><span class="p">)</span>
<span class="p">.</span><span class="nx">then</span><span class="p">((</span><span class="nx">file</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">statuses</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">file</span> <span class="o">||</span> <span class="s1">'[]'</span><span class="p">)</span>
@ -708,16 +728,18 @@ the statuses back to the user as a blog entry.</p>
<span class="k">this</span><span class="p">.</span><span class="nx">setState</span><span class="p">({</span> <span class="na">isLoading</span><span class="p">:</span> <span class="kc">false</span> <span class="p">})</span>
<span class="p">})</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Call <code class="highlighter-rouge">fetchData()</code> from the <code class="highlighter-rouge">componentDidMount()</code> method</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code>
<span class="nx">componentDidMount</span><span class="p">()</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">fetchData</span><span class="p">()</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Save the file.</p>
@ -736,7 +758,7 @@ the statuses back to the user as a blog entry.</p>
<li>
<p>Replace the content with the following:</p>
<div class="language-css highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="c">/* Globals */</span>
<div class="language-css highlighter-rouge"><pre class="highlight"><code> <span class="c">/* Globals */</span>
<span class="nt">a</span><span class="o">,</span><span class="nt">a</span><span class="nd">:focus</span><span class="o">,</span><span class="nt">a</span><span class="nd">:hover</span><span class="p">{</span><span class="nl">color</span><span class="p">:</span><span class="m">#fff</span><span class="p">;}</span>
<span class="nt">html</span><span class="o">,</span><span class="nt">body</span><span class="p">{</span><span class="nl">height</span><span class="p">:</span><span class="m">100%</span><span class="p">;</span><span class="nl">text-align</span><span class="p">:</span><span class="nb">center</span><span class="p">;</span><span class="nl">background-color</span><span class="p">:</span><span class="m">#191b22</span><span class="p">;}</span>
<span class="nt">body</span><span class="p">{</span><span class="nl">color</span><span class="p">:</span><span class="m">#fff</span><span class="p">}</span>
@ -771,7 +793,8 @@ the statuses back to the user as a blog entry.</p>
<span class="c">/* Statuses */</span>
<span class="nc">.statuses</span><span class="p">{</span><span class="nl">padding-top</span><span class="p">:</span><span class="m">30px</span><span class="p">;}</span>
<span class="nc">.status</span><span class="p">{</span><span class="nl">margin</span><span class="p">:</span><span class="m">15px</span> <span class="m">0px</span><span class="p">;</span><span class="nl">padding</span><span class="p">:</span><span class="m">20px</span><span class="p">;</span><span class="nl">background-color</span><span class="p">:</span><span class="m">#2e2e2e</span><span class="p">;</span><span class="nl">border-radius</span><span class="p">:</span><span class="m">6px</span><span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Save and close the <code class="highlighter-rouge">src/styles/style.css</code> file.</p>
@ -803,44 +826,49 @@ other users’ profiles by visiting <code class="highlighter-rouge">http://local
<li>
<p>Install <code class="highlighter-rouge">react-router</code>:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> npm <span class="nb">install</span> <span class="nt">--save</span> react-router-dom
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> npm install --save react-router-dom
</code></pre>
</div>
</li>
<li>Edit <code class="highlighter-rouge">src/index.js</code> file.</li>
<li>
<p>Add an <code class="highlighter-rouge">import</code> to the file at the top:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="k">import</span> <span class="p">{</span> <span class="nx">BrowserRouter</span> <span class="p">}</span> <span class="k">from</span> <span class="s1">'react-router-dom'</span>
</code></pre></div> </div>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="kr">import</span> <span class="p">{</span> <span class="nx">BrowserRouter</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'react-router-dom'</span>
</code></pre>
</div>
</li>
<li>
<p>Change the <code class="highlighter-rouge">ReactDOM.render()</code> method in <code class="highlighter-rouge">src/index.js</code> to:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">ReactDOM</span><span class="p">.</span><span class="nx">render</span><span class="p">((</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">ReactDOM</span><span class="p">.</span><span class="nx">render</span><span class="p">((</span>
<span class="o">&lt;</span><span class="nx">BrowserRouter</span><span class="o">&gt;</span>
<span class="o">&lt;</span><span class="nx">App</span> <span class="o">/&gt;</span>
<span class="o">&lt;</span><span class="sr">/BrowserRouter</span><span class="err">&gt;
</span> <span class="p">),</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s1">'root'</span><span class="p">));</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>Save and close the <code class="highlighter-rouge">src/index.js</code> file.</li>
<li>Edit the <code class="highlighter-rouge">src/components/App.jsx</code> file.</li>
<li>
<p>Add the new route by importing the <code class="highlighter-rouge">Switch</code> and <code class="highlighter-rouge">Route</code> components from <code class="highlighter-rouge">react-router-dom</code>:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="k">import</span> <span class="p">{</span> <span class="nx">Switch</span><span class="p">,</span> <span class="nx">Route</span> <span class="p">}</span> <span class="k">from</span> <span class="s1">'react-router-dom'</span>
</code></pre></div> </div>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="kr">import</span> <span class="p">{</span> <span class="nx">Switch</span><span class="p">,</span> <span class="nx">Route</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'react-router-dom'</span>
</code></pre>
</div>
</li>
<li>
<p>Locate this line below in the <code class="highlighter-rouge">render()</code> method:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="p">:</span> <span class="o">&lt;</span><span class="nx">Profile</span> <span class="nx">handleSignOut</span><span class="o">=</span><span class="p">{</span> <span class="k">this</span><span class="p">.</span><span class="nx">handleSignOut</span> <span class="p">}</span> <span class="sr">/</span><span class="err">&gt;
</span></code></pre></div> </div>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="err">:</span> <span class="o">&lt;</span><span class="nx">Profile</span> <span class="nx">handleSignOut</span><span class="o">=</span><span class="p">{</span> <span class="k">this</span><span class="p">.</span><span class="nx">handleSignOut</span> <span class="p">}</span> <span class="sr">/</span><span class="err">&gt;
</span></code></pre>
</div>
</li>
<li>
<p>Replace it with the following:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="p">:</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="err">:</span>
<span class="o">&lt;</span><span class="nx">Switch</span><span class="o">&gt;</span>
<span class="o">&lt;</span><span class="nx">Route</span>
<span class="nx">path</span><span class="o">=</span><span class="s1">'/:username?'</span>
@ -849,7 +877,8 @@ other users’ profiles by visiting <code class="highlighter-rouge">http://local
</span> <span class="p">}</span>
<span class="sr">/</span><span class="err">&gt;
</span> <span class="o">&lt;</span><span class="sr">/Switch</span><span class="err">&gt;
</span></code></pre></div> </div>
</span></code></pre>
</div>
<p>This sets up a route and captures the route parameter the app will use as the profile lookup username.</p>
</li>
@ -868,16 +897,18 @@ process URL paths that contain the <code class="highlighter-rouge">.</code> (dot
<li>
<p>Open <code class="highlighter-rouge">webpack.config.js</code> in the root project directory and locate the following line:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">historyApiFallback</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</code></pre></div> </div>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">historyApiFallback</span><span class="err">:</span> <span class="kc">true</span><span class="p">,</span>
</code></pre>
</div>
</li>
<li>
<p>Replace it with this:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">historyApiFallback</span><span class="p">:</span> <span class="p">{</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">historyApiFallback</span><span class="err">:</span> <span class="p">{</span>
<span class="nl">disableDotRule</span><span class="p">:</span> <span class="kc">true</span>
<span class="p">},</span>
</code></pre></div> </div>
</code></pre>
</div>
<p>You will need to run <code class="highlighter-rouge">npm start</code> again for this change to take effect. Don’t
worry, there is a later step for that to remind you.</p>
@ -889,20 +920,21 @@ process URL paths that contain the <code class="highlighter-rouge">.</code> (dot
<li>
<p>Add a single method that determines if the app is viewing the local user’s profile or another user’s profile.</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">isLocal</span><span class="p">()</span> <span class="p">{</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">isLocal</span><span class="p">()</span> <span class="p">{</span>
<span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">props</span><span class="p">.</span><span class="nx">match</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">username</span> <span class="p">?</span> <span class="kc">false</span> <span class="p">:</span> <span class="kc">true</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
<p>You use <code class="highlighter-rouge">isLocal()</code> to check if the user is viewing the local user profile or another user’s profile. If it’s the local user profile, the app runs the <code class="highlighter-rouge">getFile()</code> function you added in an earlier step. Otherwise, the app looks up the profile belonging to the <code class="highlighter-rouge">username</code> using the <code class="highlighter-rouge">lookupProfile()</code> method.</p>
</li>
<li>
<p>Modify the <code class="highlighter-rouge">fetchData()</code> method like so:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">fetchData</span><span class="p">()</span> <span class="p">{</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">fetchData</span><span class="p">()</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">setState</span><span class="p">({</span> <span class="na">isLoading</span><span class="p">:</span> <span class="kc">true</span> <span class="p">})</span>
<span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">isLocal</span><span class="p">())</span> <span class="p">{</span>
<span class="kd">const</span> <span class="nx">options</span> <span class="o">=</span> <span class="p">{</span> <span class="na">decrypt</span><span class="p">:</span> <span class="kc">false</span> <span class="p">}</span>
<span class="kr">const</span> <span class="nx">options</span> <span class="o">=</span> <span class="p">{</span> <span class="na">decrypt</span><span class="p">:</span> <span class="kc">false</span> <span class="p">}</span>
<span class="nx">getFile</span><span class="p">(</span><span class="s1">'statuses.json'</span><span class="p">,</span> <span class="nx">options</span><span class="p">)</span>
<span class="p">.</span><span class="nx">then</span><span class="p">((</span><span class="nx">file</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">statuses</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">file</span> <span class="o">||</span> <span class="s1">'[]'</span><span class="p">)</span>
@ -917,7 +949,7 @@ process URL paths that contain the <code class="highlighter-rouge">.</code> (dot
<span class="k">this</span><span class="p">.</span><span class="nx">setState</span><span class="p">({</span> <span class="na">isLoading</span><span class="p">:</span> <span class="kc">false</span> <span class="p">})</span>
<span class="p">})</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
<span class="kd">const</span> <span class="nx">username</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">props</span><span class="p">.</span><span class="nx">match</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">username</span>
<span class="kr">const</span> <span class="nx">username</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">props</span><span class="p">.</span><span class="nx">match</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">username</span>
<span class="nx">lookupProfile</span><span class="p">(</span><span class="nx">username</span><span class="p">)</span>
<span class="p">.</span><span class="nx">then</span><span class="p">((</span><span class="nx">profile</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
@ -931,7 +963,8 @@ process URL paths that contain the <code class="highlighter-rouge">.</code> (dot
<span class="p">})</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
<p><strong>NOTE</strong>: For <code class="highlighter-rouge">https</code> deployments, the default Blockstack Core API endpoint for name
lookups should be changed to point to a core API served over <code class="highlighter-rouge">https</code>.
@ -943,7 +976,7 @@ process URL paths that contain the <code class="highlighter-rouge">.</code> (dot
<li>
<p>Add the following block to <code class="highlighter-rouge">fetchData()</code> right after the call to <code class="highlighter-rouge">lookupProfile(username)... catch((error)=&gt;{..}</code> block:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="kd">const</span> <span class="nx">options</span> <span class="o">=</span> <span class="p">{</span> <span class="na">username</span><span class="p">:</span> <span class="nx">username</span><span class="p">,</span> <span class="na">decrypt</span><span class="p">:</span> <span class="kc">false</span> <span class="p">}</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="kr">const</span> <span class="nx">options</span> <span class="o">=</span> <span class="p">{</span> <span class="na">username</span><span class="p">:</span> <span class="nx">username</span><span class="p">,</span> <span class="na">decrypt</span><span class="p">:</span> <span class="kc">false</span> <span class="p">}</span>
<span class="nx">getFile</span><span class="p">(</span><span class="s1">'statuses.json'</span><span class="p">,</span> <span class="nx">options</span><span class="p">)</span>
<span class="p">.</span><span class="nx">then</span><span class="p">((</span><span class="nx">file</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">statuses</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">file</span> <span class="o">||</span> <span class="s1">'[]'</span><span class="p">)</span>
@ -958,7 +991,8 @@ process URL paths that contain the <code class="highlighter-rouge">.</code> (dot
<span class="p">.</span><span class="k">finally</span><span class="p">(()</span> <span class="o">=&gt;</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">setState</span><span class="p">({</span> <span class="na">isLoading</span><span class="p">:</span> <span class="kc">false</span> <span class="p">})</span>
<span class="p">})</span>
</code></pre></div> </div>
</code></pre>
</div>
<p>This fetches the user statuses.</p>
@ -967,10 +1001,10 @@ process URL paths that contain the <code class="highlighter-rouge">.</code> (dot
<li>
<p>Replace the <code class="highlighter-rouge">render()</code> method with the following:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">render</span><span class="p">()</span> <span class="p">{</span>
<span class="kd">const</span> <span class="p">{</span> <span class="nx">handleSignOut</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">props</span><span class="p">;</span>
<span class="kd">const</span> <span class="p">{</span> <span class="nx">person</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">;</span>
<span class="kd">const</span> <span class="p">{</span> <span class="nx">username</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">;</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">render</span><span class="p">()</span> <span class="p">{</span>
<span class="kr">const</span> <span class="p">{</span> <span class="nx">handleSignOut</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">props</span><span class="p">;</span>
<span class="kr">const</span> <span class="p">{</span> <span class="nx">person</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">;</span>
<span class="kr">const</span> <span class="p">{</span> <span class="nx">username</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">;</span>
<span class="k">return</span> <span class="p">(</span>
<span class="o">!</span><span class="nx">isSignInPending</span><span class="p">()</span> <span class="o">&amp;&amp;</span> <span class="nx">person</span> <span class="p">?</span>
@ -983,8 +1017,8 @@ process URL paths that contain the <code class="highlighter-rouge">.</code> (dot
<span class="nx">src</span><span class="o">=</span><span class="p">{</span> <span class="nx">person</span><span class="p">.</span><span class="nx">avatarUrl</span><span class="p">()</span> <span class="p">?</span> <span class="nx">person</span><span class="p">.</span><span class="nx">avatarUrl</span><span class="p">()</span> <span class="p">:</span> <span class="nx">avatarFallbackImage</span> <span class="p">}</span>
<span class="nx">className</span><span class="o">=</span><span class="s2">"img-rounded avatar"</span>
<span class="nx">id</span><span class="o">=</span><span class="s2">"avatar-image"</span>
<span class="o">/&gt;</span>
<span class="o">&lt;</span><span class="nx">div</span> <span class="nx">className</span><span class="o">=</span><span class="s2">"username"</span><span class="o">&gt;</span>
<span class="sr">/</span><span class="err">&gt;
</span> <span class="o">&lt;</span><span class="nx">div</span> <span class="nx">className</span><span class="o">=</span><span class="s2">"username"</span><span class="o">&gt;</span>
<span class="o">&lt;</span><span class="nx">h1</span><span class="o">&gt;</span>
<span class="o">&lt;</span><span class="nx">span</span> <span class="nx">id</span><span class="o">=</span><span class="s2">"heading-name"</span><span class="o">&gt;</span><span class="p">{</span> <span class="nx">person</span><span class="p">.</span><span class="nx">name</span><span class="p">()</span> <span class="p">?</span> <span class="nx">person</span><span class="p">.</span><span class="nx">name</span><span class="p">()</span>
<span class="p">:</span> <span class="s1">'Nameless Person'</span> <span class="p">}</span><span class="o">&lt;</span><span class="sr">/span</span><span class="err">&gt;
@ -1006,8 +1040,8 @@ process URL paths that contain the <code class="highlighter-rouge">.</code> (dot
<span class="nx">value</span><span class="o">=</span><span class="p">{</span><span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">.</span><span class="nx">newStatus</span><span class="p">}</span>
<span class="nx">onChange</span><span class="o">=</span><span class="p">{</span><span class="nx">e</span> <span class="o">=&gt;</span> <span class="k">this</span><span class="p">.</span><span class="nx">handleNewStatusChange</span><span class="p">(</span><span class="nx">e</span><span class="p">)}</span>
<span class="nx">placeholder</span><span class="o">=</span><span class="s2">"What's on your mind?"</span>
<span class="o">/&gt;</span>
<span class="o">&lt;</span><span class="sr">/div</span><span class="err">&gt;
<span class="sr">/</span><span class="err">&gt;
</span> <span class="o">&lt;</span><span class="sr">/div</span><span class="err">&gt;
</span> <span class="o">&lt;</span><span class="nx">div</span> <span class="nx">className</span><span class="o">=</span><span class="s2">"col-md-12 text-right"</span><span class="o">&gt;</span>
<span class="o">&lt;</span><span class="nx">button</span>
<span class="nx">className</span><span class="o">=</span><span class="s2">"btn btn-primary btn-lg"</span>
@ -1032,9 +1066,10 @@ process URL paths that contain the <code class="highlighter-rouge">.</code> (dot
</span> <span class="o">&lt;</span><span class="sr">/div&gt; : nul</span><span class="err">l
</span> <span class="p">);</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
<p>### This checks to ensure that users are viewing their own profile, by wrapping the <strong>Logout</strong> button and inputs with the <code class="highlighter-rouge">{isLocal() &amp;&amp; ...}</code> condition.</p>
<p>### This checks to ensure that users are viewing their own profile, by wrapping the <strong>Logout</strong> button and inputs with the <code class="highlighter-rouge"><span class="p">{</span><span class="err">isLocal()</span><span class="w"> </span><span class="err">&amp;&amp;</span><span class="w"> </span><span class="err">...</span><span class="p">}</span></code> condition.</p>
</li>
</ol>
@ -1045,8 +1080,9 @@ process URL paths that contain the <code class="highlighter-rouge">.</code> (dot
<li>
<p>Restart the application so that the disabling of the <code class="highlighter-rouge">.</code> (dot) rule takes effect.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> npm start
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> npm start
</code></pre>
</div>
</li>
<li>Point your browser to <code class="highlighter-rouge">http://localhost:8080/your_blockstack.id</code> to see the final application.</li>
</ol>

76
_site/browser/browser-introduction.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Get the Blockstack Browser | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Get the Blockstack Browser" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/browser/browser-introduction.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/browser/browser-introduction.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Get the Blockstack Browser","dateModified":"2018-10-17T09:26:44-07:00","description":"Get the Blockstack Browser","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/browser/browser-introduction.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/browser/browser-introduction.html","headline":"Get the Blockstack Browser","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/browser/browser-introduction.html"},"description":"Get the Blockstack Browser","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -159,13 +159,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-browser/blob/master/docs/browser-introduction.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>
@ -335,49 +335,55 @@ Blockstack, <a href="https://docs.docker.com/install/">install the version of Do
<li>
<p>Set the executable bit on the file.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nv">$ </span><span class="nb">chmod </span>u+x Blockstack-for-Linux-v0.309.0.0.sh
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nv">$ </span>chmod u+x Blockstack-for-Linux-v0.309.0.0.sh
</code></pre>
</div>
</li>
<li>
<p>Enter the command without any arguments to see the available subcommands.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nv">$ </span><span class="nb">sudo</span> ./Blockstack-for-Linux-v0.309.0.0.sh
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nv">$ </span>sudo ./Blockstack-for-Linux-v0.309.0.0.sh
blockstack docker launcher commands:
Install-protocol-handler -&gt; <span class="nb">install </span>a protocol handler <span class="k">for </span>blockstack:// links
Install-protocol-handler -&gt; install a protocol handler <span class="k">for </span>blockstack:// links
...
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Use the script to <code class="highlighter-rouge">pull</code> the Blockstack Docker images you need.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nv">$ </span><span class="nb">sudo</span> ./Blockstack-for-Linux-v0.309.0.0.sh pull
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nv">$ </span>sudo ./Blockstack-for-Linux-v0.309.0.0.sh pull
</code></pre>
</div>
<p>Depending on your network speed, this can take some time.</p>
</li>
<li>
<p>Use the <code class="highlighter-rouge">docker image ls</code> command to confirm you have the image.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nv">$ </span><span class="nb">sudo </span>docker image Is
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nv">$ </span>sudo docker image Is
REPOSITORY TAG IMAGE ID CREATED
quay.io/blockstack/blockstack-browser v0.30.0 ad05fd844f59 2 days ago
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Install the protocol handler</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nv">$ </span> <span class="nb">sudo</span> ./Blockstack-for-Linux-vO.30.0.sh install-protocol-handler

<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nv">$ </span> sudo ./Blockstack-for-Linux-vO.30.0.sh install-protocol-handler

Registering protocol handler
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Start the Blockstack containers.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nv">$ </span><span class="nb">sudo</span> ./Blockstack-for-Linux-vO.30.0.sh start
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nv">$ </span>sudo ./Blockstack-for-Linux-vO.30.0.sh start
c3092592e59abe3559fdb49d070a7aa5e99165c7d9f2flla20ecaf4e0dfc2f46

cd92f61ae473d54398da987f5023f5462b29c03f08584ebb3c9fIbb4cd790c69

Registering protocol handler
</code></pre></div> </div>
</code></pre>
</div>
<p>The system launches the Blockstack Browser application for you.</p>
@ -389,8 +395,9 @@ Blockstack, <a href="https://docs.docker.com/install/">install the version of Do
on your system. To display the status of the Blockstack containers, you can use
the <code class="highlighter-rouge">docker container ls</code> command.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>docker container <span class="nb">ls</span> <span class="nt">--format</span> <span class="s1">'{{.ID}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}\t{{.Names}}'</span>
</code></pre></div></div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>sudo docker container ls --format <span class="s1">'{{.ID}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}\t{{.Names}}'</span>
</code></pre>
</div>
<p>Use <code class="highlighter-rouge">./Blockstack-for-Linux-vO.30.0.sh stop</code> to stop the Blockstack Browser and its containers.</p>
@ -452,8 +459,9 @@ your operating system.</p>
<p>From the command line:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">rm</span> <span class="nt">-r</span> /Users/moxiegirl/Library/Application<span class="se">\ </span>Support/Blockstack
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>rm -r /Users/moxiegirl/Library/Application<span class="se">\ </span>Support/Blockstack
</code></pre>
</div>
</li>
</ol>
@ -487,21 +495,22 @@ but that is not explained here.</p>
<li>
<p>Stop and remove the Docker containers if they are running.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nv">$ </span><span class="nb">sudo</span> ./Blockstack-for-Linux-vO.30.0.sh stop
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nv">$ </span>sudo ./Blockstack-for-Linux-vO.30.0.sh stop
stopping the running blockstack-browser containers
69a686799d4f
56fc6189ff97
69a686799d4f
56fc6189ff97
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Remove the associated Blockstack images.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nv">$ </span><span class="nb">sudo </span>docker image <span class="nb">ls
</span>REPOSITORY TAG IMAGE ID CREATED
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nv">$ </span>sudo docker image ls
REPOSITORY TAG IMAGE ID CREATED
quay.io/blockstack/blockstack-browser v0.30.0 ad05fd844f59 3 days ago
<span class="nv">$ </span><span class="nb">sudo </span>docker image <span class="nb">rm </span>ad05fd844f59

<span class="nv">$ </span>sudo docker image rm ad05fd844f59

Untagged : quay.io/blockstack/blockstack- browser :vO.30.0
Untagged: quay.io/blockstack/blockstack-browser@sha256:b20c9514c56b99398fd4946af39e7537b807e85694943ac3b8807dlb3625833b
Deleted: Sha256:ad05fd844f5948blee06a0a09228df946478393c0a7588cbc65dlb8817f5b34e
@ -509,19 +518,22 @@ but that is not explained here.</p>
Deleted: sha256:54ea2aa7d7d000e7483f299eeca9e5466fa86231f4cd4cld3c3096d97e61c5df
Deleted: sha256:38e61054355adefc3c2de031462114a9946cfc0e44444a38a27d0f115aba0da2
....
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Use the script to remove the protocol handler</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nv">$ </span><span class="nb">sudo</span> ./Blockstack-for-Linux-vO.30.0.sh remove-protocol-handler
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nv">$ </span>sudo ./Blockstack-for-Linux-vO.30.0.sh remove-protocol-handler
</code></pre>
</div>
</li>
<li>
<p>Delete the script.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nv">$ </span><span class="nb">rm </span>Blockstack-for-Linux-vO.30.0.sh
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nv">$ </span>rm Blockstack-for-Linux-vO.30.0.sh
</code></pre>
</div>
</li>
</ol>

10
_site/browser/faq_general.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Users Frequently Asked Questions (FAQ) | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Users Frequently Asked Questions (FAQ)" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/browser/faq_general.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/browser/faq_general.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Users Frequently Asked Questions (FAQ)","dateModified":"2018-10-17T09:26:44-07:00","description":"Users Frequently Asked Questions (FAQ)","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/browser/faq_general.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/browser/faq_general.html","headline":"Users Frequently Asked Questions (FAQ)","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/browser/faq_general.html"},"description":"Users Frequently Asked Questions (FAQ)","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -159,13 +159,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-browser/blob/master/docs/faq_general.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>

123
_site/browser/hello-blockstack.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Hello, Blockstack Tutorial | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Hello, Blockstack Tutorial" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/browser/hello-blockstack.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/browser/hello-blockstack.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Hello, Blockstack Tutorial","dateModified":"2018-10-17T09:26:44-07:00","description":"Hello, Blockstack Tutorial","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/browser/hello-blockstack.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/browser/hello-blockstack.html","headline":"Hello, Blockstack Tutorial","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/browser/hello-blockstack.html"},"description":"Hello, Blockstack Tutorial","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -195,13 +195,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-browser/blob/master/docs/hello-blockstack.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>
@ -258,9 +258,10 @@ the application, you need to have already registered a Blockstack ID.</p>
<p>The tutorial relies on the <code class="highlighter-rouge">npm</code> dependency manager. Before you begin, verify
you have installed <code class="highlighter-rouge">npm</code> using the <code class="highlighter-rouge">which</code> command to verify.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>which npm
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>which npm
/usr/local/bin/npm
</code></pre></div></div>
</code></pre>
</div>
<p>If you don’t find <code class="highlighter-rouge">npm</code> in your system, <a href="https://www.npmjs.com/get-npm">install
it</a>.</p>
@ -277,14 +278,16 @@ existing projects.</p>
<li>
<p>Install Yeoman.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> npm <span class="nb">install</span> <span class="nt">-g</span> yo
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> npm install -g yo
</code></pre>
</div>
</li>
<li>
<p>Install the Blockstack application generator.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> npm <span class="nb">install</span> <span class="nt">-g</span> generator-blockstack
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> npm install -g generator-blockstack
</code></pre>
</div>
</li>
</ol>
@ -296,29 +299,32 @@ existing projects.</p>
<li>
<p>Create the <code class="highlighter-rouge">hello-world-tutorial</code> directory.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nb">mkdir </span>hello-world-tutorial
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> mkdir hello-world-tutorial
</code></pre>
</div>
</li>
<li>
<p>Change into your new directory.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nb">cd </span>hello-world-tutorial
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nb">cd </span>hello-world-tutorial
</code></pre>
</div>
</li>
<li>
<p>Use Yeoman and the Blockstack application generator to create your initial <code class="highlighter-rouge">hello-world-tutorial</code> application.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> yo blockstack
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> yo blockstack
</code></pre>
</div>
<p>You should see several interactive prompts.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nv">$ </span>yo blockstack
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nv">$ </span>yo blockstack
_-----_ ╭──────────────────────────╮
| | │ Welcome to the │
|--<span class="o">(</span>o<span class="o">)</span><span class="nt">--</span>| │ Blockstack app │
<span class="sb">`</span><span class="nt">---------</span>´ │ generator! │
|--<span class="o">(</span>o<span class="o">)</span>--| │ Blockstack app │
<span class="sb">`</span>---------´ │ generator! │
<span class="o">(</span> _´U<span class="sb">`</span>_ <span class="o">)</span> ╰──────────────────────────╯
/___A___<span class="se">\ </span> /
| ~ |
@ -326,14 +332,15 @@ existing projects.</p>
´ <span class="sb">`</span> |° ´ Y <span class="sb">`</span>
? Are you ready to build a Blockstack app <span class="k">in </span>React? <span class="o">(</span>Y/n<span class="o">)</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Respond to the prompts to populate the initial app.</p>
<p>After the process completes successfully, you see a prompt similar to the following:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> ...
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> ...
create public/icon-192x192.png
create public/index.html
create public/robots.txt
@ -341,7 +348,8 @@ create public/manifest.json
I<span class="s1">'m all done. Running npm install for you to install the required dependencies. If this fails, try running the command yourself.
</span></code></pre></div> </div>
</span></code></pre>
</div>
</li>
</ol>
@ -443,8 +451,9 @@ and open your browser ‘http://localhost:5000’. From the root of your new ap
<li>
<p>Start the application server.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> npm start
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> npm start
</code></pre>
</div>
<p>The first time you run it, your system prompts you to accept incoming connections.</p>
@ -505,27 +514,30 @@ in the <code class="highlighter-rouge">public/app.css</code> file. Open this fil
<p>All of the code in the file is wrapped in an event
listener.</p>
<div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">document</span><span class="p">.</span><span class="nx">addEventListener</span><span class="p">(</span><span class="s2">"DOMContentLoaded"</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">event</span><span class="p">)</span> <span class="p">{</span>
<div class="language-js highlighter-rouge"><pre class="highlight"><code><span class="nb">document</span><span class="p">.</span><span class="nx">addEventListener</span><span class="p">(</span><span class="s2">"DOMContentLoaded"</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">event</span><span class="p">)</span> <span class="p">{</span>
<span class="p">})</span>
</code></pre></div></div>
</code></pre>
</div>
<p>This listener that waits until the DOM content is loaded. Then, it creates an auth request and redirects the user to sign in:</p>
<div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s1">'signin-button'</span><span class="p">).</span><span class="nx">addEventListener</span><span class="p">(</span><span class="s1">'click'</span><span class="p">,</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
<div class="language-js highlighter-rouge"><pre class="highlight"><code><span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s1">'signin-button'</span><span class="p">).</span><span class="nx">addEventListener</span><span class="p">(</span><span class="s1">'click'</span><span class="p">,</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
<span class="nx">blockstack</span><span class="p">.</span><span class="nx">redirectUserToSignIn</span><span class="p">()</span>
<span class="p">})</span>
</code></pre></div></div>
</code></pre>
</div>
<p>You can find the <code class="highlighter-rouge">redirectUserToSignIn()</code> function is part of the <a href="https://blockstack.github.io/blockstack.js/">Blockstack Javascript documentation</a>. There is also a sign out button handler. This handler deletes the local user data and signs the user out:</p>
<div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s1">'signout-button'</span><span class="p">).</span><span class="nx">addEventListener</span><span class="p">(</span><span class="s1">'click'</span><span class="p">,</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
<div class="language-js highlighter-rouge"><pre class="highlight"><code><span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s1">'signout-button'</span><span class="p">).</span><span class="nx">addEventListener</span><span class="p">(</span><span class="s1">'click'</span><span class="p">,</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
<span class="nx">blockstack</span><span class="p">.</span><span class="nx">signUserOut</span><span class="p">(</span><span class="nb">window</span><span class="p">.</span><span class="nx">location</span><span class="p">.</span><span class="nx">origin</span><span class="p">)</span>
<span class="p">})</span>
</code></pre></div></div>
</code></pre>
</div>
<p>The handlers are followed by a <code class="highlighter-rouge">showProfile()</code> function for showing the user’s profile:</p>
<div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">function</span> <span class="nx">showProfile</span><span class="p">(</span><span class="nx">profile</span><span class="p">)</span> <span class="p">{</span>
<div class="language-js highlighter-rouge"><pre class="highlight"><code><span class="kd">function</span> <span class="nx">showProfile</span><span class="p">(</span><span class="nx">profile</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">person</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">blockstack</span><span class="p">.</span><span class="nx">Person</span><span class="p">(</span><span class="nx">profile</span><span class="p">)</span>
<span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s1">'heading-name'</span><span class="p">).</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="nx">person</span><span class="p">.</span><span class="nx">name</span><span class="p">()</span> <span class="p">?</span> <span class="nx">person</span><span class="p">.</span><span class="nx">name</span><span class="p">()</span> <span class="p">:</span> <span class="s2">"Nameless Person"</span>
<span class="k">if</span><span class="p">(</span><span class="nx">person</span><span class="p">.</span><span class="nx">avatarUrl</span><span class="p">())</span> <span class="p">{</span>
@ -534,7 +546,8 @@ listener.</p>
<span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s1">'section-1'</span><span class="p">).</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s1">'none'</span>
<span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s1">'section-2'</span><span class="p">).</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s1">'block'</span>
<span class="p">}</span>
</code></pre></div></div>
</code></pre>
</div>
<p>Each <code class="highlighter-rouge">getElementById()</code> function refers to elemments in the <code class="highlighter-rouge">index.html</code> file.</p>
@ -550,7 +563,7 @@ several states the user can be in:</p>
<p>The application handles these situtations as followed:</p>
<div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">if</span> <span class="p">(</span><span class="nx">blockstack</span><span class="p">.</span><span class="nx">isUserSignedIn</span><span class="p">())</span> <span class="p">{</span>
<div class="language-js highlighter-rouge"><pre class="highlight"><code><span class="k">if</span> <span class="p">(</span><span class="nx">blockstack</span><span class="p">.</span><span class="nx">isUserSignedIn</span><span class="p">())</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">profile</span> <span class="o">=</span> <span class="nx">blockstack</span><span class="p">.</span><span class="nx">loadUserData</span><span class="p">().</span><span class="nx">profile</span>
<span class="nx">showProfile</span><span class="p">(</span><span class="nx">profile</span><span class="p">)</span>
<span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">blockstack</span><span class="p">.</span><span class="nx">isSignInPending</span><span class="p">())</span> <span class="p">{</span>
@ -558,7 +571,8 @@ several states the user can be in:</p>
<span class="nb">window</span><span class="p">.</span><span class="nx">location</span> <span class="o">=</span> <span class="nb">window</span><span class="p">.</span><span class="nx">location</span><span class="p">.</span><span class="nx">origin</span>
<span class="p">})</span>
<span class="p">}</span>
</code></pre></div></div>
</code></pre>
</div>
<p>When the user is signed in, Blockstack loads the user data from local storage
and displays the profile with the <code class="highlighter-rouge">showProfile()</code> function. When the user has a
@ -571,17 +585,18 @@ user back to the home page.</p>
configurations dictate how the application is displayed in auth views and on
user home screens. The contents are very simple:</p>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="s2">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Hello, Blockstack"</span><span class="p">,</span><span class="w">
</span><span class="s2">"start_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"localhost:5000"</span><span class="p">,</span><span class="w">
</span><span class="s2">"description"</span><span class="p">:</span><span class="w"> </span><span class="s2">"A simple demo of Blockstack Auth"</span><span class="p">,</span><span class="w">
</span><span class="s2">"icons"</span><span class="p">:</span><span class="w"> </span><span class="p">[{</span><span class="w">
</span><span class="s2">"src"</span><span class="p">:</span><span class="w"> </span><span class="s2">"https://helloblockstack.com/icon-192x192.png"</span><span class="p">,</span><span class="w">
</span><span class="s2">"sizes"</span><span class="p">:</span><span class="w"> </span><span class="s2">"192x192"</span><span class="p">,</span><span class="w">
</span><span class="s2">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"image/png"</span><span class="w">
<div class="language-json highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="nt">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Hello, Blockstack"</span><span class="p">,</span><span class="w">
</span><span class="nt">"start_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"localhost:5000"</span><span class="p">,</span><span class="w">
</span><span class="nt">"description"</span><span class="p">:</span><span class="w"> </span><span class="s2">"A simple demo of Blockstack Auth"</span><span class="p">,</span><span class="w">
</span><span class="nt">"icons"</span><span class="p">:</span><span class="w"> </span><span class="p">[{</span><span class="w">
</span><span class="nt">"src"</span><span class="p">:</span><span class="w"> </span><span class="s2">"https://helloblockstack.com/icon-192x192.png"</span><span class="p">,</span><span class="w">
</span><span class="nt">"sizes"</span><span class="p">:</span><span class="w"> </span><span class="s2">"192x192"</span><span class="p">,</span><span class="w">
</span><span class="nt">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"image/png"</span><span class="w">
</span><span class="p">}]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>
</span></code></pre>
</div>
<p>Keep it as is or fill it in with new information that describes your app.</p>
@ -593,14 +608,16 @@ user home screens. The contents are very simple:</p>
<li>
<p>Initialize the application code as a Git repo.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> git init
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> git init
</code></pre>
</div>
</li>
<li>
<p>Add and commit all of the files:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> git add <span class="nb">.</span> <span class="o">&amp;&amp;</span> git commit <span class="nt">-m</span> <span class="s2">"first commit"</span>
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> git add . <span class="o">&amp;&amp;</span> git commit -m <span class="s2">"first commit"</span>
</code></pre>
</div>
</li>
<li>
<p>In GitHub, create a <code class="highlighter-rouge">hello-blockstack</code> repository.</p>
@ -610,14 +627,16 @@ user home screens. The contents are very simple:</p>
<p>Make sure to fill in your username:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> git remote add origin git@github.com:YOUR_USERNAME_HERE/hello-blockstack.git
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> git remote add origin git@github.com:YOUR_USERNAME_HERE/hello-blockstack.git
</code></pre>
</div>
</li>
<li>
<p>Push your new code to the master branch of the remote repo:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> git push origin master
</code></pre></div> </div>
<div class="highlighter-rouge"><pre class="highlight"><code> git push origin master
</code></pre>
</div>
</li>
</ol>

10
_site/browser/ids-introduction.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Get and use a Blockstack ID | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Get and use a Blockstack ID" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/browser/ids-introduction.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/browser/ids-introduction.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Get and use a Blockstack ID","dateModified":"2018-10-17T09:26:44-07:00","description":"Get and use a Blockstack ID","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/browser/ids-introduction.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/browser/ids-introduction.html","headline":"Get and use a Blockstack ID","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/browser/ids-introduction.html"},"description":"Get and use a Blockstack ID","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -159,13 +159,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-browser/blob/master/docs/ids-introduction.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>

238
_site/browser/multi-player-storage.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Manage Data with Gaia | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Manage Data with Gaia" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/browser/multi-player-storage.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/browser/multi-player-storage.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Manage Data with Gaia","dateModified":"2018-10-17T09:26:44-07:00","description":"Manage Data with Gaia","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/browser/multi-player-storage.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/browser/multi-player-storage.html","headline":"Manage Data with Gaia","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/browser/multi-player-storage.html"},"description":"Manage Data with Gaia","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -195,13 +195,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-browser/blob/master/docs/multi-player-storage.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>
@ -259,9 +259,10 @@ the application, you need to have already <a href="ids-introduction.md">register
<p>The tutorial relies on the <code class="highlighter-rouge">npm</code> dependency manager. Before you begin, verify
you have installed <code class="highlighter-rouge">npm</code> using the <code class="highlighter-rouge">which</code> command.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>which npm
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>which npm
/usr/local/bin/npm
</code></pre></div></div>
</code></pre>
</div>
<p>If you don’t find <code class="highlighter-rouge">npm</code> in your system, <a href="https://www.npmjs.com/get-npm">install
it</a>. Finally, if you get stuck at any point
@ -278,14 +279,16 @@ existing projects.</p>
<li>
<p>Install Yeoman.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> npm <span class="nb">install</span> <span class="nt">-g</span> yo
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> npm install -g yo
</code></pre>
</div>
</li>
<li>
<p>Install the Blockstack application generator.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> npm <span class="nb">install</span> <span class="nt">-g</span> generator-blockstack
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> npm install -g generator-blockstack
</code></pre>
</div>
</li>
</ol>
@ -299,24 +302,27 @@ existing projects.</p>
<li>
<p>Create a the <code class="highlighter-rouge">publik</code> directory.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nb">mkdir </span>publik
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> mkdir publik
</code></pre>
</div>
</li>
<li>
<p>Change into your new directory.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nb">cd </span>publik
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nb">cd </span>publik
</code></pre>
</div>
</li>
<li>
<p>Use Yeoman and the Blockstack application generator to create your initial <code class="highlighter-rouge">publik</code> application.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> yo blockstack:react
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> yo blockstack:react
</code></pre>
</div>
<p>You should see several interactive prompts.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nv">$ </span>yo blockstack:react
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nv">$ </span>yo blockstack:react
? <span class="o">==========================================================================</span>
We<span class="s1">'re constantly looking for ways to make yo better!
May we anonymously report usage statistics to improve the tool over time?
@ -334,24 +340,27 @@ existing projects.</p>
´ ` |° ´ Y `
? Are you ready to build a Blockstack app in React? (Y/n)
</span></code></pre></div> </div>
</span></code></pre>
</div>
</li>
<li>
<p>Respond to the prompts to populate the initial app.</p>
<p>After the process completes successfully, you see a prompt similar to the following:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="o">[</span>fsevents] Success:
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="o">[</span>fsevents] Success:
<span class="s2">"/Users/theuser/repos/publik/node_modules/fsevents/lib/binding/Release/node-v59-darwin-x64/fse.node"</span>
is installed via remote npm notice created a lockfile as package-lock.json.
You should commit this file. added 1060 packages <span class="k">in </span>26.901s
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Run the initial application.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> npm start
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> npm start
</code></pre>
</div>
<p>The system prompts you to accept incoming connections.</p>
@ -395,21 +404,23 @@ stored on Gaia are made visible to others via the <code class="highlighter-rouge
<li>
<p>Locate the <code class="highlighter-rouge">handleSignIn</code> handler method.</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">handleSignIn</span><span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">handleSignIn</span><span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">e</span><span class="p">.</span><span class="nx">preventDefault</span><span class="p">();</span>
<span class="nx">redirectToSignIn</span><span class="p">();</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Modify the method to this:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">handleSignIn</span><span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">handleSignIn</span><span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">e</span><span class="p">.</span><span class="nx">preventDefault</span><span class="p">();</span>
<span class="kd">const</span> <span class="nx">origin</span> <span class="o">=</span> <span class="nb">window</span><span class="p">.</span><span class="nx">location</span><span class="p">.</span><span class="nx">origin</span>
<span class="kr">const</span> <span class="nx">origin</span> <span class="o">=</span> <span class="nb">window</span><span class="p">.</span><span class="nx">location</span><span class="p">.</span><span class="nx">origin</span>
<span class="nx">redirectToSignIn</span><span class="p">(</span><span class="nx">origin</span><span class="p">,</span> <span class="nx">origin</span> <span class="o">+</span> <span class="s1">'/manifest.json'</span><span class="p">,</span> <span class="p">[</span><span class="s1">'store_write'</span><span class="p">,</span> <span class="s1">'publish_data'</span><span class="p">])</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
<p>By default, authentication requests include the <code class="highlighter-rouge">store_write</code> scope which
enables storage. This is what allows you to store information to Gaia.</p>
@ -443,17 +454,18 @@ delete grocery lists.</p>
<p>A single file collection stores items as an array nested inside each grocery
list:</p>
<div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// grocerylists.json</span>
<div class="language-js highlighter-rouge"><pre class="highlight"><code><span class="c1">// grocerylists.json</span>
<span class="p">{</span>
<span class="s2">"3255"</span><span class="p">:</span> <span class="p">{</span>
<span class="s2">"items"</span><span class="p">:</span> <span class="p">[</span>
<span class="s2">"3255"</span><span class="err">:</span> <span class="p">{</span>
<span class="s2">"items"</span><span class="err">:</span> <span class="p">[</span>
<span class="s2">"1 Head of Lettuce"</span><span class="p">,</span>
<span class="s2">"Haralson apples"</span>
<span class="p">]</span>
<span class="p">},</span>
<span class="c1">// ...more lists with items</span>
<span class="p">}</span>
</code></pre></div></div>
</code></pre>
</div>
<p>This is conceptually the simplest way to manage grocery lists. When you read a
<code class="highlighter-rouge">/grocerylists.json</code> file with <code class="highlighter-rouge">getFile()</code>, you get back one or more grocery
@ -492,26 +504,28 @@ or remove a grocery list; updating a list has no impact.</p>
<p>The <code class="highlighter-rouge">Person</code> object holds a Blockstack profile. Add <code class="highlighter-rouge">putFile</code>, <code class="highlighter-rouge">getFile</code>,
and <code class="highlighter-rouge">lookupProfile</code> after <code class="highlighter-rouge">Person</code>.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> When you are done, the import statement should look like the following:
</code></pre></div> </div>
<div class="highlighter-rouge"><pre class="highlight"><code> When you are done, the import statement should look like the following:
</code></pre>
</div>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="k">import</span> <span class="p">{</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="kr">import</span> <span class="p">{</span>
<span class="nx">isSignInPending</span><span class="p">,</span>
<span class="nx">loadUserData</span><span class="p">,</span>
<span class="nx">Person</span><span class="p">,</span>
<span class="nx">getFile</span><span class="p">,</span>
<span class="nx">putFile</span><span class="p">,</span>
<span class="nx">lookupProfile</span>
<span class="p">}</span> <span class="k">from</span> <span class="s1">'blockstack'</span><span class="p">;</span>
</code></pre></div> </div>
<span class="p">}</span> <span class="nx">from</span> <span class="s1">'blockstack'</span><span class="p">;</span>
</code></pre>
</div>
</li>
<li>
<p>Replace the <code class="highlighter-rouge">constructor()</code> initial state so that it holds the key properties required by the app.</p>
<p>This code constructs a Blockstack <code class="highlighter-rouge">Person</code> object to hold the profile. Your constructor should look like this:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="kd">constructor</span><span class="p">(</span><span class="nx">props</span><span class="p">)</span> <span class="p">{</span>
<span class="k">super</span><span class="p">(</span><span class="nx">props</span><span class="p">);</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">constructor</span><span class="p">(</span><span class="nx">props</span><span class="p">)</span> <span class="p">{</span>
<span class="kr">super</span><span class="p">(</span><span class="nx">props</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">state</span> <span class="o">=</span> <span class="p">{</span>
<span class="na">person</span><span class="p">:</span> <span class="p">{</span>
@ -529,7 +543,8 @@ or remove a grocery list; updating a list has no impact.</p>
<span class="na">isLoading</span><span class="p">:</span> <span class="kc">false</span>
<span class="p">};</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>Locate the <code class="highlighter-rouge">render()</code> method.</li>
<li>
@ -538,10 +553,10 @@ or remove a grocery list; updating a list has no impact.</p>
<p>The following code echos the <code class="highlighter-rouge">person.name</code> and <code class="highlighter-rouge">person.avatarURL</code>
properties from the profile on the display:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">render</span><span class="p">()</span> <span class="p">{</span>
<span class="kd">const</span> <span class="p">{</span> <span class="nx">handleSignOut</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">props</span><span class="p">;</span>
<span class="kd">const</span> <span class="p">{</span> <span class="nx">person</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">;</span>
<span class="kd">const</span> <span class="p">{</span> <span class="nx">username</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">;</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">render</span><span class="p">()</span> <span class="p">{</span>
<span class="kr">const</span> <span class="p">{</span> <span class="nx">handleSignOut</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">props</span><span class="p">;</span>
<span class="kr">const</span> <span class="p">{</span> <span class="nx">person</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">;</span>
<span class="kr">const</span> <span class="p">{</span> <span class="nx">username</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">;</span>
<span class="k">return</span> <span class="p">(</span>
<span class="o">!</span><span class="nx">isSignInPending</span><span class="p">()</span> <span class="o">&amp;&amp;</span> <span class="nx">person</span> <span class="p">?</span>
@ -554,8 +569,8 @@ or remove a grocery list; updating a list has no impact.</p>
<span class="nx">src</span><span class="o">=</span><span class="p">{</span> <span class="nx">person</span><span class="p">.</span><span class="nx">avatarUrl</span><span class="p">()</span> <span class="p">?</span> <span class="nx">person</span><span class="p">.</span><span class="nx">avatarUrl</span><span class="p">()</span> <span class="p">:</span> <span class="nx">avatarFallbackImage</span> <span class="p">}</span>
<span class="nx">className</span><span class="o">=</span><span class="s2">"img-rounded avatar"</span>
<span class="nx">id</span><span class="o">=</span><span class="s2">"avatar-image"</span>
<span class="o">/&gt;</span>
<span class="o">&lt;</span><span class="nx">div</span> <span class="nx">className</span><span class="o">=</span><span class="s2">"username"</span><span class="o">&gt;</span>
<span class="sr">/</span><span class="err">&gt;
</span> <span class="o">&lt;</span><span class="nx">div</span> <span class="nx">className</span><span class="o">=</span><span class="s2">"username"</span><span class="o">&gt;</span>
<span class="o">&lt;</span><span class="nx">h1</span><span class="o">&gt;</span>
<span class="o">&lt;</span><span class="nx">span</span> <span class="nx">id</span><span class="o">=</span><span class="s2">"heading-name"</span><span class="o">&gt;</span><span class="p">{</span> <span class="nx">person</span><span class="p">.</span><span class="nx">name</span><span class="p">()</span> <span class="p">?</span> <span class="nx">person</span><span class="p">.</span><span class="nx">name</span><span class="p">()</span>
<span class="p">:</span> <span class="s1">'Nameless Person'</span> <span class="p">}</span><span class="o">&lt;</span><span class="sr">/span</span><span class="err">&gt;
@ -575,8 +590,8 @@ or remove a grocery list; updating a list has no impact.</p>
<span class="nx">value</span><span class="o">=</span><span class="p">{</span><span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">.</span><span class="nx">newStatus</span><span class="p">}</span>
<span class="nx">onChange</span><span class="o">=</span><span class="p">{</span><span class="nx">e</span> <span class="o">=&gt;</span> <span class="k">this</span><span class="p">.</span><span class="nx">handleNewStatusChange</span><span class="p">(</span><span class="nx">e</span><span class="p">)}</span>
<span class="nx">placeholder</span><span class="o">=</span><span class="s2">"Enter a status"</span>
<span class="o">/&gt;</span>
<span class="o">&lt;</span><span class="sr">/div</span><span class="err">&gt;
<span class="sr">/</span><span class="err">&gt;
</span> <span class="o">&lt;</span><span class="sr">/div</span><span class="err">&gt;
</span> <span class="o">&lt;</span><span class="nx">div</span> <span class="nx">className</span><span class="o">=</span><span class="s2">"col-md-12"</span><span class="o">&gt;</span>
<span class="o">&lt;</span><span class="nx">button</span>
<span class="nx">className</span><span class="o">=</span><span class="s2">"btn btn-primary btn-lg"</span>
@ -592,7 +607,8 @@ or remove a grocery list; updating a list has no impact.</p>
</span> <span class="o">&lt;</span><span class="sr">/div&gt; : nul</span><span class="err">l
</span> <span class="p">);</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
<p>This code allows the application to post statuses. It also displays the
user’s Blockstack ID. To display this, your app must extract the ID from the
@ -604,18 +620,19 @@ user profile data.</p>
<p>You’ll use the Blockstack <code class="highlighter-rouge">loadUserData()</code> method to access the <code class="highlighter-rouge">username</code>.</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">componentWillMount</span><span class="p">()</span> <span class="p">{</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">componentWillMount</span><span class="p">()</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">setState</span><span class="p">({</span>
<span class="na">person</span><span class="p">:</span> <span class="k">new</span> <span class="nx">Person</span><span class="p">(</span><span class="nx">loadUserData</span><span class="p">().</span><span class="nx">profile</span><span class="p">),</span>
<span class="na">username</span><span class="p">:</span> <span class="nx">loadUserData</span><span class="p">().</span><span class="nx">username</span>
<span class="p">});</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Add two methods to handle the status input events:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">handleNewStatusChange</span><span class="p">(</span><span class="nx">event</span><span class="p">)</span> <span class="p">{</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">handleNewStatusChange</span><span class="p">(</span><span class="nx">event</span><span class="p">)</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">setState</span><span class="p">({</span><span class="na">newStatus</span><span class="p">:</span> <span class="nx">event</span><span class="p">.</span><span class="nx">target</span><span class="p">.</span><span class="nx">value</span><span class="p">})</span>
<span class="p">}</span>
@ -625,12 +642,13 @@ user profile data.</p>
<span class="na">newStatus</span><span class="p">:</span> <span class="s2">""</span>
<span class="p">})</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Add a <code class="highlighter-rouge">saveNewStatus()</code> method to save the new statuses.</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">saveNewStatus</span><span class="p">(</span><span class="nx">statusText</span><span class="p">)</span> <span class="p">{</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">saveNewStatus</span><span class="p">(</span><span class="nx">statusText</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">let</span> <span class="nx">statuses</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">.</span><span class="nx">statuses</span>
<span class="kd">let</span> <span class="nx">status</span> <span class="o">=</span> <span class="p">{</span>
@ -640,7 +658,7 @@ user profile data.</p>
<span class="p">}</span>
<span class="nx">statuses</span><span class="p">.</span><span class="nx">unshift</span><span class="p">(</span><span class="nx">status</span><span class="p">)</span>
<span class="kd">const</span> <span class="nx">options</span> <span class="o">=</span> <span class="p">{</span> <span class="na">encrypt</span><span class="p">:</span> <span class="kc">false</span> <span class="p">}</span>
<span class="kr">const</span> <span class="nx">options</span> <span class="o">=</span> <span class="p">{</span> <span class="na">encrypt</span><span class="p">:</span> <span class="kc">false</span> <span class="p">}</span>
<span class="nx">putFile</span><span class="p">(</span><span class="s1">'statuses.json'</span><span class="p">,</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">stringify</span><span class="p">(</span><span class="nx">statuses</span><span class="p">),</span> <span class="nx">options</span><span class="p">)</span>
<span class="p">.</span><span class="nx">then</span><span class="p">(()</span> <span class="o">=&gt;</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">setState</span><span class="p">({</span>
@ -648,7 +666,8 @@ user profile data.</p>
<span class="p">})</span>
<span class="p">})</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Save the <code class="highlighter-rouge">Profile.jsk</code> file.</p>
@ -675,7 +694,7 @@ the statuses back to the user as a blog entry.</p>
<li>
<p>Right after this opening <code class="highlighter-rouge">div</code> element, add this block.</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="o">&lt;</span><span class="nx">div</span> <span class="nx">className</span><span class="o">=</span><span class="s2">"col-md-12 statuses"</span><span class="o">&gt;</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="o">&lt;</span><span class="nx">div</span> <span class="nx">className</span><span class="o">=</span><span class="s2">"col-md-12 statuses"</span><span class="o">&gt;</span>
<span class="p">{</span><span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">.</span><span class="nx">isLoading</span> <span class="o">&amp;&amp;</span> <span class="o">&lt;</span><span class="nx">span</span><span class="o">&gt;</span><span class="nx">Loading</span><span class="p">...</span><span class="o">&lt;</span><span class="sr">/span&gt;</span><span class="err">}
</span> <span class="p">{</span><span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">.</span><span class="nx">statuses</span><span class="p">.</span><span class="nx">map</span><span class="p">((</span><span class="nx">status</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">(</span>
<span class="o">&lt;</span><span class="nx">div</span> <span class="nx">className</span><span class="o">=</span><span class="s2">"status"</span> <span class="nx">key</span><span class="o">=</span><span class="p">{</span><span class="nx">status</span><span class="p">.</span><span class="nx">id</span><span class="p">}</span><span class="o">&gt;</span>
@ -684,16 +703,17 @@ the statuses back to the user as a blog entry.</p>
</span> <span class="p">)</span>
<span class="p">)}</span>
<span class="o">&lt;</span><span class="sr">/div</span><span class="err">&gt;
</span></code></pre></div> </div>
</span></code></pre>
</div>
<p>This loads existing state. Your code needs to fetch statuses on page load.</p>
</li>
<li>
<p>Add a new method called <code class="highlighter-rouge">fetchData()</code> after the <code class="highlighter-rouge">statuses.unshift(status)</code> section.</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code>
<span class="nx">fetchData</span><span class="p">()</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">setState</span><span class="p">({</span> <span class="na">isLoading</span><span class="p">:</span> <span class="kc">true</span> <span class="p">})</span>
<span class="kd">const</span> <span class="nx">options</span> <span class="o">=</span> <span class="p">{</span> <span class="na">decrypt</span><span class="p">:</span> <span class="kc">false</span> <span class="p">}</span>
<span class="kr">const</span> <span class="nx">options</span> <span class="o">=</span> <span class="p">{</span> <span class="na">decrypt</span><span class="p">:</span> <span class="kc">false</span> <span class="p">}</span>
<span class="nx">getFile</span><span class="p">(</span><span class="s1">'statuses.json'</span><span class="p">,</span> <span class="nx">options</span><span class="p">)</span>
<span class="p">.</span><span class="nx">then</span><span class="p">((</span><span class="nx">file</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">statuses</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">file</span> <span class="o">||</span> <span class="s1">'[]'</span><span class="p">)</span>
@ -708,16 +728,18 @@ the statuses back to the user as a blog entry.</p>
<span class="k">this</span><span class="p">.</span><span class="nx">setState</span><span class="p">({</span> <span class="na">isLoading</span><span class="p">:</span> <span class="kc">false</span> <span class="p">})</span>
<span class="p">})</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Call <code class="highlighter-rouge">fetchData()</code> from the <code class="highlighter-rouge">componentDidMount()</code> method</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code>
<span class="nx">componentDidMount</span><span class="p">()</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">fetchData</span><span class="p">()</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Save the file.</p>
@ -736,7 +758,7 @@ the statuses back to the user as a blog entry.</p>
<li>
<p>Replace the content with the following:</p>
<div class="language-css highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="c">/* Globals */</span>
<div class="language-css highlighter-rouge"><pre class="highlight"><code> <span class="c">/* Globals */</span>
<span class="nt">a</span><span class="o">,</span><span class="nt">a</span><span class="nd">:focus</span><span class="o">,</span><span class="nt">a</span><span class="nd">:hover</span><span class="p">{</span><span class="nl">color</span><span class="p">:</span><span class="m">#fff</span><span class="p">;}</span>
<span class="nt">html</span><span class="o">,</span><span class="nt">body</span><span class="p">{</span><span class="nl">height</span><span class="p">:</span><span class="m">100%</span><span class="p">;</span><span class="nl">text-align</span><span class="p">:</span><span class="nb">center</span><span class="p">;</span><span class="nl">background-color</span><span class="p">:</span><span class="m">#191b22</span><span class="p">;}</span>
<span class="nt">body</span><span class="p">{</span><span class="nl">color</span><span class="p">:</span><span class="m">#fff</span><span class="p">}</span>
@ -771,7 +793,8 @@ the statuses back to the user as a blog entry.</p>
<span class="c">/* Statuses */</span>
<span class="nc">.statuses</span><span class="p">{</span><span class="nl">padding-top</span><span class="p">:</span><span class="m">30px</span><span class="p">;}</span>
<span class="nc">.status</span><span class="p">{</span><span class="nl">margin</span><span class="p">:</span><span class="m">15px</span> <span class="m">0px</span><span class="p">;</span><span class="nl">padding</span><span class="p">:</span><span class="m">20px</span><span class="p">;</span><span class="nl">background-color</span><span class="p">:</span><span class="m">#2e2e2e</span><span class="p">;</span><span class="nl">border-radius</span><span class="p">:</span><span class="m">6px</span><span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Save and close the <code class="highlighter-rouge">src/styles/style.css</code> file.</p>
@ -803,44 +826,49 @@ other users’ profiles by visiting <code class="highlighter-rouge">http://local
<li>
<p>Install <code class="highlighter-rouge">react-router</code>:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> npm <span class="nb">install</span> <span class="nt">--save</span> react-router-dom
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> npm install --save react-router-dom
</code></pre>
</div>
</li>
<li>Edit <code class="highlighter-rouge">src/index.js</code> file.</li>
<li>
<p>Add an <code class="highlighter-rouge">import</code> to the file at the top:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="k">import</span> <span class="p">{</span> <span class="nx">BrowserRouter</span> <span class="p">}</span> <span class="k">from</span> <span class="s1">'react-router-dom'</span>
</code></pre></div> </div>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="kr">import</span> <span class="p">{</span> <span class="nx">BrowserRouter</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'react-router-dom'</span>
</code></pre>
</div>
</li>
<li>
<p>Change the <code class="highlighter-rouge">ReactDOM.render()</code> method in <code class="highlighter-rouge">src/index.js</code> to:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">ReactDOM</span><span class="p">.</span><span class="nx">render</span><span class="p">((</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">ReactDOM</span><span class="p">.</span><span class="nx">render</span><span class="p">((</span>
<span class="o">&lt;</span><span class="nx">BrowserRouter</span><span class="o">&gt;</span>
<span class="o">&lt;</span><span class="nx">App</span> <span class="o">/&gt;</span>
<span class="o">&lt;</span><span class="sr">/BrowserRouter</span><span class="err">&gt;
</span> <span class="p">),</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s1">'root'</span><span class="p">));</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>Save and close the <code class="highlighter-rouge">src/index.js</code> file.</li>
<li>Edit the <code class="highlighter-rouge">src/components/App.jsx</code> file.</li>
<li>
<p>Add the new route by importing the <code class="highlighter-rouge">Switch</code> and <code class="highlighter-rouge">Route</code> components from <code class="highlighter-rouge">react-router-dom</code>:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="k">import</span> <span class="p">{</span> <span class="nx">Switch</span><span class="p">,</span> <span class="nx">Route</span> <span class="p">}</span> <span class="k">from</span> <span class="s1">'react-router-dom'</span>
</code></pre></div> </div>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="kr">import</span> <span class="p">{</span> <span class="nx">Switch</span><span class="p">,</span> <span class="nx">Route</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'react-router-dom'</span>
</code></pre>
</div>
</li>
<li>
<p>Locate this line below in the <code class="highlighter-rouge">render()</code> method:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="p">:</span> <span class="o">&lt;</span><span class="nx">Profile</span> <span class="nx">handleSignOut</span><span class="o">=</span><span class="p">{</span> <span class="k">this</span><span class="p">.</span><span class="nx">handleSignOut</span> <span class="p">}</span> <span class="sr">/</span><span class="err">&gt;
</span></code></pre></div> </div>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="err">:</span> <span class="o">&lt;</span><span class="nx">Profile</span> <span class="nx">handleSignOut</span><span class="o">=</span><span class="p">{</span> <span class="k">this</span><span class="p">.</span><span class="nx">handleSignOut</span> <span class="p">}</span> <span class="sr">/</span><span class="err">&gt;
</span></code></pre>
</div>
</li>
<li>
<p>Replace it with the following:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="p">:</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="err">:</span>
<span class="o">&lt;</span><span class="nx">Switch</span><span class="o">&gt;</span>
<span class="o">&lt;</span><span class="nx">Route</span>
<span class="nx">path</span><span class="o">=</span><span class="s1">'/:username?'</span>
@ -849,7 +877,8 @@ other users’ profiles by visiting <code class="highlighter-rouge">http://local
</span> <span class="p">}</span>
<span class="sr">/</span><span class="err">&gt;
</span> <span class="o">&lt;</span><span class="sr">/Switch</span><span class="err">&gt;
</span></code></pre></div> </div>
</span></code></pre>
</div>
<p>This sets up a route and captures the route parameter the app will use as the profile lookup username.</p>
</li>
@ -868,16 +897,18 @@ process URL paths that contain the <code class="highlighter-rouge">.</code> (dot
<li>
<p>Open <code class="highlighter-rouge">webpack.config.js</code> in the root project directory and locate the following line:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">historyApiFallback</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</code></pre></div> </div>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">historyApiFallback</span><span class="err">:</span> <span class="kc">true</span><span class="p">,</span>
</code></pre>
</div>
</li>
<li>
<p>Replace it with this:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">historyApiFallback</span><span class="p">:</span> <span class="p">{</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">historyApiFallback</span><span class="err">:</span> <span class="p">{</span>
<span class="nl">disableDotRule</span><span class="p">:</span> <span class="kc">true</span>
<span class="p">},</span>
</code></pre></div> </div>
</code></pre>
</div>
<p>You will need to run <code class="highlighter-rouge">npm start</code> again for this change to take effect. Don’t
worry, there is a later step for that to remind you.</p>
@ -889,20 +920,21 @@ process URL paths that contain the <code class="highlighter-rouge">.</code> (dot
<li>
<p>Add a single method that determines if the app is viewing the local user’s profile or another user’s profile.</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">isLocal</span><span class="p">()</span> <span class="p">{</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">isLocal</span><span class="p">()</span> <span class="p">{</span>
<span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">props</span><span class="p">.</span><span class="nx">match</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">username</span> <span class="p">?</span> <span class="kc">false</span> <span class="p">:</span> <span class="kc">true</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
<p>You use <code class="highlighter-rouge">isLocal()</code> to check if the user is viewing the local user profile or another user’s profile. If it’s the local user profile, the app runs the <code class="highlighter-rouge">getFile()</code> function you added in an earlier step. Otherwise, the app looks up the profile belonging to the <code class="highlighter-rouge">username</code> using the <code class="highlighter-rouge">lookupProfile()</code> method.</p>
</li>
<li>
<p>Modify the <code class="highlighter-rouge">fetchData()</code> method like so:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">fetchData</span><span class="p">()</span> <span class="p">{</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">fetchData</span><span class="p">()</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">setState</span><span class="p">({</span> <span class="na">isLoading</span><span class="p">:</span> <span class="kc">true</span> <span class="p">})</span>
<span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">isLocal</span><span class="p">())</span> <span class="p">{</span>
<span class="kd">const</span> <span class="nx">options</span> <span class="o">=</span> <span class="p">{</span> <span class="na">decrypt</span><span class="p">:</span> <span class="kc">false</span> <span class="p">}</span>
<span class="kr">const</span> <span class="nx">options</span> <span class="o">=</span> <span class="p">{</span> <span class="na">decrypt</span><span class="p">:</span> <span class="kc">false</span> <span class="p">}</span>
<span class="nx">getFile</span><span class="p">(</span><span class="s1">'statuses.json'</span><span class="p">,</span> <span class="nx">options</span><span class="p">)</span>
<span class="p">.</span><span class="nx">then</span><span class="p">((</span><span class="nx">file</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">statuses</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">file</span> <span class="o">||</span> <span class="s1">'[]'</span><span class="p">)</span>
@ -917,7 +949,7 @@ process URL paths that contain the <code class="highlighter-rouge">.</code> (dot
<span class="k">this</span><span class="p">.</span><span class="nx">setState</span><span class="p">({</span> <span class="na">isLoading</span><span class="p">:</span> <span class="kc">false</span> <span class="p">})</span>
<span class="p">})</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
<span class="kd">const</span> <span class="nx">username</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">props</span><span class="p">.</span><span class="nx">match</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">username</span>
<span class="kr">const</span> <span class="nx">username</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">props</span><span class="p">.</span><span class="nx">match</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">username</span>
<span class="nx">lookupProfile</span><span class="p">(</span><span class="nx">username</span><span class="p">)</span>
<span class="p">.</span><span class="nx">then</span><span class="p">((</span><span class="nx">profile</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
@ -931,7 +963,8 @@ process URL paths that contain the <code class="highlighter-rouge">.</code> (dot
<span class="p">})</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
<p><strong>NOTE</strong>: For <code class="highlighter-rouge">https</code> deployments, the default Blockstack Core API endpoint for name
lookups should be changed to point to a core API served over <code class="highlighter-rouge">https</code>.
@ -943,7 +976,7 @@ process URL paths that contain the <code class="highlighter-rouge">.</code> (dot
<li>
<p>Add the following block to <code class="highlighter-rouge">fetchData()</code> right after the call to <code class="highlighter-rouge">lookupProfile(username)... catch((error)=&gt;{..}</code> block:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="kd">const</span> <span class="nx">options</span> <span class="o">=</span> <span class="p">{</span> <span class="na">username</span><span class="p">:</span> <span class="nx">username</span><span class="p">,</span> <span class="na">decrypt</span><span class="p">:</span> <span class="kc">false</span> <span class="p">}</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="kr">const</span> <span class="nx">options</span> <span class="o">=</span> <span class="p">{</span> <span class="na">username</span><span class="p">:</span> <span class="nx">username</span><span class="p">,</span> <span class="na">decrypt</span><span class="p">:</span> <span class="kc">false</span> <span class="p">}</span>
<span class="nx">getFile</span><span class="p">(</span><span class="s1">'statuses.json'</span><span class="p">,</span> <span class="nx">options</span><span class="p">)</span>
<span class="p">.</span><span class="nx">then</span><span class="p">((</span><span class="nx">file</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">statuses</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">file</span> <span class="o">||</span> <span class="s1">'[]'</span><span class="p">)</span>
@ -958,7 +991,8 @@ process URL paths that contain the <code class="highlighter-rouge">.</code> (dot
<span class="p">.</span><span class="k">finally</span><span class="p">(()</span> <span class="o">=&gt;</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">setState</span><span class="p">({</span> <span class="na">isLoading</span><span class="p">:</span> <span class="kc">false</span> <span class="p">})</span>
<span class="p">})</span>
</code></pre></div> </div>
</code></pre>
</div>
<p>This fetches the user statuses.</p>
@ -967,10 +1001,10 @@ process URL paths that contain the <code class="highlighter-rouge">.</code> (dot
<li>
<p>Replace the <code class="highlighter-rouge">render()</code> method with the following:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nx">render</span><span class="p">()</span> <span class="p">{</span>
<span class="kd">const</span> <span class="p">{</span> <span class="nx">handleSignOut</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">props</span><span class="p">;</span>
<span class="kd">const</span> <span class="p">{</span> <span class="nx">person</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">;</span>
<span class="kd">const</span> <span class="p">{</span> <span class="nx">username</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">;</span>
<div class="language-javascript highlighter-rouge"><pre class="highlight"><code> <span class="nx">render</span><span class="p">()</span> <span class="p">{</span>
<span class="kr">const</span> <span class="p">{</span> <span class="nx">handleSignOut</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">props</span><span class="p">;</span>
<span class="kr">const</span> <span class="p">{</span> <span class="nx">person</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">;</span>
<span class="kr">const</span> <span class="p">{</span> <span class="nx">username</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">;</span>
<span class="k">return</span> <span class="p">(</span>
<span class="o">!</span><span class="nx">isSignInPending</span><span class="p">()</span> <span class="o">&amp;&amp;</span> <span class="nx">person</span> <span class="p">?</span>
@ -983,8 +1017,8 @@ process URL paths that contain the <code class="highlighter-rouge">.</code> (dot
<span class="nx">src</span><span class="o">=</span><span class="p">{</span> <span class="nx">person</span><span class="p">.</span><span class="nx">avatarUrl</span><span class="p">()</span> <span class="p">?</span> <span class="nx">person</span><span class="p">.</span><span class="nx">avatarUrl</span><span class="p">()</span> <span class="p">:</span> <span class="nx">avatarFallbackImage</span> <span class="p">}</span>
<span class="nx">className</span><span class="o">=</span><span class="s2">"img-rounded avatar"</span>
<span class="nx">id</span><span class="o">=</span><span class="s2">"avatar-image"</span>
<span class="o">/&gt;</span>
<span class="o">&lt;</span><span class="nx">div</span> <span class="nx">className</span><span class="o">=</span><span class="s2">"username"</span><span class="o">&gt;</span>
<span class="sr">/</span><span class="err">&gt;
</span> <span class="o">&lt;</span><span class="nx">div</span> <span class="nx">className</span><span class="o">=</span><span class="s2">"username"</span><span class="o">&gt;</span>
<span class="o">&lt;</span><span class="nx">h1</span><span class="o">&gt;</span>
<span class="o">&lt;</span><span class="nx">span</span> <span class="nx">id</span><span class="o">=</span><span class="s2">"heading-name"</span><span class="o">&gt;</span><span class="p">{</span> <span class="nx">person</span><span class="p">.</span><span class="nx">name</span><span class="p">()</span> <span class="p">?</span> <span class="nx">person</span><span class="p">.</span><span class="nx">name</span><span class="p">()</span>
<span class="p">:</span> <span class="s1">'Nameless Person'</span> <span class="p">}</span><span class="o">&lt;</span><span class="sr">/span</span><span class="err">&gt;
@ -1006,8 +1040,8 @@ process URL paths that contain the <code class="highlighter-rouge">.</code> (dot
<span class="nx">value</span><span class="o">=</span><span class="p">{</span><span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">.</span><span class="nx">newStatus</span><span class="p">}</span>
<span class="nx">onChange</span><span class="o">=</span><span class="p">{</span><span class="nx">e</span> <span class="o">=&gt;</span> <span class="k">this</span><span class="p">.</span><span class="nx">handleNewStatusChange</span><span class="p">(</span><span class="nx">e</span><span class="p">)}</span>
<span class="nx">placeholder</span><span class="o">=</span><span class="s2">"What's on your mind?"</span>
<span class="o">/&gt;</span>
<span class="o">&lt;</span><span class="sr">/div</span><span class="err">&gt;
<span class="sr">/</span><span class="err">&gt;
</span> <span class="o">&lt;</span><span class="sr">/div</span><span class="err">&gt;
</span> <span class="o">&lt;</span><span class="nx">div</span> <span class="nx">className</span><span class="o">=</span><span class="s2">"col-md-12 text-right"</span><span class="o">&gt;</span>
<span class="o">&lt;</span><span class="nx">button</span>
<span class="nx">className</span><span class="o">=</span><span class="s2">"btn btn-primary btn-lg"</span>
@ -1032,9 +1066,10 @@ process URL paths that contain the <code class="highlighter-rouge">.</code> (dot
</span> <span class="o">&lt;</span><span class="sr">/div&gt; : nul</span><span class="err">l
</span> <span class="p">);</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
<p>### This checks to ensure that users are viewing their own profile, by wrapping the <strong>Logout</strong> button and inputs with the <code class="highlighter-rouge">{isLocal() &amp;&amp; ...}</code> condition.</p>
<p>### This checks to ensure that users are viewing their own profile, by wrapping the <strong>Logout</strong> button and inputs with the <code class="highlighter-rouge"><span class="p">{</span><span class="err">isLocal()</span><span class="w"> </span><span class="err">&amp;&amp;</span><span class="w"> </span><span class="err">...</span><span class="p">}</span></code> condition.</p>
</li>
</ol>
@ -1045,8 +1080,9 @@ process URL paths that contain the <code class="highlighter-rouge">.</code> (dot
<li>
<p>Restart the application so that the disabling of the <code class="highlighter-rouge">.</code> (dot) rule takes effect.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> npm start
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> npm start
</code></pre>
</div>
</li>
<li>Point your browser to <code class="highlighter-rouge">http://localhost:8080/your_blockstack.id</code> to see the final application.</li>
</ol>

142
_site/browser/todo-list.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Todo List Application Tutorial | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Todo List Application Tutorial" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/browser/todo-list.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/browser/todo-list.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Todo List Application Tutorial","dateModified":"2018-10-17T09:26:44-07:00","description":"Todo List Application Tutorial","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/browser/todo-list.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/browser/todo-list.html","headline":"Todo List Application Tutorial","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/browser/todo-list.html"},"description":"Todo List Application Tutorial","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -195,13 +195,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-browser/blob/master/docs/todo-list.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>
@ -251,9 +251,10 @@ with that ID using Blockstack Storage (Gaia).</p>
<p>The tutorial relies on the <code class="highlighter-rouge">npm</code> dependency manager. Before you begin, verify you have installed <code class="highlighter-rouge">npm</code> using the <code class="highlighter-rouge">which</code> command to verify.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>which npm
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>which npm
/usr/local/bin/npm
</code></pre></div></div>
</code></pre>
</div>
<p>If you don’t find <code class="highlighter-rouge">npm</code> in your system, <a href="https://www.npmjs.com/get-npm">install it</a>.</p>
<p>Finally, make sure you have <a href="{site.baseurl}}/browser/ids-introduction.html#create-an-initial-blockstack-id">created at least one Blockstack ID</a>.
@ -270,19 +271,21 @@ These instructions assume you are cloning.</p>
<li>
<p>Install the code by cloning it.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> $ git clone git@github.com:blockstack/blockstack-todos.git
</code></pre></div> </div>
<div class="highlighter-rouge"><pre class="highlight"><code> $ git clone git@github.com:blockstack/blockstack-todos.git
</code></pre>
</div>
</li>
<li>
<p>Change to directory to the root of the code.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> $ cd blockstack-todos
</code></pre></div> </div>
<div class="highlighter-rouge"><pre class="highlight"><code> $ cd blockstack-todos
</code></pre>
</div>
</li>
<li>
<p>Use <code class="highlighter-rouge">yarn</code> to install the dependencies.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> $ yarn install
<div class="highlighter-rouge"><pre class="highlight"><code> $ yarn install
yarn install v1.9.2
info No lockfile found.
...
@ -290,7 +293,8 @@ These instructions assume you are cloning.</p>
[5/5] 📃 Building fresh packages...
success Saved lockfile.
✨ Done in 19.90s.
</code></pre></div> </div>
</code></pre>
</div>
</li>
</ol>
@ -331,15 +335,17 @@ These instructions assume you are cloning.</p>
<li>
<p>Make sure you are in the root of the code base.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nv">$ </span><span class="nb">pwd</span> /Users/moxiegirl/repos/blockstack-todos
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nv">$ </span><span class="nb">pwd</span> /Users/moxiegirl/repos/blockstack-todos
Start the application.
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Start the application.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> $ npm run start
</code></pre></div> </div>
<div class="highlighter-rouge"><pre class="highlight"><code> $ npm run start
</code></pre>
</div>
<p>You should see a simple application:</p>
@ -385,25 +391,26 @@ parameter:</p>
<p>The output should look similar to below:</p>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"jti"</span><span class="p">:</span><span class="w"> </span><span class="s2">"3i96e3ad-0626-4e32-a316-b243154212e2"</span><span class="p">,</span><span class="w">
</span><span class="s2">"iat"</span><span class="p">:</span><span class="w"> </span><span class="mi">1533136622</span><span class="p">,</span><span class="w">
</span><span class="s2">"exp"</span><span class="p">:</span><span class="w"> </span><span class="mi">1533140228</span><span class="p">,</span><span class="w">
</span><span class="s2">"iss"</span><span class="p">:</span><span class="w"> </span><span class="s2">"did:btc-addr:1Nh8oQTunbEQWjrL666HBx2qMc81puLmMt"</span><span class="p">,</span><span class="w">
</span><span class="s2">"public_keys"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
<div class="language-json highlighter-rouge"><pre class="highlight"><code><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nt">"jti"</span><span class="p">:</span><span class="w"> </span><span class="s2">"3i96e3ad-0626-4e32-a316-b243154212e2"</span><span class="p">,</span><span class="w">
</span><span class="nt">"iat"</span><span class="p">:</span><span class="w"> </span><span class="mi">1533136622</span><span class="p">,</span><span class="w">
</span><span class="nt">"exp"</span><span class="p">:</span><span class="w"> </span><span class="mi">1533140228</span><span class="p">,</span><span class="w">
</span><span class="nt">"iss"</span><span class="p">:</span><span class="w"> </span><span class="s2">"did:btc-addr:1Nh8oQTunbEQWjrL666HBx2qMc81puLmMt"</span><span class="p">,</span><span class="w">
</span><span class="nt">"public_keys"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="s2">"0362173da080c6e1dec0653fa9a3eff5f5660546e387ce6c24u04a90c2fe1fdu73"</span><span class="w">
</span><span class="p">],</span><span class="w">
</span><span class="s2">"domain_name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"http://localhost:8080"</span><span class="p">,</span><span class="w">
</span><span class="s2">"manifest_uri"</span><span class="p">:</span><span class="w"> </span><span class="s2">"http://localhost:8080/manifest.json"</span><span class="p">,</span><span class="w">
</span><span class="s2">"redirect_uri"</span><span class="p">:</span><span class="w"> </span><span class="s2">"http://localhost:8080/"</span><span class="p">,</span><span class="w">
</span><span class="s2">"version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1.2.0"</span><span class="p">,</span><span class="w">
</span><span class="s2">"do_not_include_profile"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
</span><span class="s2">"supports_hub_url"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
</span><span class="s2">"scopes"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="nt">"domain_name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"http://localhost:8080"</span><span class="p">,</span><span class="w">
</span><span class="nt">"manifest_uri"</span><span class="p">:</span><span class="w"> </span><span class="s2">"http://localhost:8080/manifest.json"</span><span class="p">,</span><span class="w">
</span><span class="nt">"redirect_uri"</span><span class="p">:</span><span class="w"> </span><span class="s2">"http://localhost:8080/"</span><span class="p">,</span><span class="w">
</span><span class="nt">"version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1.2.0"</span><span class="p">,</span><span class="w">
</span><span class="nt">"do_not_include_profile"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
</span><span class="nt">"supports_hub_url"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
</span><span class="nt">"scopes"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="s2">"store_write"</span><span class="w">
</span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div> </div>
</span></code></pre>
</div>
<blockquote>
<p><strong>Note</strong>:</p>
@ -453,15 +460,16 @@ in and sign out is handled in each of these files:</p>
<p>The <code class="highlighter-rouge">src/components/Landing.vue</code> code calls a <a href="https://blockstack.github.io/blockstack.js#redirectToSignIn"><code class="highlighter-rouge">redirectToSignIn()</code></a> function which generates the <code class="highlighter-rouge">authRequest</code> and redirects the user to the Blockstack authenticator:</p>
<div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nx">signIn</span> <span class="p">()</span> <span class="p">{</span>
<span class="kd">const</span> <span class="nx">blockstack</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">blockstack</span>
<div class="language-js highlighter-rouge"><pre class="highlight"><code><span class="nx">signIn</span> <span class="p">()</span> <span class="p">{</span>
<span class="kr">const</span> <span class="nx">blockstack</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">blockstack</span>
<span class="nx">blockstack</span><span class="p">.</span><span class="nx">redirectToSignIn</span><span class="p">()</span>
<span class="p">}</span>
</code></pre></div></div>
</code></pre>
</div>
<p>Once the user authenticates, the application handles the <code class="highlighter-rouge">authResponse</code> in the <code class="highlighter-rouge">src/App.vue</code> file. :</p>
<div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">if</span> <span class="p">(</span><span class="nx">blockstack</span><span class="p">.</span><span class="nx">isUserSignedIn</span><span class="p">())</span> <span class="p">{</span>
<div class="language-js highlighter-rouge"><pre class="highlight"><code><span class="k">if</span> <span class="p">(</span><span class="nx">blockstack</span><span class="p">.</span><span class="nx">isUserSignedIn</span><span class="p">())</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">user</span> <span class="o">=</span> <span class="nx">blockstack</span><span class="p">.</span><span class="nx">loadUserData</span><span class="p">().</span><span class="nx">profile</span>
<span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">blockstack</span><span class="p">.</span><span class="nx">isSignInPending</span><span class="p">())</span> <span class="p">{</span>
<span class="nx">blockstack</span><span class="p">.</span><span class="nx">handlePendingSignIn</span><span class="p">()</span>
@ -469,16 +477,18 @@ in and sign out is handled in each of these files:</p>
<span class="nb">window</span><span class="p">.</span><span class="nx">location</span> <span class="o">=</span> <span class="nb">window</span><span class="p">.</span><span class="nx">location</span><span class="p">.</span><span class="nx">origin</span>
<span class="p">})</span>
<span class="p">}</span>
</code></pre></div></div>
</code></pre>
</div>
<p>If <a href="https://blockstack.github.io/blockstack.js/#isusersignedin"><code class="highlighter-rouge">blockstack.isUserSignedIn()</code></a> is true, the user was previously signed in so Blockstack pulls the data from the browser and uses it in our application. If the check on <a href="https://blockstack.github.io/blockstack.js/#issigninpending"><code class="highlighter-rouge">blockstack.isSignInPending()</code></a> is true, a previous <code class="highlighter-rouge">authResponse</code> was sent to the application but hasn’t been processed yet. The <code class="highlighter-rouge">handlePendingSignIn()</code> function processes any pending sign in.</p>
<p>Signout is handled in <code class="highlighter-rouge">src/components/Dashboard.vue</code>.</p>
<div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nx">signOut</span> <span class="p">()</span> <span class="p">{</span>
<div class="language-js highlighter-rouge"><pre class="highlight"><code><span class="nx">signOut</span> <span class="p">()</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">blockstack</span><span class="p">.</span><span class="nx">signUserOut</span><span class="p">(</span><span class="nb">window</span><span class="p">.</span><span class="nx">location</span><span class="p">.</span><span class="nx">href</span><span class="p">)</span>
<span class="p">}</span>
</code></pre></div></div>
</code></pre>
</div>
<p>The method allows the application creator to decide where to redirect the user upon Sign Out:</p>
@ -499,42 +509,44 @@ command:</p>
<p>You should see a JSON with the todos you just added:</p>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">[</span><span class="w">
<div class="language-json highlighter-rouge"><pre class="highlight"><code><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="s2">"id"</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span><span class="w">
</span><span class="s2">"text"</span><span class="p">:</span><span class="s2">"Software package manager secured by the blockchain"</span><span class="p">,</span><span class="w">
</span><span class="s2">"completed"</span><span class="p">:</span><span class="kc">false</span><span class="w">
</span><span class="nt">"id"</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span><span class="w">
</span><span class="nt">"text"</span><span class="p">:</span><span class="s2">"Software package manager secured by the blockchain"</span><span class="p">,</span><span class="w">
</span><span class="nt">"completed"</span><span class="p">:</span><span class="kc">false</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="s2">"id"</span><span class="p">:</span><span class="mi">1</span><span class="p">,</span><span class="w">
</span><span class="s2">"text"</span><span class="p">:</span><span class="s2">"Mutable torrents with human readable names"</span><span class="p">,</span><span class="w">
</span><span class="s2">"completed"</span><span class="p">:</span><span class="kc">false</span><span class="w">
</span><span class="nt">"id"</span><span class="p">:</span><span class="mi">1</span><span class="p">,</span><span class="w">
</span><span class="nt">"text"</span><span class="p">:</span><span class="s2">"Mutable torrents with human readable names"</span><span class="p">,</span><span class="w">
</span><span class="nt">"completed"</span><span class="p">:</span><span class="kc">false</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="s2">"id"</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span><span class="w">
</span><span class="s2">"text"</span><span class="p">:</span><span class="s2">"Decentralized twitter"</span><span class="p">,</span><span class="w">
</span><span class="s2">"completed"</span><span class="p">:</span><span class="kc">false</span><span class="w">
</span><span class="nt">"id"</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span><span class="w">
</span><span class="nt">"text"</span><span class="p">:</span><span class="s2">"Decentralized twitter"</span><span class="p">,</span><span class="w">
</span><span class="nt">"completed"</span><span class="p">:</span><span class="kc">false</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span></code></pre></div></div>
</span></code></pre>
</div>
<p>Add another todo and check it off. When you fetch the newly generated file
using the Javascript console, the results reflect your change. Look for <code class="highlighter-rouge">"completed":true</code>:</p>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">[</span><span class="w">
<div class="language-json highlighter-rouge"><pre class="highlight"><code><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="s2">"id"</span><span class="p">:</span><span class="mi">3</span><span class="p">,</span><span class="w">
</span><span class="s2">"text"</span><span class="p">:</span><span class="s2">"Blockstack Todo"</span><span class="p">,</span><span class="w">
</span><span class="s2">"completed"</span><span class="p">:</span><span class="kc">true</span><span class="w">
</span><span class="nt">"id"</span><span class="p">:</span><span class="mi">3</span><span class="p">,</span><span class="w">
</span><span class="nt">"text"</span><span class="p">:</span><span class="s2">"Blockstack Todo"</span><span class="p">,</span><span class="w">
</span><span class="nt">"completed"</span><span class="p">:</span><span class="kc">true</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="s2">"id"</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span><span class="w">
</span><span class="s2">"text"</span><span class="p">:</span><span class="s2">"Software package manager secured by the blockchain"</span><span class="p">,</span><span class="w">
</span><span class="s2">"completed"</span><span class="p">:</span><span class="kc">false</span><span class="w">
</span><span class="nt">"id"</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span><span class="w">
</span><span class="nt">"text"</span><span class="p">:</span><span class="s2">"Software package manager secured by the blockchain"</span><span class="p">,</span><span class="w">
</span><span class="nt">"completed"</span><span class="p">:</span><span class="kc">false</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="err">...</span><span class="w">
</span><span class="p">]</span><span class="w">
</span></code></pre></div></div>
</span></code></pre>
</div>
<p>Now that you have seen the application in action, dig into how it works.</p>
@ -545,16 +557,17 @@ application interactions with your Gaia Hub originate in the
<code class="highlighter-rouge">src/components/Dashboard.vue</code> file. First, examine where the changes to the
Todos are processed:</p>
<div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nx">todos</span><span class="p">:</span> <span class="p">{</span>
<div class="language-js highlighter-rouge"><pre class="highlight"><code><span class="nx">todos</span><span class="err">:</span> <span class="p">{</span>
<span class="nl">handler</span><span class="p">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">todos</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">const</span> <span class="nx">blockstack</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">blockstack</span>
<span class="kr">const</span> <span class="nx">blockstack</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">blockstack</span>
<span class="c1">// encryption is now enabled by default</span>
<span class="k">return</span> <span class="nx">blockstack</span><span class="p">.</span><span class="nx">putFile</span><span class="p">(</span><span class="nx">STORAGE_FILE</span><span class="p">,</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">stringify</span><span class="p">(</span><span class="nx">todos</span><span class="p">))</span>
<span class="p">},</span>
<span class="nx">deep</span><span class="p">:</span> <span class="kc">true</span>
<span class="nx">deep</span><span class="err">:</span> <span class="kc">true</span>
<span class="p">}</span>
</code></pre></div></div>
</code></pre>
</div>
<p>The <code class="highlighter-rouge">todos</code> JSON object is passed in and the
<a href="https://blockstack.github.io/blockstack.js/#putfile"><code class="highlighter-rouge">blockstack.putFile()</code></a>
@ -562,8 +575,8 @@ method to store it in a Gaia Hub.</p>
<p>The code needs to read the Todo items from the storage with the <a href="https://blockstack.github.io/blockstack.js/#getfile"><code class="highlighter-rouge">blockstack.getFile()</code></a> method which returns a promise:</p>
<div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nx">fetchData</span> <span class="p">()</span> <span class="p">{</span>
<span class="kd">const</span> <span class="nx">blockstack</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">blockstack</span>
<div class="language-js highlighter-rouge"><pre class="highlight"><code><span class="nx">fetchData</span> <span class="p">()</span> <span class="p">{</span>
<span class="kr">const</span> <span class="nx">blockstack</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">blockstack</span>
<span class="nx">blockstack</span><span class="p">.</span><span class="nx">getFile</span><span class="p">(</span><span class="nx">STORAGE_FILE</span><span class="p">)</span> <span class="c1">// decryption is enabled by default</span>
<span class="p">.</span><span class="nx">then</span><span class="p">((</span><span class="nx">todosText</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">todos</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">todosText</span> <span class="o">||</span> <span class="s1">'[]'</span><span class="p">)</span>
@ -574,7 +587,8 @@ method to store it in a Gaia Hub.</p>
<span class="k">this</span><span class="p">.</span><span class="nx">todos</span> <span class="o">=</span> <span class="nx">todos</span>
<span class="p">})</span>
<span class="p">},</span>
</code></pre></div></div>
</code></pre>
</div>
<p>The <code class="highlighter-rouge">todos</code> data is retrieved from the promise.</p>

4
_site/changelog/index.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Changelog | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Changelog" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,7 +17,7 @@
<meta property="og:url" content="https://docs.blockstack.org/changelog/" />
<meta property="og:site_name" content="Blockstack" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/changelog/","author":{"@type":"Person","name":"Blockstack"},"headline":"Changelog","description":"Docs","@type":"WebPage","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/changelog/","headline":"Changelog","author":{"@type":"Person","name":"Blockstack"},"description":"Docs","@type":"WebPage","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->

10
_site/common/construction.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Excuse our dust! | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Excuse our dust!" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/common/construction.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/common/construction.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Excuse our dust!","dateModified":"2018-10-17T09:26:44-07:00","description":"Excuse our dust!","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/common/construction.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/common/construction.html","headline":"Excuse our dust!","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/common/construction.html"},"description":"Excuse our dust!","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -151,13 +151,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/moxiegirl/docs.blockstack/construction.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>

4
_site/contact/index.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Got Any Questions? | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Got Any Questions?" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,7 +17,7 @@
<meta property="og:url" content="https://docs.blockstack.org/contact/" />
<meta property="og:site_name" content="Blockstack" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/contact/","author":{"@type":"Person","name":"Blockstack"},"headline":"Got Any Questions?","description":"Docs","@type":"WebPage","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/contact/","headline":"Got Any Questions?","author":{"@type":"Person","name":"Blockstack"},"description":"Docs","@type":"WebPage","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->

20
_site/core/atlas/howitworks.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>How Atlas Works | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="How Atlas Works" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/core/atlas/howitworks.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/core/atlas/howitworks.html","author":{"@type":"Person","name":"Blockstack"},"headline":"How Atlas Works","dateModified":"2018-10-17T09:26:44-07:00","description":"How Atlas Works","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/atlas/howitworks.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/core/atlas/howitworks.html","headline":"How Atlas Works","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/atlas/howitworks.html"},"description":"How Atlas Works","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -274,13 +274,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-core/blob/master/docs/howitworks.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>
@ -429,7 +429,7 @@ find out which chunks they each have. Atlas nodes download chunks from
neighbors in rarest-first order in order to prioritize data replication for the
chunks that are currently most at-risk for disappearing due to node failure.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> Name operation | chunk hashes | chunk data | Inventory
<div class="highlighter-rouge"><pre class="highlight"><code> Name operation | chunk hashes | chunk data | Inventory
history | as name state | | vector
+-------------------+
@ -457,18 +457,20 @@ it has and which ones it does not, and announces it to other Atlas peers so
they can fetch chunks they are missing. In this example, the node's
inventory vector is [1, 0, 1], since the 0th and 2nd chunks are present
but the 1st chunk is missing.
</code></pre></div></div>
</code></pre>
</div>
<h2 id="querying-chunk-inventories">Querying Chunk Inventories</h2>
<p>Developers can query a node’s inventory vector as follows:</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">&gt;&gt;&gt;</span> <span class="kn">import</span> <span class="nn">blockstack</span>
<div class="language-python highlighter-rouge"><pre class="highlight"><code><span class="o">&gt;&gt;&gt;</span> <span class="kn">import</span> <span class="nn">blockstack</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">result</span> <span class="o">=</span> <span class="n">blockstack</span><span class="o">.</span><span class="n">lib</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">get_zonefile_inventory</span><span class="p">(</span><span class="s">"https://node.blockstack.org:6263"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">524288</span><span class="p">)</span>
<span class="o">&gt;&gt;&gt;</span> <span class="k">print</span> <span class="nb">len</span><span class="p">(</span><span class="n">result</span><span class="p">[</span><span class="s">'inv'</span><span class="p">])</span>
<span class="mi">11278</span>
<span class="o">&gt;&gt;&gt;</span>
</code></pre></div></div>
</code></pre>
</div>
<p>The variable <code class="highlighter-rouge">result['inv']</code> here is a big-endian bit vector, where the <em>i</em>th
bit is set to 1 if the <em>i</em>th chunk in the chunk sequence is present. The bit at

35
_site/core/atlas/howtouse.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>How to Use the Atlas Network | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="How to Use the Atlas Network" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/core/atlas/howtouse.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/core/atlas/howtouse.html","author":{"@type":"Person","name":"Blockstack"},"headline":"How to Use the Atlas Network","dateModified":"2018-10-17T09:26:44-07:00","description":"How to Use the Atlas Network","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/atlas/howtouse.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/core/atlas/howtouse.html","headline":"How to Use the Atlas Network","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/atlas/howtouse.html"},"description":"How to Use the Atlas Network","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -274,13 +274,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-core/blob/master/docs/howtouse.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>
@ -321,7 +321,7 @@ chunk data. A client can query up to 100 chunks in one RPC call.</p>
the returned payload will be a <code class="highlighter-rouge">dict</code> with a <code class="highlighter-rouge">zonefiles</code> key that maps the chunk
hashes to their respective data.</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">&gt;&gt;&gt;</span> <span class="kn">import</span> <span class="nn">blockstack</span>
<div class="language-python highlighter-rouge"><pre class="highlight"><code><span class="o">&gt;&gt;&gt;</span> <span class="kn">import</span> <span class="nn">blockstack</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">data</span> <span class="o">=</span> <span class="n">blockstack</span><span class="o">.</span><span class="n">lib</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">get_zonefiles</span><span class="p">(</span><span class="s">'https://node.blockstack.org:6263'</span><span class="p">,</span> <span class="p">[</span><span class="s">'1b89a685f4c4ea245ce9433d0b29166c22175ab4'</span><span class="p">])</span>
<span class="o">&gt;&gt;&gt;</span> <span class="k">print</span> <span class="n">data</span><span class="p">[</span><span class="s">'zonefiles'</span><span class="p">][</span><span class="s">'1b89a685f4c4ea245ce9433d0b29166c22175ab4'</span><span class="p">]</span>
<span class="err">$</span><span class="n">ORIGIN</span> <span class="n">duckduckgo_tor</span><span class="o">.</span><span class="nb">id</span>
@ -329,7 +329,8 @@ hashes to their respective data.</p>
<span class="n">tor</span> <span class="n">TXT</span> <span class="s">"3g2upl4pq6kufc4m.onion"</span>
<span class="o">&gt;&gt;&gt;</span>
</code></pre></div></div>
</code></pre>
</div>
<p>(This particular chunk happens to be associated with the BNS name
<code class="highlighter-rouge">duckduckgo_tor.id</code>).</p>
@ -355,14 +356,15 @@ Browser</a> for doing this.</p>
<p>Once the name operation is confirmed, you can announce the data to the
Atlas network. You can do so with the Python client as follows:</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">&gt;&gt;&gt;</span> <span class="kn">import</span> <span class="nn">blockstack</span>
<div class="language-python highlighter-rouge"><pre class="highlight"><code><span class="o">&gt;&gt;&gt;</span> <span class="kn">import</span> <span class="nn">blockstack</span>
<span class="o">&gt;&gt;&gt;</span> <span class="kn">import</span> <span class="nn">base64</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">data</span> <span class="o">=</span> <span class="s">"..."</span> <span class="c1"># this is the chunk data you will announce
</span><span class="o">&gt;&gt;&gt;</span> <span class="n">data_b64</span> <span class="o">=</span> <span class="n">base64</span><span class="o">.</span><span class="n">b64encode</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">data</span> <span class="o">=</span> <span class="s">"..."</span> <span class="c"># this is the chunk data you will announce</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">data_b64</span> <span class="o">=</span> <span class="n">base64</span><span class="o">.</span><span class="n">b64encode</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">result</span> <span class="o">=</span> <span class="n">blockstack</span><span class="o">.</span><span class="n">lib</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">put_zonefiles</span><span class="p">(</span><span class="s">'https://node.blockstack.org:6263'</span><span class="p">,</span> <span class="p">[</span><span class="n">data_b64</span><span class="p">])</span>
<span class="o">&gt;&gt;&gt;</span> <span class="k">assert</span> <span class="n">result</span><span class="p">[</span><span class="s">'saved'</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="mi">1</span>
<span class="o">&gt;&gt;&gt;</span>
</code></pre></div></div>
</code></pre>
</div>
<p>At most five chunks can be announced in one RPC call.
Note that the data must be base64-encoded before it can be announced.</p>
@ -390,22 +392,23 @@ peer graph, and replicate the chunk to each of them as well.</p>
<p>For example, this code will replicate the chunk to not only
<code class="highlighter-rouge">https://node.blockstack.org:6263</code>, but also to its immediate neighbors.</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">&gt;&gt;&gt;</span> <span class="kn">import</span> <span class="nn">blockstack</span>
<div class="language-python highlighter-rouge"><pre class="highlight"><code><span class="o">&gt;&gt;&gt;</span> <span class="kn">import</span> <span class="nn">blockstack</span>
<span class="o">&gt;&gt;&gt;</span> <span class="kn">import</span> <span class="nn">base64</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">data</span> <span class="o">=</span> <span class="s">"..."</span> <span class="c1"># this is the chunk you will replicate widely
</span><span class="o">&gt;&gt;&gt;</span> <span class="n">data_b64</span> <span class="o">=</span> <span class="n">base64</span><span class="o">.</span><span class="n">b64encode</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">data</span> <span class="o">=</span> <span class="s">"..."</span> <span class="c"># this is the chunk you will replicate widely</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">data_b64</span> <span class="o">=</span> <span class="n">base64</span><span class="o">.</span><span class="n">b64encode</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="o">&gt;&gt;&gt;</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">result</span> <span class="o">=</span> <span class="n">blockstack</span><span class="o">.</span><span class="n">lib</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">get_atlas_peers</span><span class="p">(</span><span class="s">'https://node.blockstack.org:6263'</span><span class="p">)</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">neighbors</span> <span class="o">=</span> <span class="n">result</span><span class="p">[</span><span class="s">'peers'</span><span class="p">]</span>
<span class="o">&gt;&gt;&gt;</span> <span class="k">print</span> <span class="s">", "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">neighbors</span><span class="p">)</span>
<span class="mf">13.65.207.163</span><span class="p">:</span><span class="mi">6264</span><span class="p">,</span> <span class="mf">52.225.128.191</span><span class="p">:</span><span class="mi">6264</span><span class="p">,</span> <span class="n">node</span><span class="o">.</span><span class="n">blockstack</span><span class="o">.</span><span class="n">org</span><span class="p">:</span><span class="mi">6264</span><span class="p">,</span> <span class="mf">23.102.162.7</span><span class="p">:</span><span class="mi">6264</span><span class="p">,</span> <span class="mf">52.167.230.235</span><span class="p">:</span><span class="mi">6264</span><span class="p">,</span> <span class="mf">23.102.162.124</span><span class="p">:</span><span class="mi">6264</span><span class="p">,</span> <span class="mf">52.151.59.26</span><span class="p">:</span><span class="mi">6264</span><span class="p">,</span> <span class="mf">13.92.134.106</span><span class="p">:</span><span class="mi">6264</span>
<span class="mf">13.65</span><span class="o">.</span><span class="mf">207.163</span><span class="p">:</span><span class="mi">6264</span><span class="p">,</span> <span class="mf">52.225</span><span class="o">.</span><span class="mf">128.191</span><span class="p">:</span><span class="mi">6264</span><span class="p">,</span> <span class="n">node</span><span class="o">.</span><span class="n">blockstack</span><span class="o">.</span><span class="n">org</span><span class="p">:</span><span class="mi">6264</span><span class="p">,</span> <span class="mf">23.102</span><span class="o">.</span><span class="mf">162.7</span><span class="p">:</span><span class="mi">6264</span><span class="p">,</span> <span class="mf">52.167</span><span class="o">.</span><span class="mf">230.235</span><span class="p">:</span><span class="mi">6264</span><span class="p">,</span> <span class="mf">23.102</span><span class="o">.</span><span class="mf">162.124</span><span class="p">:</span><span class="mi">6264</span><span class="p">,</span> <span class="mf">52.151</span><span class="o">.</span><span class="mf">59.26</span><span class="p">:</span><span class="mi">6264</span><span class="p">,</span> <span class="mf">13.92</span><span class="o">.</span><span class="mf">134.106</span><span class="p">:</span><span class="mi">6264</span>
<span class="o">&gt;&gt;&gt;</span>
<span class="o">&gt;&gt;&gt;</span> <span class="k">for</span> <span class="n">neighbor</span> <span class="ow">in</span> <span class="n">neighbors</span><span class="p">:</span>
<span class="o">...</span> <span class="n">result</span> <span class="o">=</span> <span class="n">blockstack</span><span class="o">.</span><span class="n">lib</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">put_zonefiles</span><span class="p">(</span><span class="n">neighbor</span><span class="p">,</span> <span class="p">[</span><span class="n">data_b64</span><span class="p">])</span>
<span class="o">...</span> <span class="k">assert</span> <span class="n">result</span><span class="p">[</span><span class="s">'saved'</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="mi">1</span>
<span class="o">...</span>
<span class="o">&gt;&gt;&gt;</span>
</code></pre></div></div>
</code></pre>
</div>
<p>This is not strictly necessary, but it does help accelerate chunk replication
and makes it less likely that a chunk will get lost due to individual node

15
_site/core/atlas/overview.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Overview of the Atlas network | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Overview of the Atlas network" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/core/atlas/overview.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/core/atlas/overview.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Overview of the Atlas network","dateModified":"2018-10-17T09:26:44-07:00","description":"Overview of the Atlas network","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/atlas/overview.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/core/atlas/overview.html","headline":"Overview of the Atlas network","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/atlas/overview.html"},"description":"Overview of the Atlas network","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -274,13 +274,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-core/blob/master/docs/overview.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>
@ -328,7 +328,7 @@ propagate them to the Atlas network. BNS API endpoints, including our
will automatically fetch zone files from Atlas when they need to look
up data in Gaia (such as profiles and app data).</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> +--------------+ +---------------+ +----------------+
<div class="highlighter-rouge"><pre class="highlight"><code> +--------------+ +---------------+ +----------------+
clients | Blockstack | | blockstack.js | | BNS API module |
| Browser | | | | |
+--------------+ +---------------+ +----------------+
@ -363,7 +363,8 @@ up zone files for names using the name's stat value as a zone file hash. Client
can broadcast zone files to the network if they match a previously-announced
hash. In practice, zone files store URLs to a name owner's Gaia hubs, thereby
allowing Blockstack apps to read and write data in Gaia.
</code></pre></div></div>
</code></pre>
</div>
<p>Nevertheless, Atlas is a general-purpose content-addressed storage
system that advanced developers can use to <strong>host data in an immutable

22
_site/core/faq_developer.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Developer FAQs | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Developer FAQs" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/core/faq_developer.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/core/faq_developer.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Developer FAQs","dateModified":"2018-10-17T09:26:44-07:00","description":"Developer FAQs","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/faq_developer.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/core/faq_developer.html","headline":"Developer FAQs","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/faq_developer.html"},"description":"Developer FAQs","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -195,13 +195,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-core/blob/master/docs/faq_developer.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>
@ -296,15 +296,17 @@ profile. For example, here’s how you would get public data from the
<ol>
<li>Get the bucket URL
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ BUCKET_URL</span><span class="o">=</span><span class="s2">"</span><span class="k">$(</span>curl <span class="nt">-sL</span> https://core.blockstack.org/v1/users/ryan.id | jq <span class="nt">-r</span> <span class="s1">'."ryan.id"["profile"]["apps"]["http://publik.ykliao.com"]'</span><span class="k">)</span><span class="s2">"</span>
<span class="nv">$ </span><span class="nb">echo</span> <span class="s2">"</span><span class="nv">$BUCKET_URL</span><span class="s2">"</span>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span><span class="nv">BUCKET_URL</span><span class="o">=</span><span class="s2">"</span><span class="k">$(</span>curl -sL https://core.blockstack.org/v1/users/ryan.id | jq -r <span class="s1">'."ryan.id"["profile"]["apps"]["http://publik.ykliao.com"]'</span><span class="k">)</span><span class="s2">"</span>
<span class="gp">$ </span><span class="nb">echo</span> <span class="s2">"</span><span class="nv">$BUCKET_URL</span><span class="s2">"</span>
https://gaia.blockstack.org/hub/1FrZTGQ8DM9TMPfGXtXMUvt2NNebLiSzad/
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>Get the data
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>curl <span class="nt">-sL</span> <span class="s2">"</span><span class="k">${</span><span class="nv">BUCKET_URL</span><span class="p">%%/</span><span class="k">}</span><span class="s2">/statuses.json"</span>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>curl -sL <span class="s2">"</span><span class="k">${</span><span class="nv">BUCKET_URL</span><span class="p">%%/</span><span class="k">}</span><span class="s2">/statuses.json"</span>
<span class="o">[{</span><span class="s2">"id"</span>:0,<span class="s2">"text"</span>:<span class="s2">"Hello, Blockstack!"</span>,<span class="s2">"created_at"</span>:1515786983492<span class="o">}]</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
</ol>

10
_site/core/faq_technical.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Blockstack Technical FAQ | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Blockstack Technical FAQ" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/core/faq_technical.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/core/faq_technical.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Blockstack Technical FAQ","dateModified":"2018-10-17T09:26:44-07:00","description":"Blockstack Technical FAQ","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/faq_technical.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/core/faq_technical.html","headline":"Blockstack Technical FAQ","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/faq_technical.html"},"description":"Blockstack Technical FAQ","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -274,13 +274,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-core/blob/master/docs/faq_technical.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>

40
_site/core/install-api.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Blockstack API | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Blockstack API" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/core/install-api.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/core/install-api.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Blockstack API","dateModified":"2018-10-17T09:26:44-07:00","description":"Blockstack API","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/install-api.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/core/install-api.html","headline":"Blockstack API","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/install-api.html"},"description":"Blockstack API","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -274,13 +274,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-core/blob/master/docs/install-api.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>
@ -302,7 +302,7 @@ Ubuntu are below.</p>
<li>
<p><strong>Step 2:</strong> Make sure you have <a href="http://docs.python-guide.org/en/latest/dev/virtualenvs/">virtualenv installed</a>.
Then, setup the API:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo apt-get install -y python-pip memcached rng-tools python-dev libmemcached-dev zlib1g-dev libgmp-dev libffi-dev libssl-dev
<div class="highlighter-rouge"><pre class="highlight"><code>$ sudo apt-get install -y python-pip memcached rng-tools python-dev libmemcached-dev zlib1g-dev libgmp-dev libffi-dev libssl-dev
$ sudo service memcached start
$ sudo pip install virtualenv
$ sudo npm -g install aglio
@ -315,7 +315,8 @@ $ blockstack setup_wallet
$ blockstack api start
$ deactivate
$ ./build_docs.sh public_api
</code></pre></div> </div>
</code></pre>
</div>
</li>
</ul>
@ -330,9 +331,10 @@ follow the instructions <a href="search.md">here</a>.</p>
<ul>
<li><strong>Step 1:</strong> Install nginx and uWSGI:
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo apt-get install -y nginx
<div class="highlighter-rouge"><pre class="highlight"><code>$ sudo apt-get install -y nginx
$ sudo pip install uwsgi
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li><strong>Step 2:</strong> Copy <a href="../api/nginx/config/nginx_sites-available/blockstack_api">this sample nginx sites file</a> to</li>
</ul>
@ -343,8 +345,9 @@ $ sudo pip install uwsgi
<p>and edit the paths depending on the uwsgi blockstack_api socket directory (defaults to /tmp/blockstack_api.sock)
You can test your nginx settings:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo nginx -t
</code></pre></div></div>
<div class="highlighter-rouge"><pre class="highlight"><code>$ sudo nginx -t
</code></pre>
</div>
<ul>
<li><strong>Step 3:</strong> Copy <a href="../api/nginx/config/systemd_system/blockstack_api.service">this sample systemd service file</a> to</li>
</ul>
@ -358,17 +361,19 @@ where your virtualenv is located.</p>
<p>Note: The following sed commands will work if the virtualenv is currently active and your shell is in the repo’s root directory.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo sed -i "s/User\=USER/User\=$USER/" /etc/systemd/system/blockstack_api.service
<div class="highlighter-rouge"><pre class="highlight"><code>$ sudo sed -i "s/User\=USER/User\=$USER/" /etc/systemd/system/blockstack_api.service
$ sudo sed -i "s#/path/to/blockstack#$PWD#" /etc/systemd/system/blockstack_api.service
$ sudo sed -i "s#/path/to/virtualenv#$VIRTUAL_ENV#" /etc/systemd/system/blockstack_api.service
</code></pre></div></div>
</code></pre>
</div>
<ul>
<li><strong>Step 4:</strong> Get a security certificate from <a href="https://letsencrypt.org/">Let’s Encrypt</a>.
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ git clone https://github.com/certbot/certbot.git
<div class="highlighter-rouge"><pre class="highlight"><code>$ git clone https://github.com/certbot/certbot.git
$ cd certbot/
$ ./certbot-auto --nginx -d &lt;your_domain&gt;
</code></pre></div> </div>
</code></pre>
</div>
</li>
</ul>
@ -376,9 +381,10 @@ $ ./certbot-auto --nginx -d &lt;your_domain&gt;
<ul>
<li><strong>Step 5:</strong> Start nginx and the Blockstack API uwsgi server:
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo systemctl restart blockstack_api
<div class="highlighter-rouge"><pre class="highlight"><code>sudo systemctl restart blockstack_api
sudo systemctl restart nginx
</code></pre></div> </div>
</code></pre>
</div>
</li>
</ul>

34
_site/core/memcached.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Installing Memcached | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Installing Memcached" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/core/memcached.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/core/memcached.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Installing Memcached","dateModified":"2018-10-17T09:26:44-07:00","description":"Installing Memcached","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/memcached.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/core/memcached.html","headline":"Installing Memcached","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/memcached.html"},"description":"Installing Memcached","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -274,13 +274,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-core/blob/master/docs/memcached.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>
@ -293,9 +293,10 @@ running locally.</p>
<h3 id="memcached-on-debian--ubuntu">Memcached on Debian &amp; Ubuntu:</h3>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo apt-get install -y python-dev libmemcached-dev zlib1g-dev
<div class="highlighter-rouge"><pre class="highlight"><code>$ sudo apt-get install -y python-dev libmemcached-dev zlib1g-dev
$ pip install pylibmc
</code></pre></div></div>
</code></pre>
</div>
<h3 id="memcached-on-macos">Memcached on macOS:</h3>
@ -303,25 +304,28 @@ $ pip install pylibmc
<p>After installing Homebrew:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ brew install memcached
<div class="highlighter-rouge"><pre class="highlight"><code>$ brew install memcached
$ brew install libmemcached
$ pip install pylibmc --install-option="--with-libmemcached=/usr/local/Cellar/libmemcached/1.0.18_1/"
</code></pre></div></div>
</code></pre>
</div>
<p>After installing, you can start memcached and check if it’s running properly:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ memcached -d
<div class="highlighter-rouge"><pre class="highlight"><code>$ memcached -d
$ echo stats | nc localhost 11211
</code></pre></div></div>
</code></pre>
</div>
<h3 id="memcached-on-heroku">Memcached on Heroku</h3>
<p>To deploy on Heroku:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>heroku create
<span class="nv">$ </span>heroku addons:add memcachedcloud
<span class="nv">$ </span>git push heroku master
</code></pre></div></div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>heroku create
<span class="gp">$ </span>heroku addons:add memcachedcloud
<span class="gp">$ </span>git push heroku master
</code></pre>
</div>
<div class="share uk-text-center">
<a href="https://twitter.com/intent/tweet?text=Installing Memcached&url=https://docs.blockstack.org/core/memcached.html&via=&related=" rel="nofollow" target="_blank" title="Share on Twitter" onclick="window.open(this.href, 'twitter', 'width=550,height=235');return false;"><span data-uk-icon="icon: twitter; ratio: 1.2"></span></a>

15
_site/core/naming/architecture.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Understand the Architecture | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Understand the Architecture" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/core/naming/architecture.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/core/naming/architecture.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Understand the Architecture","dateModified":"2018-10-17T09:26:44-07:00","description":"Understand the Architecture","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/architecture.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/core/naming/architecture.html","headline":"Understand the Architecture","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/architecture.html"},"description":"Understand the Architecture","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -274,13 +274,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-core/blob/master/docs/architecture.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>
@ -313,7 +313,7 @@ and modify names.</p>
<p>The BNS indexer and BNS API comprise the <strong>BNS node</strong>. An architectural schematic appears below.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> +-------------------------------------------------------+
<div class="highlighter-rouge"><pre class="highlight"><code> +-------------------------------------------------------+
RESTful | +----------------+ +--------------------+ |
+--------+ API | | | private API | | |
| client |&lt;------------&gt;| BNS API module |&lt;-----------&gt;| BNS indexer module | |
@ -339,7 +339,8 @@ the blochchain via a blockchain peer, over the blockchain's peer network.
Blockstack Core currently implements the API module and indexer module as separate
daemons (`blockstack api` and `blockstack-core`, respectively). However, this
is an implementation detail, and may change in the future.
</code></pre></div></div>
</code></pre>
</div>
<p>The BNS indexer implements the blockchain consensus rules and network protocols.
Its main responsibility is to build up and replicate all of the name state. It does

10
_site/core/naming/comparison.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Naming system feature comparison | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Naming system feature comparison" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/core/naming/comparison.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/core/naming/comparison.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Naming system feature comparison","dateModified":"2018-10-17T09:26:44-07:00","description":"Naming system feature comparison","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/comparison.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/core/naming/comparison.html","headline":"Naming system feature comparison","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/comparison.html"},"description":"Naming system feature comparison","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -274,13 +274,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-core/blob/master/docs/comparison.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>

10
_site/core/naming/creationhowto.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Creating a Namespace | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Creating a Namespace" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/core/naming/creationhowto.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/core/naming/creationhowto.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Creating a Namespace","dateModified":"2018-10-17T09:26:44-07:00","description":"Creating a Namespace","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/creationhowto.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/core/naming/creationhowto.html","headline":"Creating a Namespace","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/creationhowto.html"},"description":"Creating a Namespace","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -274,13 +274,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-core/blob/master/docs/creationhowto.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>

30
_site/core/naming/did.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Decentralized Identifiers (DIDs) | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Decentralized Identifiers (DIDs)" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/core/naming/did.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/core/naming/did.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Decentralized Identifiers (DIDs)","dateModified":"2018-10-17T09:26:44-07:00","description":"Decentralized Identifiers (DIDs)","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/did.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/core/naming/did.html","headline":"Decentralized Identifiers (DIDs)","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/did.html"},"description":"Decentralized Identifiers (DIDs)","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -274,13 +274,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-core/blob/master/docs/did.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>
@ -293,13 +293,14 @@ specification for decentralized identifiers (DIDs).</p>
<p>Each name in BNS has an associated DID. The DID format for BNS is:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> did:stack:v0:{address}-{index}
</code></pre></div></div>
<div class="highlighter-rouge"><pre class="highlight"><code> did:stack:v0:{address}-{index}
</code></pre>
</div>
<p>Where:</p>
<ul>
<li><code class="highlighter-rouge">{address}</code> is an on-chain public key hash (e.g. a Bitcoin address).</li>
<li><code class="highlighter-rouge">{index}</code> refers to the <code class="highlighter-rouge">nth</code> name this address created.</li>
<li><code class="highlighter-rouge"><span class="p">{</span><span class="err">address</span><span class="p">}</span></code> is an on-chain public key hash (e.g. a Bitcoin address).</li>
<li><code class="highlighter-rouge"><span class="p">{</span><span class="err">index</span><span class="p">}</span></code> refers to the <code class="highlighter-rouge">nth</code> name this address created.</li>
</ul>
<p>For example, the DID for <code class="highlighter-rouge">personal.id</code> is
@ -349,20 +350,20 @@ for subdomains, so the software can determine which code-path to take.</p>
<ul>
<li>
<p>For on-chain BNS names, the <code class="highlighter-rouge">{address}</code> is the same as the Bitcoin address
<p>For on-chain BNS names, the <code class="highlighter-rouge"><span class="p">{</span><span class="err">address</span><span class="p">}</span></code> is the same as the Bitcoin address
that owns the name. Currently, both version byte 0 and version byte 5
addresses are supported (i.e. addresses starting with <code class="highlighter-rouge">1</code> or <code class="highlighter-rouge">3</code>, meaning <code class="highlighter-rouge">p2pkh</code> and
<code class="highlighter-rouge">p2sh</code> addresses).</p>
</li>
<li>
<p>For off-chain BNS subdomains, the <code class="highlighter-rouge">{address}</code> has version byte 63 for
<p>For off-chain BNS subdomains, the <code class="highlighter-rouge"><span class="p">{</span><span class="err">address</span><span class="p">}</span></code> has version byte 63 for
subdomains owned by a single private key, and version byte 50 for subdomains
owned by a m-of-n set of private keys. That is, subdomain DID addresses start
with <code class="highlighter-rouge">S</code> or <code class="highlighter-rouge">M</code>, respectively.</p>
</li>
</ul>
<p>The <code class="highlighter-rouge">{index}</code> field for a subdomain’s DID is distinct from the <code class="highlighter-rouge">{index}</code> field
<p>The <code class="highlighter-rouge"><span class="p">{</span><span class="err">index</span><span class="p">}</span></code> field for a subdomain’s DID is distinct from the <code class="highlighter-rouge"><span class="p">{</span><span class="err">index</span><span class="p">}</span></code> field
for a BNS name’s DID, even if the same created both names and subdomains.
For example, the name <code class="highlighter-rouge">abcdefgh123456.id</code> has the DID <code class="highlighter-rouge">did:stack:v0:16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg-0</code>,
because it was the first name created by <code class="highlighter-rouge">16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg</code>.
@ -376,7 +377,7 @@ second is encoded with version byte 63).</p>
<p>You can see this play out in practice with the following code snippit:</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">&gt;&gt;&gt;</span> <span class="kn">import</span> <span class="nn">blockstack</span>
<div class="language-python highlighter-rouge"><pre class="highlight"><code><span class="o">&gt;&gt;&gt;</span> <span class="kn">import</span> <span class="nn">blockstack</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">blockstack</span><span class="o">.</span><span class="n">lib</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">get_name_record</span><span class="p">(</span><span class="s">'jude.statism.id'</span><span class="p">,</span> <span class="n">hostport</span><span class="o">=</span><span class="s">'https://node.blockstack.org:6263'</span><span class="p">)[</span><span class="s">'address'</span><span class="p">]</span>
<span class="s">u'16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg'</span>
<span class="o">&gt;&gt;&gt;</span> <span class="kn">import</span> <span class="nn">virtualchain</span>
@ -384,7 +385,8 @@ second is encoded with version byte 63).</p>
<span class="s">'SSXMcDiCZ7yFSQSUj7mWzmDcdwYhq97p2i'</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">blockstack</span><span class="o">.</span><span class="n">lib</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">resolve_DID</span><span class="p">(</span><span class="s">'did:stack:v0:SSXMcDiCZ7yFSQSUj7mWzmDcdwYhq97p2i-0'</span><span class="p">,</span> <span class="n">hostport</span><span class="o">=</span><span class="s">'https://node.blockstack.org:6263'</span><span class="p">)</span>
<span class="p">{</span><span class="s">'public_key'</span><span class="p">:</span> <span class="s">'020fadbbcea0ff3b05f03195b41cd991d7a0af8bd38559943aec99cbdaf0b22cc8'</span><span class="p">}</span>
</code></pre></div></div>
</code></pre>
</div>
<div class="share uk-text-center">
<a href="https://twitter.com/intent/tweet?text=Decentralized Identifiers (DIDs)&url=https://docs.blockstack.org/core/naming/did.html&via=&related=" rel="nofollow" target="_blank" title="Share on Twitter" onclick="window.open(this.href, 'twitter', 'width=550,height=235');return false;"><span data-uk-icon="icon: twitter; ratio: 1.2"></span></a>

10
_site/core/naming/forks.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>BNS Forks | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="BNS Forks" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/core/naming/forks.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/core/naming/forks.html","author":{"@type":"Person","name":"Blockstack"},"headline":"BNS Forks","dateModified":"2018-10-17T09:26:44-07:00","description":"BNS Forks","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/forks.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/core/naming/forks.html","headline":"BNS Forks","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/forks.html"},"description":"BNS Forks","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -274,13 +274,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-core/blob/master/docs/forks.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>

10
_site/core/naming/introduction.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Blockstack Naming Service (BNS) | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Blockstack Naming Service (BNS)" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/core/naming/introduction.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/core/naming/introduction.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Blockstack Naming Service (BNS)","dateModified":"2018-10-17T09:26:44-07:00","description":"Blockstack Naming Service (BNS)","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/introduction.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/core/naming/introduction.html","headline":"Blockstack Naming Service (BNS)","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/introduction.html"},"description":"Blockstack Naming Service (BNS)","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -274,13 +274,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-core/blob/master/docs/introduction.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>

10
_site/core/naming/manage.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Manage BNS Names | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Manage BNS Names" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/core/naming/manage.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/core/naming/manage.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Manage BNS Names","dateModified":"2018-10-17T09:26:44-07:00","description":"Manage BNS Names","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/manage.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/core/naming/manage.html","headline":"Manage BNS Names","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/manage.html"},"description":"Manage BNS Names","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -274,13 +274,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-core/blob/master/docs/manage.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>

10
_site/core/naming/namespaces.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Understand Namespaces | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Understand Namespaces" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/core/naming/namespaces.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/core/naming/namespaces.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Understand Namespaces","dateModified":"2018-10-17T09:26:44-07:00","description":"Understand Namespaces","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/namespaces.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/core/naming/namespaces.html","headline":"Understand Namespaces","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/namespaces.html"},"description":"Understand Namespaces","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -274,13 +274,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-core/blob/master/docs/namespaces.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>

30
_site/core/naming/pickname.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Choose a name | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Choose a name" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/core/naming/pickname.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/core/naming/pickname.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Choose a name","dateModified":"2018-10-17T09:26:44-07:00","description":"Choose a name","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/pickname.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/core/naming/pickname.html","headline":"Choose a name","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/pickname.html"},"description":"Choose a name","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -274,13 +274,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-core/blob/master/docs/pickname.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>
@ -329,17 +329,18 @@ the BNS API.</p>
<h2 id="list-all-namespaces-in-existence-reference">List all namespaces in existence (<a href="https://core.blockstack.org/#namespace-operations-get-all-namespaces">reference</a>).</h2>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>curl https://core.blockstack.org/v1/namespaces
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>curl https://core.blockstack.org/v1/namespaces
<span class="o">[</span>
<span class="s2">"id"</span>,
<span class="s2">"helloworld"</span>,
<span class="s2">"podcast"</span>
<span class="o">]</span>
</code></pre></div></div>
</code></pre>
</div>
<h2 id="list-all-names-within-a-namespace-reference">List all names within a namespace (<a href="https://core.blockstack.org/#namespace-operations-get-all-namespaces">reference</a>)</h2>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>curl https://core.blockstack.org/v1/namespaces/id/names?page<span class="o">=</span>0
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>curl https://core.blockstack.org/v1/namespaces/id/names?page<span class="o">=</span>0
<span class="o">[</span>
<span class="s2">"0.id"</span>,
<span class="s2">"0000.id"</span>,
@ -363,27 +364,30 @@ the BNS API.</p>
<span class="s2">"0nename.id"</span>
...
<span class="o">]</span>
</code></pre></div></div>
</code></pre>
</div>
<p>Each page returns a batch of 100 names.</p>
<h2 id="get-the-cost-to-register-a-namespace-reference">Get the Cost to Register a Namespace (<a href="https://core.blockstack.org/#price-checks-get-namespace-price">reference</a>)</h2>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>curl https://core.blockstack.org/v1/prices/namespaces/test
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>curl https://core.blockstack.org/v1/prices/namespaces/test
<span class="o">{</span>
<span class="s2">"satoshis"</span>: 40000000
<span class="o">}</span>
</code></pre></div></div>
</code></pre>
</div>
<p>If you want to register a namespace, please see the <a href="/core/naming/namespace.html">namespace creation section</a>.</p>
<h2 id="getting-the-current-consensus-hash-reference">Getting the Current Consensus Hash (<a href="https://core.blockstack.org/#blockchain-operations-get-consensus-hash">reference</a>)</h2>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>curl <span class="nt">-sL</span> https://core.blockstack.org/v1/blockchains/bitcoin/consensus
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>curl -sL https://core.blockstack.org/v1/blockchains/bitcoin/consensus
<span class="o">{</span>
<span class="s2">"consensus_hash"</span>: <span class="s2">"98adf31989bd937576aa190cc9f5fa3a"</span>
<span class="o">}</span>
</code></pre></div></div>
</code></pre>
</div>
<p>A recent consensus hash is required to create a <code class="highlighter-rouge">NAMESPACE_PREORDER</code> transaction. The reference
BNS clients do this automatically. See the <a href="/core/wire-format.html">transaction format</a>

20
_site/core/naming/register.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Register a name | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Register a name" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/core/naming/register.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/core/naming/register.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Register a name","dateModified":"2018-10-17T09:26:44-07:00","description":"Register a name","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/register.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/core/naming/register.html","headline":"Register a name","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/register.html"},"description":"Register a name","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -274,13 +274,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-core/blob/master/docs/register.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>
@ -367,12 +367,13 @@ ignored.</p>
<h2 id="getting-a-names-registration-fee-reference">Getting a Name’s Registration Fee (<a href="https://core.blockstack.org/#price-checks-get-name-price">reference</a>)</h2>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>curl <span class="nt">-sL</span> https://core.blockstack.org/v1/prices/names/helloworld.id | jq <span class="nt">-r</span> <span class="s2">".name_price"</span>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>curl -sL https://core.blockstack.org/v1/prices/names/helloworld.id | jq -r <span class="s2">".name_price"</span>
<span class="o">{</span>
<span class="s2">"btc"</span>: 2.5e-05,
<span class="s2">"satoshis"</span>: 2500
<span class="o">}</span>
</code></pre></div></div>
</code></pre>
</div>
<p>Note the use of <code class="highlighter-rouge">jq -r</code> to select the <code class="highlighter-rouge">"name_price"</code> field. This API
endpoint may return other ancilliary data regarding transaction fee estimation,
@ -380,11 +381,12 @@ but this is the only field guaranteed by this specification to be present.</p>
<h2 id="getting-the-current-consensus-hash-reference">Getting the Current Consensus Hash (<a href="https://core.blockstack.org/#blockchain-operations-get-consensus-hash">reference</a>)</h2>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>curl <span class="nt">-sL</span> https://core.blockstack.org/v1/blockchains/bitcoin/consensus
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>curl -sL https://core.blockstack.org/v1/blockchains/bitcoin/consensus
<span class="o">{</span>
<span class="s2">"consensus_hash"</span>: <span class="s2">"98adf31989bd937576aa190cc9f5fa3a"</span>
<span class="o">}</span>
</code></pre></div></div>
</code></pre>
</div>
<p>The consensus hash must be included in the <code class="highlighter-rouge">NAME_PREORDER</code> transaction. The BNS
clients do this automatically. See the <a href="/core/wire-format.html">transaction format

30
_site/core/naming/resolving.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Resolve a name | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Resolve a name" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/core/naming/resolving.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/core/naming/resolving.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Resolve a name","dateModified":"2018-10-17T09:26:44-07:00","description":"Resolve a name","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/resolving.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/core/naming/resolving.html","headline":"Resolve a name","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/resolving.html"},"description":"Resolve a name","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -274,13 +274,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-core/blob/master/docs/resolving.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>
@ -384,7 +384,7 @@ to do the following:</p>
<h2 id="look-up-a-names-public-key-and-zone-file-reference">Look up a name’s public key and zone file (<a href="https://core.blockstack.org/#name-querying-get-name-info">reference</a>)</h2>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>curl https://core.blockstack.org/v1/names/muneeb.id
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>curl https://core.blockstack.org/v1/names/muneeb.id
<span class="o">{</span>
<span class="s2">"address"</span>: <span class="s2">"1J3PUxY5uDShUnHRrMyU6yKtoHEUPhKULs"</span>,
<span class="s2">"blockchain"</span>: <span class="s2">"bitcoin"</span>,
@ -394,14 +394,15 @@ to do the following:</p>
<span class="s2">"zonefile"</span>: <span class="s2">"</span><span class="nv">$ORIGIN</span><span class="s2"> muneeb.id</span><span class="se">\n</span><span class="nv">$TTL</span><span class="s2"> 3600</span><span class="se">\n</span><span class="s2">_http._tcp URI 10 1 </span><span class="se">\"</span><span class="s2">https://gaia.blockstack.org/hub/1J3PUxY5uDShUnHRrMyU6yKtoHEUPhKULs/0/profile.json</span><span class="se">\"\n</span><span class="s2">"</span>,
<span class="s2">"zonefile_hash"</span>: <span class="s2">"37aecf837c6ae9bdc9dbd98a268f263dacd00361"</span>
<span class="o">}</span>
</code></pre></div></div>
</code></pre>
</div>
<p>Note that the <code class="highlighter-rouge">zonefile</code> field is given with the off-chain data that hashes
to the <code class="highlighter-rouge">zonefile_hash</code> field.</p>
<h2 id="list-all-names-the-node-knows-about-reference">List all names the node knows about (<a href="https://core.blockstack.org/#name-querying-get-all-names">reference</a>)</h2>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>curl https://core.blockstack.org/v1/names?page<span class="o">=</span>0
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>curl https://core.blockstack.org/v1/names?page<span class="o">=</span>0
<span class="o">[</span>
<span class="s2">"judecn.id"</span>,
<span class="s2">"3.id"</span>,
@ -419,7 +420,8 @@ to the <code class="highlighter-rouge">zonefile_hash</code> field.</p>
<span class="s2">"df.id"</span>,
...
<span class="o">]</span>
</code></pre></div></div>
</code></pre>
</div>
<p>Each page returns 100 names. While no specific ordering is mandated by the
protocol, the reference implementation orders names by their order of creation
@ -427,7 +429,7 @@ in the blockchain.</p>
<h2 id="look-up-the-history-of-states-a-name-was-in-reference">Look up the history of states a name was in (<a href="https://core.blockstack.org/#name-querying-name-history">reference</a>)</h2>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>curl https://core.blockstack.org/v1/names/patrickstanley.id/history
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>curl https://core.blockstack.org/v1/names/patrickstanley.id/history
<span class="o">{</span>
<span class="s2">"445838"</span>: <span class="o">[</span>
<span class="o">{</span>
@ -530,7 +532,8 @@ in the blockchain.</p>
<span class="o">}</span>
<span class="o">]</span>
<span class="o">}</span>
</code></pre></div></div>
</code></pre>
</div>
<p>All of the above information is extracted from the blockchain. Each top-level
field encodes the states the name transitioned to at the given block height (e.g.
@ -554,7 +557,7 @@ under its previous owner, if the name expired and was reregistered.</p>
<h2 id="look-up-the-list-of-names-owned-by-a-given-public-key-hash-reference">Look up the list of names owned by a given public key hash (<a href="https://core.blockstack.org/#name-querying-get-names-owned-by-address">reference</a>)</h2>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>curl https://core.blockstack.org/v1/addresses/bitcoin/16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>curl https://core.blockstack.org/v1/addresses/bitcoin/16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg
<span class="o">{</span>
<span class="s2">"names"</span>: <span class="o">[</span>
<span class="s2">"judecn.id"</span>,
@ -566,7 +569,8 @@ under its previous owner, if the name expired and was reregistered.</p>
<span class="s2">"jude.statism.id"</span>
<span class="o">]</span>
<span class="o">}</span>
</code></pre></div></div>
</code></pre>
</div>
<p>Note that this API endpoint includes names and
<a href="#bns-subdomains">subdomains</a>.</p>

176
_site/core/naming/search.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>How to build a Profile Search Index | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="How to build a Profile Search Index" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/core/naming/search.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/core/naming/search.html","author":{"@type":"Person","name":"Blockstack"},"headline":"How to build a Profile Search Index","dateModified":"2018-10-17T09:26:44-07:00","description":"How to build a Profile Search Index","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/search.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/core/naming/search.html","headline":"How to build a Profile Search Index","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/search.html"},"description":"How to build a Profile Search Index","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -274,13 +274,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-core/blob/master/docs/search.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>
@ -305,8 +305,9 @@ with data that follows structure of <a href="https://github.com/blockstack/block
<p>In early 2017, the search subsystem was ported over to the new API system, where support for search is provided by the endpoint:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>http://localhost:5000/search?query=&lt;SEARCH_PATTERN&gt;
</code></pre></div></div>
<div class="highlighter-rouge"><pre class="highlight"><code>http://localhost:5000/search?query=&lt;SEARCH_PATTERN&gt;
</code></pre>
</div>
<p>This document describes how to setup the search subsystem to respond at that endpoint.</p>
@ -315,14 +316,15 @@ with data that follows structure of <a href="https://github.com/blockstack/block
<ul>
<li><strong>Step 1:</strong> First, make sure you have <a href="http://docs.python-guide.org/en/latest/dev/virtualenvs/">virtualenv installed</a>.
Then, setup the API and search subsystem:
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo apt-get install -y mongodb memcached python-dev libmemcached-dev zlib1g-dev nginx
<div class="highlighter-rouge"><pre class="highlight"><code>$ sudo apt-get install -y mongodb memcached python-dev libmemcached-dev zlib1g-dev nginx
$ sudo pip install uwsgi
$ git clone https://github.com/blockstack/blockstack-core.git --branch api
$ cd blockstack-core/
$ sudo pip install .
$ sudo pip install -r api/requirements.txt
$ sudo mkdir /var/blockstack-search &amp;&amp; sudo chown $USER:$USER /var/blockstack-search
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p><strong>Step 2:</strong> Make sure you have Blockstack Core running locally (see <a href="https://github.com/blockstack/blockstack-core/blob/master/README.md#quick-start">instructions</a>). We highly
@ -332,34 +334,38 @@ Blockstack Core for re-indexing and remote nodes can slow down performance.</p>
<li><strong>Step 3:</strong> Fetch the data for the .id namespace and respective profiles. Note, you may want to redirect stderr to a file, as there is a lot of debug output.</li>
</ul>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ cd api/
<div class="highlighter-rouge"><pre class="highlight"><code>$ cd api/
$ python -m search.fetch_data --fetch_namespace
$ python -m search.fetch_data --fetch_profiles
</code></pre></div></div>
</code></pre>
</div>
<ul>
<li><strong>Step 4:</strong> Create the search index:</li>
</ul>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>python -m search.basic_index --refresh
</code></pre></div></div>
<div class="highlighter-rouge"><pre class="highlight"><code>python -m search.basic_index --refresh
</code></pre>
</div>
<ul>
<li><strong>Step 5:</strong> Enable search API endpoint:</li>
</ul>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sed -i 's/SEARCH_API_ENDPOINT_ENABLED \= False/SEARCH_API_ENDPOINT_ENABLED \= True/' config.py
</code></pre></div></div>
<div class="highlighter-rouge"><pre class="highlight"><code>$ sed -i 's/SEARCH_API_ENDPOINT_ENABLED \= False/SEARCH_API_ENDPOINT_ENABLED \= True/' config.py
</code></pre>
</div>
<h1 id="usage">Usage</h1>
<p>You can quickly test the search index from the command line:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>python -m search.substring_search --search_name "Fred Wil"
<div class="highlighter-rouge"><pre class="highlight"><code>python -m search.substring_search --search_name "Fred Wil"
python -m search.substring_search --search_twitter fredwil
</code></pre></div></div>
</code></pre>
</div>
<p>You can also use the search API end-point:</p>
@ -369,68 +375,70 @@ python -m search.substring_search --search_twitter fredwil
<p>Sample Response:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>{
"people": [
{
"profile": {
"website": [
{
"url": "http://muneebali.com",
"@type": "WebSite"
}
],
"name": "Muneeb Ali",
"address": {
"addressLocality": "New York, NY",
"@type": "PostalAddress"
},
"image": [
{
"contentUrl": "https://s3.amazonaws.com/dx3/muneeb",
"@type": "ImageObject",
"name": "cover"
},
{
"contentUrl": "https://s3.amazonaws.com/kd4/muneeb",
"@type": "ImageObject",
"name": "avatar"
}
],
"@type": "Person",
"description": "Co-founder of Blockstack. Interested in distributed systems and blockchains. Previously, PhD at Princeton."
},
"username": "muneeb"
},
{
"profile": {
"message": "This blockchain ID is reserved for Muneeb Ali. If this is you, please email support@onename.com to claim it for free.",
"status": "reserved"
},
"username": "muneebali"
},
{
"profile": {
"cover": {
"url": "https://s3.amazonaws.com/97p/HHE.jpg"
},
"v": "0.2"
},
"username": "muneebali1"
}
]
}
</code></pre></div></div>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="nt">"people"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nt">"profile"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nt">"website"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nt">"url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"http://muneebali.com"</span><span class="p">,</span><span class="w">
</span><span class="nt">"@type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"WebSite"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">],</span><span class="w">
</span><span class="nt">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Muneeb Ali"</span><span class="p">,</span><span class="w">
</span><span class="nt">"address"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nt">"addressLocality"</span><span class="p">:</span><span class="w"> </span><span class="s2">"New York, NY"</span><span class="p">,</span><span class="w">
</span><span class="nt">"@type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"PostalAddress"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nt">"image"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nt">"contentUrl"</span><span class="p">:</span><span class="w"> </span><span class="s2">"https://s3.amazonaws.com/dx3/muneeb"</span><span class="p">,</span><span class="w">
</span><span class="nt">"@type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ImageObject"</span><span class="p">,</span><span class="w">
</span><span class="nt">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"cover"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nt">"contentUrl"</span><span class="p">:</span><span class="w"> </span><span class="s2">"https://s3.amazonaws.com/kd4/muneeb"</span><span class="p">,</span><span class="w">
</span><span class="nt">"@type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ImageObject"</span><span class="p">,</span><span class="w">
</span><span class="nt">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"avatar"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">],</span><span class="w">
</span><span class="nt">"@type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Person"</span><span class="p">,</span><span class="w">
</span><span class="nt">"description"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Co-founder of Blockstack. Interested in distributed systems and blockchains. Previously, PhD at Princeton."</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nt">"username"</span><span class="p">:</span><span class="w"> </span><span class="s2">"muneeb"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nt">"profile"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nt">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"This blockchain ID is reserved for Muneeb Ali. If this is you, please email support@onename.com to claim it for free."</span><span class="p">,</span><span class="w">
</span><span class="nt">"status"</span><span class="p">:</span><span class="w"> </span><span class="s2">"reserved"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nt">"username"</span><span class="p">:</span><span class="w"> </span><span class="s2">"muneebali"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nt">"profile"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nt">"cover"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nt">"url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"https://s3.amazonaws.com/97p/HHE.jpg"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nt">"v"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.2"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nt">"username"</span><span class="p">:</span><span class="w"> </span><span class="s2">"muneebali1"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
<h2 id="enabling-elastic-search">Enabling Elastic Search</h2>
<h3 id="requirements">Requirements:</h3>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo apt-get install mongodb
<div class="highlighter-rouge"><pre class="highlight"><code>sudo apt-get install mongodb
sudo apt-get install memcached libmemcached-dev
sudo apt-get install python2.7-dev
pip install -r requirements.txt
</code></pre></div></div>
</code></pre>
</div>
<h3 id="elastic-search">Elastic Search</h3>
@ -447,9 +455,10 @@ pip install -r requirements.txt
<p>Ensure that mongodb and elastic search are running
starting elastic search:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$elasticsearch (on mac)
<div class="highlighter-rouge"><pre class="highlight"><code>$elasticsearch (on mac)
bin/elasticsearch -d (on linux)
</code></pre></div></div>
</code></pre>
</div>
<p>To test if elastic search is running:</p>
@ -459,16 +468,17 @@ bin/elasticsearch -d (on linux)
<p>returns:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>{
"ok" : true,
"status" : 200,
"name" : "Angler",
"version" : {
"number" : "0.90.2",
"snapshot_build" : false,
"lucene_version" : "4.3.1"
},
</code></pre></div></div>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="nt">"ok"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
</span><span class="nt">"status"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="mi">200</span><span class="p">,</span><span class="w">
</span><span class="nt">"name"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"Angler"</span><span class="p">,</span><span class="w">
</span><span class="nt">"version"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nt">"number"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"0.90.2"</span><span class="p">,</span><span class="w">
</span><span class="nt">"snapshot_build"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w">
</span><span class="nt">"lucene_version"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"4.3.1"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span></code></pre>
</div>
<p>Create Index:</p>

40
_site/core/naming/subdomains.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>BNS Subdomains | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="BNS Subdomains" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/core/naming/subdomains.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/core/naming/subdomains.html","author":{"@type":"Person","name":"Blockstack"},"headline":"BNS Subdomains","dateModified":"2018-10-17T09:26:44-07:00","description":"BNS Subdomains","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/subdomains.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/core/naming/subdomains.html","headline":"BNS Subdomains","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/subdomains.html"},"description":"BNS Subdomains","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -274,13 +274,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-core/blob/master/docs/subdomains.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>
@ -342,7 +342,7 @@ stored.</p>
<p>For example, the name <code class="highlighter-rouge">verified.podcast</code> once wrote the zone file hash <code class="highlighter-rouge">247121450ca0e9af45e85a82e61cd525cd7ba023</code>,
which is the hash of the following zone file:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>curl <span class="nt">-sL</span> https://core.blockstack.org/v1/names/verified.podcast/zonefile/247121450ca0e9af45e85a82e61cd525cd7ba023 | jq <span class="nt">-r</span> <span class="s1">'.zonefile'</span>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>curl -sL https://core.blockstack.org/v1/names/verified.podcast/zonefile/247121450ca0e9af45e85a82e61cd525cd7ba023 | jq -r <span class="s1">'.zonefile'</span>
<span class="nv">$ORIGIN</span> verified.podcast
<span class="nv">$TTL</span> 3600
1yeardaily TXT <span class="s2">"owner=1MwPD6dH4fE3gQ9mCov81L1DEQWT7E85qH"</span> <span class="s2">"seqn=0"</span> <span class="s2">"parts=1"</span> <span class="s2">"zf0=JE9SSUdJTiAxeWVhcmRhaWx5CiRUVEwgMzYwMApfaHR0cC5fdGNwIFVSSSAxMCAxICJodHRwczovL3BoLmRvdHBvZGNhc3QuY28vMXllYXJkYWlseS9oZWFkLmpzb24iCg=="</span>
@ -355,12 +355,13 @@ onea TXT <span class="s2">"owner=1MwPD6dH4fE3gQ9mCov81L1DEQWT7E85qH"</span> <spa
10minuteteacher TXT <span class="s2">"owner=1MwPD6dH4fE3gQ9mCov81L1DEQWT7E85qH"</span> <span class="s2">"seqn=0"</span> <span class="s2">"parts=1"</span> <span class="s2">"zf0=JE9SSUdJTiAxMG1pbnV0ZXRlYWNoZXIKJFRUTCAzNjAwCl9odHRwLl90Y3AgVVJJIDEwIDEgImh0dHBzOi8vcGguZG90cG9kY2FzdC5jby8xMG1pbnV0ZXRlYWNoZXIvaGVhZC5qc29uIgo="</span>
36questionsthepodcastmusical TXT <span class="s2">"owner=1MwPD6dH4fE3gQ9mCov81L1DEQWT7E85qH"</span> <span class="s2">"seqn=0"</span> <span class="s2">"parts=1"</span> <span class="s2">"zf0=JE9SSUdJTiAzNnF1ZXN0aW9uc3RoZXBvZGNhc3RtdXNpY2FsCiRUVEwgMzYwMApfaHR0cC5fdGNwIFVSSSAxMCAxICJodHRwczovL3BoLmRvdHBvZGNhc3QuY28vMzZxdWVzdGlvbnN0aGVwb2RjYXN0bXVzaWNhbC9oZWFkLmpzb24iCg=="</span>
_http._tcp URI 10 1 <span class="s2">"https://dotpodcast.co/"</span>
</code></pre></div></div>
</code></pre>
</div>
<p>Each <code class="highlighter-rouge">TXT</code> record in this zone file encodes a subdomain-creation.
For example, <code class="highlighter-rouge">1yeardaily.verified.podcast</code> resolves to:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>curl https://core.blockstack.org/v1/names/1yeardaily.verified.podcast
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>curl https://core.blockstack.org/v1/names/1yeardaily.verified.podcast
<span class="o">{</span>
<span class="s2">"address"</span>: <span class="s2">"1MwPD6dH4fE3gQ9mCov81L1DEQWT7E85qH"</span>,
<span class="s2">"blockchain"</span>: <span class="s2">"bitcoin"</span>,
@ -369,7 +370,8 @@ For example, <code class="highlighter-rouge">1yeardaily.verified.podcast</code>
<span class="s2">"zonefile_hash"</span>: <span class="s2">"e7acc97fd42c48ed94fd4d41f674eddbee5557e3"</span>,
<span class="s2">"zonefile_txt"</span>: <span class="s2">"</span><span class="nv">$ORIGIN</span><span class="s2"> 1yeardaily</span><span class="se">\n</span><span class="nv">$TTL</span><span class="s2"> 3600</span><span class="se">\n</span><span class="s2">_http._tcp URI 10 1 </span><span class="se">\"</span><span class="s2">https://ph.dotpodcast.co/1yeardaily/head.json</span><span class="se">\"\n</span><span class="s2">"</span>
<span class="o">}</span>
</code></pre></div></div>
</code></pre>
</div>
<p>This information was extracted from the <code class="highlighter-rouge">1yeardaily</code> <code class="highlighter-rouge">TXT</code> resource record in the zone
file for <code class="highlighter-rouge">verified.podcast</code>.</p>
@ -384,7 +386,7 @@ updates; only the owner of <code class="highlighter-rouge">1yeardaily.verified.p
<p>The lifecycle of a subdomain and its operations is shown in Figure 2.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> subdomain subdomain subdomain
<div class="highlighter-rouge"><pre class="highlight"><code> subdomain subdomain subdomain
creation update transfer
+----------------+ +----------------+ +----------------+
| cicero | | cicero | | cicero |
@ -416,7 +418,8 @@ Thesubdomain-creation and subdomain-transfer transactions for
"cicero.res_publica.id" are broadcast by the owner of "res_publica.id".
However, any on-chain name ("jude.id" in this case) can broadcast a subdomain
update for "cicero.res_publica.id".
</code></pre></div></div>
</code></pre>
</div>
<p>Subdomain operations are ordered by sequence number, starting at 0. Each new
subdomain operation must include:</p>
@ -444,7 +447,7 @@ Using the BNS API, a developer can:</p>
<h3 id="look-up-a-subdomains-public-key-and-zone-file-reference">Look up a subdomain’s public key and zone file (<a href="https://core.blockstack.org/#name-querying-get-name-info">reference</a>)</h3>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>curl https://core.blockstack.org/v1/names/aaron.personal.id
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>curl https://core.blockstack.org/v1/names/aaron.personal.id
<span class="o">{</span>
<span class="s2">"address"</span>: <span class="s2">"1PwztPFd1s2STMv4Ntq6UPBdYgHSBr5pdF"</span>,
<span class="s2">"blockchain"</span>: <span class="s2">"bitcoin"</span>,
@ -453,11 +456,12 @@ Using the BNS API, a developer can:</p>
<span class="s2">"zonefile_hash"</span>: <span class="s2">"a6dda6b74ffecf85f4a162627d8df59577243813"</span>,
<span class="s2">"zonefile_txt"</span>: <span class="s2">"</span><span class="nv">$ORIGIN</span><span class="s2"> aaron.personal.id</span><span class="se">\n</span><span class="nv">$TTL</span><span class="s2"> 3600</span><span class="se">\n</span><span class="s2">_https._tcp URI 10 1 </span><span class="se">\"</span><span class="s2">https://gaia.blockstack.org/hub/1PwztPFd1s2STMv4Ntq6UPBdYgHSBr5pdF/profile.json</span><span class="se">\"\n</span><span class="s2">"</span>
<span class="o">}</span>
</code></pre></div></div>
</code></pre>
</div>
<h3 id="look-up-a-subdomains-transaction-history-reference">Look up a subdomain’s transaction history (<a href="https://core.blockstack.org/#name-querying-name-history">reference</a>)</h3>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>curl https://core.blockstack.org/v1/names/aaron.personal.id/history
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>curl https://core.blockstack.org/v1/names/aaron.personal.id/history
<span class="o">{</span>
<span class="s2">"509981"</span>: <span class="o">[</span>
<span class="o">{</span>
@ -472,17 +476,19 @@ Using the BNS API, a developer can:</p>
<span class="o">}</span>
<span class="o">]</span>
<span class="o">}</span>
</code></pre></div></div>
</code></pre>
</div>
<h3 id="look-up-the-list-of-names-and-subdomains-owned-by-a-given-public-key-hash-reference">Look up the list of names and subdomains owned by a given public key hash (<a href="https://core.blockstack.org/#name-querying-get-names-owned-by-address">reference</a>)</h3>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>curl https://core.blockstack.org/v1/addresses/bitcoin/1PwztPFd1s2STMv4Ntq6UPBdYgHSBr5pdF
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>curl https://core.blockstack.org/v1/addresses/bitcoin/1PwztPFd1s2STMv4Ntq6UPBdYgHSBr5pdF
<span class="o">{</span>
<span class="s2">"names"</span>: <span class="o">[</span>
<span class="s2">"aaron.personal.id"</span>
<span class="o">]</span>
<span class="o">}</span>
</code></pre></div></div>
</code></pre>
</div>
<h2 id="subdomain-creation-and-management">Subdomain Creation and Management</h2>

151
_site/core/naming/tutorial_subdomains.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Subdomain Design and Implementation | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Subdomain Design and Implementation" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/core/naming/tutorial_subdomains.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/core/naming/tutorial_subdomains.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Subdomain Design and Implementation","dateModified":"2018-10-17T09:26:44-07:00","description":"Subdomain Design and Implementation","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/tutorial_subdomains.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/core/naming/tutorial_subdomains.html","headline":"Subdomain Design and Implementation","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/naming/tutorial_subdomains.html"},"description":"Subdomain Design and Implementation","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -274,13 +274,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-core/blob/master/docs/tutorial_subdomains.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>
@ -359,12 +359,13 @@ so we chop up the zonefile.</li>
<li><strong>sig</strong>: signature of the above data.</li>
</ol>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ORIGIN bar.id
<div class="highlighter-rouge"><pre class="highlight"><code>$ORIGIN bar.id
$TTL 3600
pubkey TXT "pubkey:data:0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
registrar URI 10 1 "bsreg://foo.com:8234"
aaron TXT "owner=33VvhhSQsYQyCVE2VzG3EHa9gfRCpboqHy" "seqn=0" "parts=1" "zf0=JE9SSUdJTiBhYXJvbgokVFRMIDM2MDAKbWFpbiBVUkkgMSAxICJwdWJrZXk6ZGF0YTowMzAyYWRlNTdlNjNiMzc1NDRmOGQ5Nzk4NjJhNDlkMDBkYmNlMDdmMjkzYmJlYjJhZWNmZTI5OTkxYTg3Mzk4YjgiCg=="
</code></pre></div></div>
</code></pre>
</div>
<p>The <code class="highlighter-rouge">registrar</code> entry indicates how to contact the registrar service
for clients of the domain wishing to register or modify their entry.</p>
@ -378,8 +379,9 @@ for clients of the domain wishing to register or modify their entry.</p>
<p>The directory <code class="highlighter-rouge">subdomain_registrar/</code> contains our code for running a
subdomain registrar. It can be executed by running:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ blockstack-subdomain-registrar start foo.id
</code></pre></div></div>
<div class="highlighter-rouge"><pre class="highlight"><code>$ blockstack-subdomain-registrar start foo.id
</code></pre>
</div>
<p>Here, <code class="highlighter-rouge">foo.id</code> is the domain for which subdomains will be associated.</p>
@ -396,33 +398,35 @@ subdomain registrar. It can be executed by running:</p>
<p>Subdomain registrations can be submitted to this endpoint using a REST
API.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>POST /register
</code></pre></div></div>
<div class="highlighter-rouge"><pre class="highlight"><code>POST /register
</code></pre>
</div>
<p>The schema for registration is:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>{
'type' : 'object',
'properties' : {
'name' : {
'type': 'string',
'pattern': '([a-z0-9\-_+]{3,36})$'
},
'owner_address' : {
'type': 'string',
'pattern': schemas.OP_ADDRESS_PATTERN
},
'zonefile' : {
'type' : 'string',
'maxLength' : blockstack_constants.RPC_MAX_ZONEFILE_LEN
}
},
'required':[
'name', 'owner_address', 'zonefile'
],
'additionalProperties' : True
}
</code></pre></div></div>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="err">'type'</span><span class="w"> </span><span class="err">:</span><span class="w"> </span><span class="err">'object',</span><span class="w">
</span><span class="err">'properties'</span><span class="w"> </span><span class="err">:</span><span class="w"> </span><span class="err">{</span><span class="w">
</span><span class="err">'name'</span><span class="w"> </span><span class="err">:</span><span class="w"> </span><span class="err">{</span><span class="w">
</span><span class="err">'type':</span><span class="w"> </span><span class="err">'string',</span><span class="w">
</span><span class="err">'pattern':</span><span class="w"> </span><span class="err">'([a-z0-9\-_+]{3,36</span><span class="p">}</span><span class="err">)$'</span><span class="w">
</span><span class="err">},</span><span class="w">
</span><span class="err">'owner_address'</span><span class="w"> </span><span class="err">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="err">'type':</span><span class="w"> </span><span class="err">'string',</span><span class="w">
</span><span class="err">'pattern':</span><span class="w"> </span><span class="err">schemas.OP_ADDRESS_PATTERN</span><span class="w">
</span><span class="p">}</span><span class="err">,</span><span class="w">
</span><span class="err">'zonefile'</span><span class="w"> </span><span class="err">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="err">'type'</span><span class="w"> </span><span class="err">:</span><span class="w"> </span><span class="err">'string',</span><span class="w">
</span><span class="err">'maxLength'</span><span class="w"> </span><span class="err">:</span><span class="w"> </span><span class="err">blockstack_constants.RPC_MAX_ZONEFILE_LEN</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="err">},</span><span class="w">
</span><span class="err">'required':</span><span class="p">[</span><span class="w">
</span><span class="err">'name'</span><span class="p">,</span><span class="w"> </span><span class="err">'owner_address'</span><span class="p">,</span><span class="w"> </span><span class="err">'zonefile'</span><span class="w">
</span><span class="p">]</span><span class="err">,</span><span class="w">
</span><span class="err">'additionalProperties'</span><span class="w"> </span><span class="err">:</span><span class="w"> </span><span class="err">True</span><span class="w">
</span><span class="err">}</span><span class="w">
</span></code></pre>
</div>
<p>The registrar will:</p>
@ -433,8 +437,9 @@ API.</p>
<p>On success, this returns <code class="highlighter-rouge">202</code> and the message</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>{"status": "true", "message": "Subdomain registration queued."}
</code></pre></div></div>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="nt">"status"</span><span class="p">:</span><span class="w"> </span><span class="s2">"true"</span><span class="p">,</span><span class="w"> </span><span class="nt">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Subdomain registration queued."</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
<p>When the registrar wakes up to prepare a transaction, it packs the queued
registrations together and issues an <code class="highlighter-rouge">UPDATE</code>.</p>
@ -445,24 +450,28 @@ registrations together and issues an <code class="highlighter-rouge">UPDATE</cod
registrar.</p>
<p>This is an API call:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>GET /status/{subdomain}
</code></pre></div></div>
<div class="highlighter-rouge"><pre class="highlight"><code>GET /status/{subdomain}
</code></pre>
</div>
<p>The registrar checks if the subdomain has propagated (i.e., the
registration is completed), in which case the following is returned:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>{"status": "Subdomain already propagated"}
</code></pre></div></div>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="nt">"status"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Subdomain already propagated"</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
<p>Or, if the subdomain has already been submitted in a transaction:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>{"status": "Your subdomain was registered in transaction 09a40d6ea362608c68da6e1ebeb3210367abf7aa39ece5fd57fd63d269336399 -- it should propagate on the network once it has 6 confirmations."}
</code></pre></div></div>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="nt">"status"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Your subdomain was registered in transaction 09a40d6ea362608c68da6e1ebeb3210367abf7aa39ece5fd57fd63d269336399 -- it should propagate on the network once it has 6 confirmations."</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
<p>If the subdomain still hasn’t been submitted yet:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>{"status": "Subdomain is queued for update and should be announced within the next few blocks."}
</code></pre></div></div>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="nt">"status"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Subdomain is queued for update and should be announced within the next few blocks."</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
<p>If an error occurred trying to submit the <code class="highlighter-rouge">UPDATE</code> transaction, this endpoint will return an error
message in the <code class="highlighter-rouge">"error"</code> key of a JSON object.</p>
@ -497,7 +506,7 @@ The endpoints which <em>are</em> subdomain aware are marked as such in
<p>The lookups work just like normal – it returns the user’s
profile object:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl -H "Authorization: bearer blockstack_integration_test_api_password" -H "Origin: http://localhost:3000" http://localhost:16268/v1/users/bar.foo.id -v -s | python -m json.tool
<div class="highlighter-rouge"><pre class="highlight"><code>$ curl -H "Authorization: bearer blockstack_integration_test_api_password" -H "Origin: http://localhost:3000" http://localhost:16268/v1/users/bar.foo.id -v -s | python -m json.tool
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 16268 (#0)
&gt; GET /v1/users/bar.foo.id HTTP/1.1
@ -522,12 +531,13 @@ profile object:</p>
"description": "Lorem Ipsum Bazorem"
}
}
</code></pre></div></div>
</code></pre>
</div>
<p>Name info lookups are also supported (this should enable authenticating logins
with <code class="highlighter-rouge">blockstack.js</code>, but I will need to double check).</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl -H "Authorization: bearer XXXX" -H "Origin: http://localhost:3000" http://localhost:6270/v1/names/created_equal.self_evident_truth.id -s | python -m json.tool
<div class="highlighter-rouge"><pre class="highlight"><code>$ curl -H "Authorization: bearer XXXX" -H "Origin: http://localhost:3000" http://localhost:6270/v1/names/created_equal.self_evident_truth.id -s | python -m json.tool
{
"address": "1AYddAnfHbw6bPNvnsQFFrEuUdhMhf2XG9",
"blockchain": "bitcoin",
@ -537,7 +547,8 @@ with <code class="highlighter-rouge">blockstack.js</code>, but I will need to do
"zonefile_hash": "48fc1b351ce81cf0a9fd9b4eae7a3f80e93c0451",
"zonefile_txt": "$ORIGIN created_equal\n$TTL 3600\n_https._tcp URI 10 1 \"https://www.cs.princeton.edu/~ablankst/created_equal.json\"\n_file URI 10 1 \"file:///tmp/created_equal.json\"\n"
}
</code></pre></div></div>
</code></pre>
</div>
<h3 id="subdomain-caching">Subdomain Caching</h3>
@ -551,8 +562,9 @@ when a new zonefile for a particularly domain is seen by the resolver
<p>You can run a subdomain registrar and resolver with blockstack-core in
regtest mode as follows:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">IMAGE</span><span class="o">=</span><span class="k">$(</span>docker run <span class="nt">-dt</span> <span class="nt">-p</span> 3000:3000 <span class="nt">-p</span> 6270:6270 <span class="nt">-p</span> 16269:16269 <span class="nt">-p</span> 18332:18332 <span class="nt">-e</span> <span class="nv">BLOCKSTACK_TEST_CLIENT_RPC_PORT</span><span class="o">=</span>6270 <span class="nt">-e</span> <span class="nv">BLOCKSTACK_TEST_CLIENT_BIND</span><span class="o">=</span>0.0.0.0 <span class="nt">-e</span> <span class="nv">BLOCKSTACK_TEST_BITCOIND_ALLOWIP</span><span class="o">=</span>172.17.0.0/16 quay.io/blockstack/integrationtests:master blockstack-test-scenario <span class="nt">--interactive</span> 2 blockstack_integration_tests.scenarios.browser_env<span class="k">)</span>
</code></pre></div></div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="nv">IMAGE</span><span class="o">=</span><span class="k">$(</span>docker run -dt -p 3000:3000 -p 6270:6270 -p 16269:16269 -p 18332:18332 -e <span class="nv">BLOCKSTACK_TEST_CLIENT_RPC_PORT</span><span class="o">=</span>6270 -e <span class="nv">BLOCKSTACK_TEST_CLIENT_BIND</span><span class="o">=</span>0.0.0.0 -e <span class="nv">BLOCKSTACK_TEST_BITCOIND_ALLOWIP</span><span class="o">=</span>172.17.0.0/16 quay.io/blockstack/integrationtests:master blockstack-test-scenario --interactive 2 blockstack_integration_tests.scenarios.browser_env<span class="k">)</span>
</code></pre>
</div>
<p>Once you see <code class="highlighter-rouge">Test finished; doing checks</code> in that container’s logs, the
registrar has started and is ready to accept requests. (We recommend
@ -562,33 +574,37 @@ correct environment variables for it to run).</p>
<p>Once this environment has started, you can issue a registration request from curl:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl -X POST -H 'Content-Type: application/json' --data '{"zonefile": "$ORIGIN baz\n$TTL 3600\n_file URI 10 1 \"file:///tmp/baz.profile.json\"\n", "name": "baz", "owner_address": "14x2EMRz1gf16UzGbxZh2c6sJg4A8wcHLD"}' http://localhost:3000/register/
</code></pre></div></div>
<div class="highlighter-rouge"><pre class="highlight"><code>curl -X POST -H 'Content-Type: application/json' --data '{"zonefile": "$ORIGIN baz\n$TTL 3600\n_file URI 10 1 \"file:///tmp/baz.profile.json\"\n", "name": "baz", "owner_address": "14x2EMRz1gf16UzGbxZh2c6sJg4A8wcHLD"}' http://localhost:3000/register/
</code></pre>
</div>
<p>This registers <code class="highlighter-rouge">baz.foo.id</code> – you can check the registrar’s status with</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl http://localhost:3000/status/baz
</code></pre></div></div>
<div class="highlighter-rouge"><pre class="highlight"><code>curl http://localhost:3000/status/baz
</code></pre>
</div>
<p>The API endpoints <code class="highlighter-rouge">/v1/users/&lt;foo.bar.tld&gt;</code>,
<code class="highlighter-rouge">/v1/names/&lt;foo.bar.tld&gt;</code>, and <code class="highlighter-rouge">/v1/addresses/bitcoin/&lt;foo.bar.tld&gt;</code> all work, so if you query the core API, you’ll get a response.</p>
<p>For example:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl http://localhost:6270/v1/names/baz.foo.id | python -m json.tool
</code></pre></div></div>
<div class="highlighter-rouge"><pre class="highlight"><code>curl http://localhost:6270/v1/names/baz.foo.id | python -m json.tool
</code></pre>
</div>
<p>Will return:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>{
"address": "1Nup2UcbVuVoDZeZCtR4vjSkrvTi8toTqc",
"blockchain": "bitcoin",
"expire_block": -1,
"last_txid": "43bbcbd8793cdc52f1b0bd2713ed136f4f104a683a9fd5c89911a57a8c4b28b6",
"satus": "registered_subdomain",
"zonefile_hash": "e7e3aada18c9ac5189f1c54089e987f58c0fa51e",
"zonefile_txt": "$ORIGIN bar\n$TTL 3600\n_file URI 10 1 \"file:///tmp/baz.profile.json\"\n"
}
</code></pre></div></div>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="nt">"address"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1Nup2UcbVuVoDZeZCtR4vjSkrvTi8toTqc"</span><span class="p">,</span><span class="w">
</span><span class="nt">"blockchain"</span><span class="p">:</span><span class="w"> </span><span class="s2">"bitcoin"</span><span class="p">,</span><span class="w">
</span><span class="nt">"expire_block"</span><span class="p">:</span><span class="w"> </span><span class="mi">-1</span><span class="p">,</span><span class="w">
</span><span class="nt">"last_txid"</span><span class="p">:</span><span class="w"> </span><span class="s2">"43bbcbd8793cdc52f1b0bd2713ed136f4f104a683a9fd5c89911a57a8c4b28b6"</span><span class="p">,</span><span class="w">
</span><span class="nt">"satus"</span><span class="p">:</span><span class="w"> </span><span class="s2">"registered_subdomain"</span><span class="p">,</span><span class="w">
</span><span class="nt">"zonefile_hash"</span><span class="p">:</span><span class="w"> </span><span class="s2">"e7e3aada18c9ac5189f1c54089e987f58c0fa51e"</span><span class="p">,</span><span class="w">
</span><span class="nt">"zonefile_txt"</span><span class="p">:</span><span class="w"> </span><span class="s2">"$ORIGIN bar\n$TTL 3600\n_file URI 10 1 \"file:///tmp/baz.profile.json\"\n"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
<h3 id="running-an-interactive-testing-environment-with-the-subdomain-registrar-service">Running an interactive testing environment with the Subdomain Registrar service</h3>
@ -601,8 +617,9 @@ correct environment variables for it to run).</p>
<p>Here’s the full command you’d run to start the interactive testing scenario:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">IMAGE</span><span class="o">=</span><span class="k">$(</span>docker run <span class="nt">-dt</span> <span class="nt">-p</span> 3000:3000 <span class="nt">-p</span> 6270:6270 <span class="nt">-p</span> 16269:16269 <span class="nt">-p</span> 18332:18332 <span class="nt">-e</span> <span class="nv">BLOCKSTACK_TEST_CLIENT_RPC_PORT</span><span class="o">=</span>6270 <span class="nt">-e</span> <span class="nv">BLOCKSTACK_TEST_CLIENT_BIND</span><span class="o">=</span>0.0.0.0 <span class="nt">-e</span> <span class="nv">BLOCKSTACK_TEST_BITCOIND_ALLOWIP</span><span class="o">=</span>172.17.0.0/16 quay.io/blockstack/integrationtests:master blockstack-test-scenario <span class="nt">--interactive</span> 2 blockstack_integration_tests.scenarios.browser_env<span class="k">)</span>
</code></pre></div></div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="nv">IMAGE</span><span class="o">=</span><span class="k">$(</span>docker run -dt -p 3000:3000 -p 6270:6270 -p 16269:16269 -p 18332:18332 -e <span class="nv">BLOCKSTACK_TEST_CLIENT_RPC_PORT</span><span class="o">=</span>6270 -e <span class="nv">BLOCKSTACK_TEST_CLIENT_BIND</span><span class="o">=</span>0.0.0.0 -e <span class="nv">BLOCKSTACK_TEST_BITCOIND_ALLOWIP</span><span class="o">=</span>172.17.0.0/16 quay.io/blockstack/integrationtests:master blockstack-test-scenario --interactive 2 blockstack_integration_tests.scenarios.browser_env<span class="k">)</span>
</code></pre>
</div>
<div class="share uk-text-center">
<a href="https://twitter.com/intent/tweet?text=Subdomain Design and Implementation&url=https://docs.blockstack.org/core/naming/tutorial_subdomains.html&via=&related=" rel="nofollow" target="_blank" title="Share on Twitter" onclick="window.open(this.href, 'twitter', 'width=550,height=235');return false;"><span data-uk-icon="icon: twitter; ratio: 1.2"></span></a>

80
_site/core/wire-format.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Bitcoin wire format | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Bitcoin wire format" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/core/wire-format.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/core/wire-format.html","author":{"@type":"Person","name":"Blockstack"},"headline":"Bitcoin wire format","dateModified":"2018-10-17T09:26:44-07:00","description":"Bitcoin wire format","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/wire-format.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/core/wire-format.html","headline":"Bitcoin wire format","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/core/wire-format.html"},"description":"Bitcoin wire format","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -274,13 +274,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-core/blob/master/docs/wire-format.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>
@ -367,10 +367,11 @@ transaction of two transactions that must be sent to register a name in BNS.</p>
<p>Example: <a href="https://www.blocktrail.com/BTC/tx/6730ae09574d5935ffabe3dd63a9341ea54fafae62fde36c27738e9ee9c4e889">6730ae09574d5935ffabe3dd63a9341ea54fafae62fde36c27738e9ee9c4e889</a></p>
<p><code class="highlighter-rouge">OP_RETURN</code> wire format:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> 0 2 3 23 39
<div class="highlighter-rouge"><pre class="highlight"><code> 0 2 3 23 39
|-----|--|--------------------------------------------------|--------------|
magic op hash_name(name.ns_id,script_pubkey,register_addr) consensus hash
</code></pre></div></div>
</code></pre>
</div>
<p>Inputs:</p>
<ul>
@ -403,16 +404,18 @@ sent to register a name in BNS.</p>
<p><code class="highlighter-rouge">OP_RETURN</code> wire format (2 variations allowed):</p>
<p>Variation 1:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> 0 2 3 39
<div class="highlighter-rouge"><pre class="highlight"><code> 0 2 3 39
|----|--|-----------------------------|
magic op name.ns_id (37 bytes)
</code></pre></div></div>
</code></pre>
</div>
<p>Variation 2:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> 0 2 3 39 59
<div class="highlighter-rouge"><pre class="highlight"><code> 0 2 3 39 59
|----|--|----------------------------------|-------------------|
magic op name.ns_id (37 bytes, 0-padded) value
</code></pre></div></div>
</code></pre>
</div>
<p>Inputs:</p>
<ul>
@ -448,16 +451,18 @@ registered and not expired, and owned by the transaction sender.</p>
<p><code class="highlighter-rouge">OP_RETURN</code> wire format (2 variations allowed):</p>
<p>Variation 1:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> 0 2 3 39
<div class="highlighter-rouge"><pre class="highlight"><code> 0 2 3 39
|----|--|-----------------------------|
magic op name.ns_id (37 bytes)
</code></pre></div></div>
</code></pre>
</div>
<p>Variation 2:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> 0 2 3 39 59
<div class="highlighter-rouge"><pre class="highlight"><code> 0 2 3 39 59
|----|--|----------------------------------|-------------------|
magic op name.ns_id (37 bytes, 0-padded) value
</code></pre></div></div>
</code></pre>
</div>
<p>Inputs:</p>
@ -499,10 +504,11 @@ network</a>.</p>
<p>Example: <a href="https://www.blocktrail.com/BTC/tx/e2029990fa75e9fc642f149dad196ac6b64b9c4a6db254f23a580b7508fc34d7">e2029990fa75e9fc642f149dad196ac6b64b9c4a6db254f23a580b7508fc34d7</a></p>
<p><code class="highlighter-rouge">OP_RETURN</code> wire format:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> 0 2 3 19 39
<div class="highlighter-rouge"><pre class="highlight"><code> 0 2 3 19 39
|-----|--|-----------------------------------|-----------------------|
magic op hash128(name.ns_id,consensus hash) zone file hash
</code></pre></div></div>
</code></pre>
</div>
<p>Note that <code class="highlighter-rouge">hash128(name.ns_id, consensus hash)</code> is the first 16 bytes of a SHA256 hash over the name concatenated to the hexadecimal string of the consensus hash (not the bytes corresponding to that hex string).
See the <a href="#method-glossary">Method Glossary</a> below.</p>
@ -534,11 +540,12 @@ BNS.</p>
<p>Example: <a href="https://www.blocktrail.com/BTC/tx/7a0a3bb7d39b89c3638abc369c85b5c028d0a55d7804ba1953ff19b0125f3c24">7a0a3bb7d39b89c3638abc369c85b5c028d0a55d7804ba1953ff19b0125f3c24</a></p>
<p><code class="highlighter-rouge">OP_RETURN</code> wire format:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> 0 2 3 4 20 36
<div class="highlighter-rouge"><pre class="highlight"><code> 0 2 3 4 20 36
|-----|--|----|-------------------|---------------|
magic op keep hash128(name.ns_id) consensus hash
data?
</code></pre></div></div>
</code></pre>
</div>
<p>Inputs:</p>
@ -573,10 +580,11 @@ name until it expires (if its namespace allows it to expire at all).</p>
<p>Example: <a href="https://www.blocktrail.com/BTC/tx/eb2e84a45cf411e528185a98cd5fb45ed349843a83d39fd4dff2de47adad8c8f">eb2e84a45cf411e528185a98cd5fb45ed349843a83d39fd4dff2de47adad8c8f</a></p>
<p><code class="highlighter-rouge">OP_RETURN</code> wire format:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> 0 2 3 39
<div class="highlighter-rouge"><pre class="highlight"><code> 0 2 3 39
|----|--|-----------------------------|
magic op name.ns_id (37 bytes)
</code></pre></div></div>
</code></pre>
</div>
<p>Inputs:</p>
@ -611,10 +619,11 @@ network</a>. This transaction references it by content hash.</li>
<p><code class="highlighter-rouge">OP_RETURN</code> wire format:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> 0 2 3 23
<div class="highlighter-rouge"><pre class="highlight"><code> 0 2 3 23
|----|--|-----------------------------|
magic op ripemd160(sha256(message))
</code></pre></div></div>
</code></pre>
</div>
<p>Inputs:</p>
@ -645,10 +654,11 @@ first of three transactions that must be sent to create a namespace.</p>
<p>Example: <a href="https://www.blocktrail.com/BTC/tx/5f00b8e609821edd6f3369ee4ee86e03ea34b890e242236cdb66ef6c9c6a1b28">5f00b8e609821edd6f3369ee4ee86e03ea34b890e242236cdb66ef6c9c6a1b28</a></p>
<p><code class="highlighter-rouge">OP_RETURN</code> wire format:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> 0 2 3 23 39
<div class="highlighter-rouge"><pre class="highlight"><code> 0 2 3 23 39
|-----|---|-----------------------------------------|----------------|
magic op hash_name(ns_id,script_pubkey,reveal_addr) consensus hash
</code></pre></div></div>
</code></pre>
</div>
<p>Inputs:</p>
@ -680,12 +690,13 @@ for a previously-anounced namespace hash (sent by a previous <code class="highli
<p>Example: <a href="https://www.blocktrail.com/BTC/tx/ab54b1c1dd5332dc86b24ca2f88b8ca0068485edf0c322416d104c5b84133a32">ab54b1c1dd5332dc86b24ca2f88b8ca0068485edf0c322416d104c5b84133a32</a></p>
<p><code class="highlighter-rouge">OP_RETURN</code> wire format:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> 0 2 3 7 8 9 10 11 12 13 14 15 16 17 18 20 39
<div class="highlighter-rouge"><pre class="highlight"><code> 0 2 3 7 8 9 10 11 12 13 14 15 16 17 18 20 39
|-----|---|--------|-----|-----|----|----|----|----|----|-----|-----|-----|--------|----------|-------------------------|
magic op life coeff. base 1-2 3-4 5-6 7-8 9-10 11-12 13-14 15-16 nonalpha version namespace ID
bucket exponents no-vowel
discounts
</code></pre></div></div>
</code></pre>
</div>
<p>Inputs:</p>
@ -751,10 +762,11 @@ creator can import names. See the <a href="/core/naming/namespace.html">namespa
<p>Example: <a href="https://www.blocktrail.com/BTC/tx/c698ac4b4a61c90b2c93dababde867dea359f971e2efcf415c37c9a4d9c4f312">c698ac4b4a61c90b2c93dababde867dea359f971e2efcf415c37c9a4d9c4f312</a></p>
<p><code class="highlighter-rouge">OP_RETURN</code> wire format:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> 0 2 3 39
<div class="highlighter-rouge"><pre class="highlight"><code> 0 2 3 39
|----|--|-----------------------------|
magic op name.ns_id (37 bytes)
</code></pre></div></div>
</code></pre>
</div>
<p>Inputs:</p>
@ -791,11 +803,12 @@ namespace.</p>
<p>Example: <a href="https://www.blocktrail.com/BTC/tx/2bf9a97e3081886f96c4def36d99a677059fafdbd6bdb6d626c0608a1e286032">2bf9a97e3081886f96c4def36d99a677059fafdbd6bdb6d626c0608a1e286032</a></p>
<p><code class="highlighter-rouge">OP_RETURN</code> wire format:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>
<div class="highlighter-rouge"><pre class="highlight"><code>
0 2 3 4 23
|-----|--|--|------------|
magic op . ns_id
</code></pre></div></div>
</code></pre>
</div>
<p>Inputs:</p>
<ul>
@ -817,7 +830,7 @@ namespace.</p>
<p>Some hashing primitives are used to construct the wire-format representation of each name operation. They are enumerated here:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>B40_REGEX = '^[a-z0-9\-_.+]*$'
<div class="highlighter-rouge"><pre class="highlight"><code>B40_REGEX = '^[a-z0-9\-_.+]*$'
def is_b40(s):
return isinstance(s, str) and re.match(B40_REGEX, s) is not None
@ -869,7 +882,8 @@ def hash128(data):
first 16 bytes
"""
return hexlify(bin_sha256(data)[0:16])
</code></pre></div></div>
</code></pre>
</div>
<div class="share uk-text-center">
<a href="https://twitter.com/intent/tweet?text=Bitcoin wire format&url=https://docs.blockstack.org/core/wire-format.html&via=&related=" rel="nofollow" target="_blank" title="Share on Twitter" onclick="window.open(this.href, 'twitter', 'width=550,height=235');return false;"><span data-uk-icon="icon: twitter; ratio: 1.2"></span></a>

7
_site/feed.xml

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.8.4">Jekyll</generator><link href="https://docs.blockstack.org/feed.xml" rel="self" type="application/atom+xml" /><link href="https://docs.blockstack.org/" rel="alternate" type="text/html" /><updated>2018-10-17T09:26:44-07:00</updated><id>https://docs.blockstack.org/</id><title type="html">Blockstack</title><subtitle>Docs</subtitle><author><name>Blockstack</name></author><entry><title type="html">Site tags</title><link href="https://docs.blockstack.org/2017/05/25/post63.html" rel="alternate" type="text/html" title="Site tags" /><published>2017-05-25T00:00:00-07:00</published><updated>2017-05-25T00:00:00-07:00</updated><id>https://docs.blockstack.org/2017/05/25/post63</id><content type="html" xml:base="https://docs.blockstack.org/2017/05/25/post63.html">&lt;p&gt;https://docs.blockstack.org/assets/posts/&lt;/p&gt;
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.5.0">Jekyll</generator><link href="https://docs.blockstack.org/feed.xml" rel="self" type="application/atom+xml" /><link href="https://docs.blockstack.org/" rel="alternate" type="text/html" /><updated>2018-10-22T10:20:43-07:00</updated><id>https://docs.blockstack.org/</id><title type="html">Blockstack</title><subtitle>Docs</subtitle><author><name>Blockstack</name></author><entry><title type="html">Site tags</title><link href="https://docs.blockstack.org/2017/05/25/post63.html" rel="alternate" type="text/html" title="Site tags" /><published>2017-05-25T00:00:00-07:00</published><updated>2017-05-25T00:00:00-07:00</updated><id>https://docs.blockstack.org/2017/05/25/post63</id><content type="html" xml:base="https://docs.blockstack.org/2017/05/25/post63.html">&lt;p&gt;https://docs.blockstack.org/assets/posts/&lt;/p&gt;
&lt;p&gt;/2017/05/25/post63.html&lt;/p&gt;
@ -26,7 +26,7 @@
&lt;h2 id=&quot;example-of-code-block&quot;&gt;Example Of Code Block&lt;/h2&gt;
&lt;p&gt;In accumsan lacus ac neque maximus dictum. Phasellus eleifend leo id mattis bibendum. Curabitur et purus turpis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;&lt;/p&gt;
&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;charset=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;utf-8&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;http-equiv=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;X-UA-Compatible&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;content=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;IE=edge&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;viewport&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;content=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;width=device-width, initial-scale=1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
@ -34,7 +34,8 @@
&lt;span class=&quot;nt&quot;&gt;&amp;lt;link&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;rel=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;shortcut icon&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;image/png&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/assets/img/favicon.png&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/assets/js/main.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h2 id=&quot;text-and-quote&quot;&gt;Text and Quote&lt;/h2&gt;
&lt;p&gt;Cras at dolor eget urna varius faucibus tempus in elit. Cras a dui imperdiet, tempus metus quis, pharetra turpis. Phasellus at massa sit amet ante semper fermentum sed eget lectus. Quisque id dictum magna turpis.&lt;/p&gt;

6
_site/index.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Blockstack | Docs</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Blockstack" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,7 +17,7 @@
<meta property="og:url" content="https://docs.blockstack.org/" />
<meta property="og:site_name" content="Blockstack" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/","author":{"@type":"Person","name":"Blockstack"},"headline":"Blockstack","description":"Docs","name":"Blockstack","@type":"WebSite","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/","headline":"Blockstack","author":{"@type":"Person","name":"Blockstack"},"description":"Docs","name":"Blockstack","@type":"WebSite","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -210,7 +210,7 @@
<div>
<div class="uk-card uk-card-body uk-inline uk-border-rounded">
<a class="uk-position-cover" href="/common/construction.html"></a>
<a class="uk-position-cover" href="/storage/gaia_redirect.html"></a>
<span data-uk-icon="icon: database; ratio: 2" class=""></span>

160
_site/ios/tutorial.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>iOS SDK Tutorial (Pre-release) | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="iOS SDK Tutorial (Pre-release)" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,9 +17,9 @@
<meta property="og:url" content="https://docs.blockstack.org/ios/tutorial.html" />
<meta property="og:site_name" content="Blockstack" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-10-17T09:26:44-07:00" />
<meta property="article:published_time" content="2018-10-22T10:20:43-07:00" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/ios/tutorial.html","author":{"@type":"Person","name":"Blockstack"},"headline":"iOS SDK Tutorial (Pre-release)","dateModified":"2018-10-17T09:26:44-07:00","description":"iOS SDK Tutorial (Pre-release)","datePublished":"2018-10-17T09:26:44-07:00","mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/ios/tutorial.html"},"@type":"BlogPosting","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/ios/tutorial.html","headline":"iOS SDK Tutorial (Pre-release)","dateModified":"2018-10-22T10:20:43-07:00","datePublished":"2018-10-22T10:20:43-07:00","author":{"@type":"Person","name":"Blockstack"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://docs.blockstack.org/ios/tutorial.html"},"description":"iOS SDK Tutorial (Pre-release)","@type":"BlogPosting","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->
@ -195,13 +195,13 @@
<!-- Written by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Blockstack</span></span><br> -->
<time datetime="2018-10-17T09:26:44-07:00" itemprop="datePublished">
<time datetime="2018-10-22T10:20:43-07:00" itemprop="datePublished">
<a "target="_blank" href="https://github.com/blockstack/blockstack-ios/blob/master/docs/tutorial.md" class="btn btn-default githubEditButton" role="button">
<span data-uk-icon="icon: pencil; ratio: 1.2"></span> Edit this page on Github</a>
<span style="font-family:Wingdings">&#119;</span> Oct 17, 2018
<span style="font-family:Wingdings">&#119;</span> Oct 22, 2018
</time>
</div>
@ -292,9 +292,10 @@ Depending on your network connection, this can take between 15-30 minutes.</p>
Before you begin, verify you have installed <code class="highlighter-rouge">npm</code> using the <code class="highlighter-rouge">which</code> command to
verify.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>which npm
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>which npm
/usr/local/bin/npm
</code></pre></div></div>
</code></pre>
</div>
<p>If you don’t find <code class="highlighter-rouge">npm</code> in your system, <a href="https://www.npmjs.com/get-npm">install
it</a>.</p>
@ -310,14 +311,16 @@ use libraries from the community in your project.</p>
incapability between Cocoapods and XCode. Before starting the tutorial, confirm
you have installed CocoaPods.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>pod <span class="nt">--version</span>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>pod --version
1.6.0.beta.1
</code></pre></div></div>
</code></pre>
</div>
<p>If you don’t have the CocoaPods beta version, install it:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>gem <span class="nb">install </span>cocoapods <span class="nt">-v</span> 1.6.0.beta.1
</code></pre></div></div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code>sudo gem install cocoapods -v 1.6.0.beta.1
</code></pre>
</div>
<h3 id="use-npm-to-install-yeoman-and-the-blockstack-app-generator">Use npm to install Yeoman and the Blockstack App Generator</h3>
@ -329,14 +332,16 @@ existing projects.</p>
<li>
<p>Install Yeoman.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> npm <span class="nb">install</span> <span class="nt">-g</span> yo
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> npm install -g yo
</code></pre>
</div>
</li>
<li>
<p>Install the Blockstack application generator.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> npm <span class="nb">install</span> <span class="nt">-g</span> generator-blockstack
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> npm install -g generator-blockstack
</code></pre>
</div>
<h2 id="build-the-blockstack-hello-world">Build the Blockstack hello-world</h2>
</li>
</ol>
@ -353,24 +358,27 @@ modify the <code class="highlighter-rouge">hello-world</code> to interact with t
<li>
<p>Create a <code class="highlighter-rouge">hello-blockstack</code> directory.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nb">mkdir </span>hello-blockstack
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> mkdir hello-blockstack
</code></pre>
</div>
</li>
<li>
<p>Change into your new directory.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nb">cd </span>hello-blockstack
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nb">cd </span>hello-blockstack
</code></pre>
</div>
</li>
<li>
<p>Use Yeoman and the Blockstack application generator to create your initial <code class="highlighter-rouge">hello-blockstack</code> application.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> yo blockstack:react
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> yo blockstack:react
</code></pre>
</div>
<p>You should see several interactive prompts.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nv">$ </span>yo blockstack:react
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nv">$ </span>yo blockstack:react
<span class="o">==========================================================================</span>
We are constantly looking <span class="k">for </span>ways to make yo better!
May we anonymously report usage statistics to improve the tool over <span class="nb">time</span>?
@ -379,8 +387,8 @@ modify the <code class="highlighter-rouge">hello-world</code> to interact with t
_-----_ ╭──────────────────────────╮
| | │ Welcome to the │
|--<span class="o">(</span>o<span class="o">)</span><span class="nt">--</span>| │ Blockstack app │
<span class="sb">`</span><span class="nt">---------</span>´ │ generator! │
|--<span class="o">(</span>o<span class="o">)</span>--| │ Blockstack app │
<span class="sb">`</span>---------´ │ generator! │
<span class="o">(</span> _´U<span class="sb">`</span>_ <span class="o">)</span> ╰──────────────────────────╯
/___A___<span class="se">\ </span> /
| ~ |
@ -388,26 +396,28 @@ modify the <code class="highlighter-rouge">hello-world</code> to interact with t
´ <span class="sb">`</span> |° ´ Y <span class="sb">`</span>
? Are you ready to build a Blockstack app <span class="k">in </span>React? <span class="o">(</span>Y/n<span class="o">)</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Respond to the prompts to populate the initial app.</p>
<p>After the process completes successfully, you see a prompt similar to the following:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="o">[</span>fsevents] Success:
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="o">[</span>fsevents] Success:
<span class="s2">"/Users/theuser/repos/hello-blockstack/node_modules/fsevents/lib/binding/Release/node-v59-darwin-x64/fse.node"</span>
is installed via remote npm notice created a lockfile as package-lock.json.
You should commit this file. added 1060 packages <span class="k">in </span>26.901s
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Run the initial application.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> npm start
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> npm start
<span class="o">&gt;</span> hello-blockstack@0.0.0 start /Users/moxiegirl/repos/hello-blockstack
<span class="o">&gt;</span> webpack-dev-server
&gt; hello-blockstack@0.0.0 start /Users/moxiegirl/repos/hello-blockstack
&gt; webpack-dev-server
Project is running at http://localhost:8080/
webpack output is served from /
@ -424,7 +434,8 @@ modify the <code class="highlighter-rouge">hello-world</code> to interact with t
<span class="o">[</span>2] <span class="o">(</span>webpack<span class="o">)</span>/buildin/global.js 509 bytes <span class="o">{</span>0<span class="o">}</span> <span class="o">[</span>built]
<span class="o">[</span>3] <span class="o">(</span>webpack<span class="o">)</span>/buildin/module.js 517 bytes <span class="o">{</span>0<span class="o">}</span> <span class="o">[</span>built]
webpack: Compiled successfully.
</code></pre></div> </div>
</code></pre>
</div>
<p>At this point, the browser is running a Blockstack server on your local host.</p>
</li>
@ -469,8 +480,9 @@ application directory.</p>
<li>
<p>Create a <code class="highlighter-rouge">public</code> directory.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nv">$ </span><span class="nb">mkdir </span>public
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nv">$ </span>mkdir public
</code></pre>
</div>
</li>
<li>
<p>Use the <code class="highlighter-rouge">touch</code> command to add a redirect endpoint to your application.</p>
@ -478,13 +490,14 @@ application directory.</p>
<p>This endpoint on the web version of your app will redirect iOS users back
to your mobile app.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nv">$ </span><span class="nb">touch </span>public/redirect.html
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nv">$ </span>touch public/redirect.html
</code></pre>
</div>
</li>
<li>
<p>Open <code class="highlighter-rouge">redirect.html</code> and add code to the endpoint.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="cp">&lt;!DOCTYPE html&gt;</span>
<div class="highlighter-rouge"><pre class="highlight"><code> <span class="cp">&lt;!DOCTYPE html&gt;</span>
<span class="nt">&lt;html&gt;</span>
<span class="nt">&lt;head&gt;</span>
<span class="nt">&lt;title&gt;</span>Hello, Blockstack!<span class="nt">&lt;/title&gt;</span>
@ -500,7 +513,8 @@ to your mobile app.</p>
<span class="nt">&lt;body&gt;</span>
<span class="nt">&lt;/body&gt;</span>
<span class="nt">&lt;/html&gt;</span>
</code></pre></div> </div>
</code></pre>
</div>
<p>Blockstack apps are identified by their domain names. The endpoint will
receive a get request with the query parameter <code class="highlighter-rouge">authResponse=XXXX</code> and
@ -564,14 +578,16 @@ lines after.</p>
<li>
<p>Navigate to and change directory into the root of your project directory.</p>
<div class="language-swift highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="err">$</span> <span class="n">cd</span> <span class="n">hello</span><span class="o">-</span><span class="n">blockstack</span><span class="o">-</span><span class="n">ios</span>
</code></pre></div> </div>
<div class="language-swift highlighter-rouge"><pre class="highlight"><code> <span class="err">$</span> <span class="n">cd</span> <span class="n">hello</span><span class="o">-</span><span class="n">blockstack</span><span class="o">-</span><span class="n">ios</span>
</code></pre>
</div>
</li>
<li>
<p>Create a Podfile.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nv">$ </span>pod init
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code> <span class="nv">$ </span>pod init
</code></pre>
</div>
<p>The command creates a <code class="highlighter-rouge">Podfile</code> in the directory.</p>
</li>
@ -579,7 +595,7 @@ lines after.</p>
<li>
<p>Add a line stating the Blockstack dependency.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code># Uncomment the next line to define a global platform for your project
<div class="highlighter-rouge"><pre class="highlight"><code># Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'hello-blockstack-ios' do
@ -594,7 +610,8 @@ target 'hello-blockstack-ios' do
# Pods for testing
end
end
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>Save and close the <code class="highlighter-rouge">Podfile</code>.</li>
</ol>
@ -607,7 +624,7 @@ end
<li>
<p>Initialize the project with Cocoapods.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> $ pod install
<div class="highlighter-rouge"><pre class="highlight"><code> $ pod install
Analyzing dependencies
Downloading dependencies
Installing Blockstack (0.2.0)
@ -620,18 +637,20 @@ end
Pod installation complete! There is 1 dependency from the Podfile and 2 total pods installed.
[!] Automatically assigning platform `ios` with version `11.4` on target `hello-blockstack-ios` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
</code></pre></div> </div>
</code></pre>
</div>
<p>This command creates a number of files</p>
</li>
<li>
<p>Review the files that the <code class="highlighter-rouge">pod</code> installation created:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">ls
</span>Podfile hello-blockstack-ios hello-blockstack-iosTests
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>ls
Podfile hello-blockstack-ios hello-blockstack-iosTests
Podfile.lock hello-blockstack-ios.xcodeproj
Pods hello-blockstack-ios.xcworkspace
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>Start XCode and choose <strong>Open another project</strong>.</li>
<li>
@ -707,7 +726,7 @@ the user back to your iOS app. In this example, you use <code class="highlighter
<li>
<p>Replace the content of the <code class="highlighter-rouge">&lt;scenes&gt;</code> element with the following:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>&lt;scenes&gt;
<div class="highlighter-rouge"><pre class="highlight"><code>&lt;scenes&gt;
&lt;!--View Controller--&gt;
&lt;scene sceneID="EHf-IW-A2E"&gt;
&lt;objects&gt;
@ -741,16 +760,18 @@ the user back to your iOS app. In this example, you use <code class="highlighter
&lt;point key="canvasLocation" x="52" y="374.66266866566718"/&gt;
&lt;/scene&gt;
&lt;/scenes&gt;
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Immediately after scenes but before the close of the <code class="highlighter-rouge">&lt;/document&gt;</code> tag add the following <code class="highlighter-rouge">&lt;resources&gt;</code>.</p>
<div class="language-xml highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nt">&lt;resources&gt;</span>
<div class="language-xml highlighter-rouge"><pre class="highlight"><code> <span class="nt">&lt;resources&gt;</span>
<span class="nt">&lt;image</span> <span class="na">name=</span><span class="s">"Image"</span> <span class="na">width=</span><span class="s">"64"</span> <span class="na">height=</span><span class="s">"64"</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/resources&gt;</span>
<span class="nt">&lt;/document&gt;</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Choose <strong>Run &gt; Run app</strong> in the emulator.</p>
@ -777,7 +798,7 @@ functionality to your code.</p>
<li>
<p>Within the <code class="highlighter-rouge">&lt;viewController&gt;</code> element, replace the existing <code class="highlighter-rouge">&lt;view&gt;</code> subelement with the following:</p>
<div class="language-xml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt">&lt;view</span> <span class="na">key=</span><span class="s">"view"</span> <span class="na">contentMode=</span><span class="s">"scaleToFill"</span> <span class="na">id=</span><span class="s">"8bC-Xf-vdC"</span><span class="nt">&gt;</span>
<div class="language-xml highlighter-rouge"><pre class="highlight"><code><span class="nt">&lt;view</span> <span class="na">key=</span><span class="s">"view"</span> <span class="na">contentMode=</span><span class="s">"scaleToFill"</span> <span class="na">id=</span><span class="s">"8bC-Xf-vdC"</span><span class="nt">&gt;</span>
<span class="nt">&lt;rect</span> <span class="na">key=</span><span class="s">"frame"</span> <span class="na">x=</span><span class="s">"0.0"</span> <span class="na">y=</span><span class="s">"0.0"</span> <span class="na">width=</span><span class="s">"375"</span> <span class="na">height=</span><span class="s">"667"</span><span class="nt">/&gt;</span>
<span class="nt">&lt;autoresizingMask</span> <span class="na">key=</span><span class="s">"autoresizingMask"</span> <span class="na">widthSizable=</span><span class="s">"YES"</span> <span class="na">heightSizable=</span><span class="s">"YES"</span><span class="nt">/&gt;</span>
<span class="nt">&lt;subviews&gt;</span>
@ -817,7 +838,8 @@ functionality to your code.</p>
<span class="nt">&lt;/constraints&gt;</span>
<span class="nt">&lt;viewLayoutGuide</span> <span class="na">key=</span><span class="s">"safeArea"</span> <span class="na">id=</span><span class="s">"6Tk-OE-BBY"</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/view&gt;</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
</ol>
@ -849,19 +871,21 @@ functionality to your code.</p>
<p>When you are done, your ‘ViewController’ file contains the following variables:</p>
<div class="language-swift highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="kd">class</span> <span class="kt">ViewController</span><span class="p">:</span> <span class="kt">UIViewController</span> <span class="p">{</span>
<div class="language-swift highlighter-rouge"><pre class="highlight"><code> <span class="kd">class</span> <span class="kt">ViewController</span><span class="p">:</span> <span class="kt">UIViewController</span> <span class="p">{</span>
<span class="kd">@IBOutlet</span> <span class="k">var</span> <span class="nv">nameLabel</span><span class="p">:</span> <span class="kt">UILabel</span><span class="o">!</span>
<span class="kd">@IBOutlet</span> <span class="k">var</span> <span class="nv">signInButton</span><span class="p">:</span> <span class="kt">UIButton</span><span class="o">!</span>
</code></pre></div> </div>
</code></pre>
</div>
<p>And XCode has added two outlines to the <code class="highlighter-rouge">Main.storyboard</code> source.</p>
<div class="language-xml highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nt">&lt;connections&gt;</span>
<div class="language-xml highlighter-rouge"><pre class="highlight"><code> <span class="nt">&lt;connections&gt;</span>
<span class="nt">&lt;outlet</span> <span class="na">property=</span><span class="s">"nameLabel"</span> <span class="na">destination=</span><span class="s">"9eE-ZS-LU9"</span> <span class="na">id=</span><span class="s">"Ahv-Te-ZZo"</span><span class="nt">/&gt;</span>
<span class="nt">&lt;outlet</span> <span class="na">property=</span><span class="s">"signInButton"</span> <span class="na">destination=</span><span class="s">"Lfp-KX-BDb"</span> <span class="na">id=</span><span class="s">"yef-Jj-uPt"</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/connections&gt;</span>
</code></pre></div> </div>
</code></pre>
</div>
<p>Your connectors will have their own <code class="highlighter-rouge">destination</code> and <code class="highlighter-rouge">id</code> values.</p>
</li>
@ -885,17 +909,18 @@ this application in your mobile add for now. In XCode, do the following;</p>
<li>
<p>Add an import both for <code class="highlighter-rouge">Blockstack</code> and for <code class="highlighter-rouge">SafariServices</code>.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> import UIKit
<div class="highlighter-rouge"><pre class="highlight"><code> import UIKit
import Blockstack
import SafariServices
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Just before the <code class="highlighter-rouge">didReceiveMemoryWarning</code> function a private <code class="highlighter-rouge">updateUI()</code> function.</p>
<p>This function takes care of loading the user data from Blockstack.</p>
<div class="language-swift highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">private</span> <span class="kd">func</span> <span class="nf">updateUI</span><span class="p">()</span> <span class="p">{</span>
<div class="language-swift highlighter-rouge"><pre class="highlight"><code><span class="kd">private</span> <span class="kd">func</span> <span class="nf">updateUI</span><span class="p">()</span> <span class="p">{</span>
<span class="kt">DispatchQueue</span><span class="o">.</span><span class="n">main</span><span class="o">.</span><span class="n">async</span> <span class="p">{</span>
<span class="k">if</span> <span class="kt">Blockstack</span><span class="o">.</span><span class="n">shared</span><span class="o">.</span><span class="nf">isSignedIn</span><span class="p">()</span> <span class="p">{</span>
<span class="c1">// Read user profile data</span>
@ -913,7 +938,8 @@ this application in your mobile add for now. In XCode, do the following;</p>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
<p>The function uses the <code class="highlighter-rouge">Blockstack.shared.isSignedIn()</code> method to determine if
the user is already logged into Blockstack or not. It then uses the
@ -923,12 +949,13 @@ the application display with the username.</p>
<li>
<p>Replace the content of the <code class="highlighter-rouge">viewDidLoad()</code> function so that it calls this private function.</p>
<div class="language-swift highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">override</span> <span class="kd">func</span> <span class="nf">viewDidLoad</span><span class="p">()</span> <span class="p">{</span>
<div class="language-swift highlighter-rouge"><pre class="highlight"><code><span class="k">override</span> <span class="kd">func</span> <span class="nf">viewDidLoad</span><span class="p">()</span> <span class="p">{</span>
<span class="k">super</span><span class="o">.</span><span class="nf">viewDidLoad</span><span class="p">()</span>
<span class="c1">// Do any additional setup after loading the view, typically from a nib.</span>
<span class="k">self</span><span class="o">.</span><span class="nf">updateUI</span><span class="p">()</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
<li>
<p>Create a ‘signIn()’ function that handles both sign in and out.</p>
@ -936,7 +963,7 @@ the application display with the username.</p>
<p>The function uses the <code class="highlighter-rouge">Blockstack.shared.signIn()</code> and
<code class="highlighter-rouge">Blockstack.shared.signOut()</code> methods to sign the user into the application.</p>
<div class="language-swift highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="kd">@IBAction</span> <span class="kd">func</span> <span class="nf">signIn</span><span class="p">(</span><span class="n">_</span> <span class="nv">sender</span><span class="p">:</span> <span class="kt">UIButton</span><span class="p">)</span> <span class="p">{</span>
<div class="language-swift highlighter-rouge"><pre class="highlight"><code> <span class="kd">@IBAction</span> <span class="kd">func</span> <span class="nf">signIn</span><span class="p">(</span><span class="n">_</span> <span class="nv">sender</span><span class="p">:</span> <span class="kt">UIButton</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="kt">Blockstack</span><span class="o">.</span><span class="n">shared</span><span class="o">.</span><span class="nf">isSignedIn</span><span class="p">()</span> <span class="p">{</span>
<span class="nf">print</span><span class="p">(</span><span class="s">"Currently signed in so signing out."</span><span class="p">)</span>
<span class="kt">Blockstack</span><span class="o">.</span><span class="n">shared</span><span class="o">.</span><span class="nf">signOut</span><span class="p">()</span>
@ -959,7 +986,8 @@ the application display with the username.</p>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div> </div>
</code></pre>
</div>
</li>
</ol>

4
_site/news/index.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>News | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="News" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,7 +17,7 @@
<meta property="og:url" content="https://docs.blockstack.org/news/" />
<meta property="og:site_name" content="Blockstack" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/news/","author":{"@type":"Person","name":"Blockstack"},"headline":"News","description":"Docs","@type":"WebPage","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/news/","headline":"News","author":{"@type":"Person","name":"Blockstack"},"description":"Docs","@type":"WebPage","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->

4
_site/thanks/index.html

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Thanks | Blockstack</title>
<meta name="generator" content="Jekyll v3.8.4" />
<meta name="generator" content="Jekyll v3.5.0" />
<meta property="og:title" content="Thanks" />
<meta name="author" content="Blockstack" />
<meta property="og:locale" content="en_US" />
@ -17,7 +17,7 @@
<meta property="og:url" content="https://docs.blockstack.org/thanks/" />
<meta property="og:site_name" content="Blockstack" />
<script type="application/ld+json">
{"url":"https://docs.blockstack.org/thanks/","author":{"@type":"Person","name":"Blockstack"},"headline":"Thanks","description":"Docs","@type":"WebPage","@context":"http://schema.org"}</script>
{"url":"https://docs.blockstack.org/thanks/","headline":"Thanks","author":{"@type":"Person","name":"Blockstack"},"description":"Docs","@type":"WebPage","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!-- <meta property="og:image" content="https://docs.blockstack.org/assets/posts/logo.png"/> -->

5
_storage/gaia_redirect.md

@ -0,0 +1,5 @@
---
title: Storage with Gaia
layout: externalurl
redirect_url: https://github.com/blockstack/gaia
---
Loading…
Cancel
Save