<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Catching the Blockchain Train</title><link href="https://decentralized.blog/" rel="alternate"></link><link href="https://decentralized.blog/feeds/all.atom.xml" rel="self"></link><id>https://decentralized.blog/</id><updated>2018-03-18T21:22:00+01:00</updated><entry><title>The Lightning Network Rookie Guide</title><link href="https://decentralized.blog/the-lightning-network-rookie-guide.html" rel="alternate"></link><published>2018-03-18T21:22:00+01:00</published><updated>2018-03-18T21:22:00+01:00</updated><author><name>Mark Pors</name></author><id>tag:decentralized.blog,2018-03-18:/the-lightning-network-rookie-guide.html</id><summary type="html">&lt;p&gt;&lt;strong&gt;This article is part 1 of the new "Catching the BlockChain train" series: "The Lightning Network Rookie Guide".&lt;/strong&gt; &lt;/p&gt;
&lt;h2&gt;Oh my, a new series! Tell me more!&lt;/h2&gt;
&lt;p&gt;After five episodes about IPFS, it's time for another exciting technology in blockchain world: Lightning Networks. From here on just &lt;code&gt;Lightning Network&lt;/code&gt; (singular, I'll …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;This article is part 1 of the new "Catching the BlockChain train" series: "The Lightning Network Rookie Guide".&lt;/strong&gt; &lt;/p&gt;
&lt;h2&gt;Oh my, a new series! Tell me more!&lt;/h2&gt;
&lt;p&gt;After five episodes about IPFS, it's time for another exciting technology in blockchain world: Lightning Networks. From here on just &lt;code&gt;Lightning Network&lt;/code&gt; (singular, I'll explain why later) or &lt;code&gt;LN&lt;/code&gt; for short.&lt;/p&gt;
&lt;p&gt;A quick test to see if you paid attention: &lt;code&gt;LN&lt;/code&gt;. Did you expand this in your mind to &lt;code&gt;Lightning Network&lt;/code&gt;? Well done, you passed!&lt;/p&gt;
&lt;p&gt;BTW if you missed the episodes on IPFS, start &lt;a href="/catching-the-blockchain-train.html"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I like the idea to mix hands-on (playing with SW tools) with reading about and understanding the technology. This is reflected in the outline of this Rookie Guide*:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Play with the LN as an end user: this episode.&lt;/li&gt;
&lt;li&gt;Understanding the basics of the LN.&lt;/li&gt;
&lt;li&gt;Preparation: set up a Bitcoin full-node and a local block explorer.&lt;/li&gt;
&lt;li&gt;LN hands-on: installing LN nodes, more wallets, apps, buying a &lt;a href="https://store.blockstream.com/"&gt;t-shirt&lt;/a&gt; on mainnet, etc.&lt;/li&gt;
&lt;li&gt;Understanding the LN better: diving into the &lt;a href="http://lightning.network/lightning-network-paper.pdf"&gt;white paper&lt;/a&gt; and the &lt;a href="https://github.com/lightningnetwork/lightning-rfc"&gt;spec&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;*) If the term rookie offends you: I'm talking about myself of course. I'm figuring this all out while I write these posts turning myself from a rookie into a &lt;a href="https://english.stackexchange.com/questions/83832/list-of-expertise-levels-from-beginner-to-expert"&gt;beginner&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Satoshi's Vision!&lt;/h2&gt;
&lt;p&gt;Before we start, here's a glimpse of the genius of Satoshi Nakamoto: &lt;a href="https://www.reddit.com/r/Bitcoin/comments/6s7c9r/satoshis_vision_payment_channels_ln/"&gt;Satoshi's Vision! (Payment Channels / LN)&lt;/a&gt;. That was in 2010!&lt;/p&gt;
&lt;p&gt;We have a long way to go before we understand his specific statement:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;nTimeLock does the reverse.  It's an open transaction that can be replaced with new versions until the deadline.  It can't be recorded until it locks.  The highest version when the deadline hits gets recorded.  It could be used, for example, to write an escrow transaction that will automatically permanently lock and go through unless it is revoked before the deadline.  The feature isn't enabled or used yet, but the support is there so it could be implemented later.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;but we'll get there, one step at the time.&lt;/p&gt;
&lt;p&gt;Apparently, he was at it again in 2013: &lt;a href="https://twitter.com/ArminVanBitcoin/status/973778847287136258"&gt;This email, composed in April of 2013 by Mike Hearn, quotes Satoshi talking about what is now known as the #LightningNetwork&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;What's up with all the hype about the Lightning Network?&lt;/h2&gt;
&lt;p&gt;If you have been following Bitcoin tech, you are most likely aware of the Lightning Network. If not: it is a proposed solution to increase the scalability of the Bitcoin network by allowing "off-chain" transactions in a trustless way.&lt;/p&gt;
&lt;p&gt;There has been a lot of talk about the LN lately, probably because there are a couple of implementations and it seems to work. &lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.coindesk.com/bitcoins-lightning-network-problem-people-already-using/"&gt;People are already using&lt;/a&gt; it on top of the main Bitcoin network. And three days ago the first LN node for mainnet was &lt;a href="https://blog.lightning.engineering/announcement/2018/03/15/lnd-beta.html"&gt;announced&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Here is a cool visualization of the current &lt;a href="https://lnmainnet.gaben.win/"&gt;mainnet LN&lt;/a&gt;. When we are halfway this rookie guide I hope you and I to have our own node in there!&lt;/p&gt;
&lt;p&gt;Now, why is the Lightning Network so exciting? I'm a fanboy for quite a while now, but this podcast with &lt;a href="https://twitter.com/starkness"&gt;Elizabeth Stark&lt;/a&gt; and &lt;a href="https://twitter.com/aantonop"&gt;Andreas Antonopoulos&lt;/a&gt; got me really hooked: &lt;a href="https://letstalkbitcoin.com/blog/post/lets-talk-bitcoin-357-real-lightning-with-elizabeth-stark"&gt;Let's Talk Bitcoin! #357 Real Lightning with Elizabeth Stark&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I encourage you to listen to the whole podcast, but if you don't, no worries, here are the points that stand out (IMHO at least):&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Scalability improvements for Bitcoin&lt;/strong&gt;: speedy and low-fee transactions as Bitcoin was intended/advertised are now possible.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Micropayments&lt;/strong&gt;: for the first time in history there will be technology that makes small, cross-border, almost fee-free, payments possible.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Interoperability&lt;/strong&gt;: one LN for all blockchains. Just as the internet is a network of networks, we can see the LN as the blockchain of blockchains. Standardization is underway so that the different blockchains can work against a common interface. These specs are named &lt;a href="https://github.com/lightningnetwork/lightning-rfc/blob/master/00-introduction.md"&gt;BOLTs&lt;/a&gt; (like BIPs for Bitcoin).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cross chain swaps&lt;/strong&gt;: this interoperability facilitates &lt;a href="https://bitcointechtalk.com/atomic-swaps-d6ca26b680fe"&gt;atomic&lt;/a&gt; &lt;a href="https://twitter.com/lightning/status/931277111490265088"&gt;swaps&lt;/a&gt; from, e.g., Bitcoin to Ethereum or any blockchain that interfaces with this overlaying LN. Genuinely decentralized exchanges will then be possible.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Application layer&lt;/strong&gt;: on top of the LN (layer two above Bitcoin e.a. which represent layer one) there is layer three which will be the application layer. Here is where the &lt;a href="https://twitter.com/theonevortex/status/968281320341127168"&gt;zapps&lt;/a&gt; or &lt;a href="http://lightning.community/software/lnd/lightning/2017/07/05/emerging-lightning-developer-ecosystem/"&gt;lapps&lt;/a&gt; live.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Developer platform&lt;/strong&gt;: the LN opens up a whole world of possibilities for developers. The &lt;a href="https://github.com/lightningnetwork/lnd"&gt;LND implementation&lt;/a&gt; offers a &lt;a href="http://dev.lightning.community/guides/python-grpc/"&gt;gRPC&lt;/a&gt; interface that makes writing &lt;code&gt;(z|l)apps&lt;/code&gt; easier. We will dive into that later for sure!&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Developer community&lt;/strong&gt;: there are 100s of developers active in this space, so let's hurry up and become one of them. They hang out in the &lt;a href="https://lightningcommunity.slack.com/"&gt;Lightning Labs slack&lt;/a&gt; and get their documentation &lt;a href="http://dev.lightning.community/"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Now if &lt;em&gt;that&lt;/em&gt; doesn't get you excited... (it probably means you have a fun and meaningful life).&lt;/p&gt;
&lt;p&gt;OK then, let's see how it looks like from the end-user perspective...&lt;/p&gt;
&lt;h2&gt;Lightning Network wallets&lt;/h2&gt;
&lt;p&gt;Before diving into the workings of the LN protocol and before setting up our own LN node let's try out some wallets that are available right now:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Lighting Wallet&lt;/li&gt;
&lt;li&gt;HTLC.me&lt;/li&gt;
&lt;li&gt;Eclair Wallet&lt;/li&gt;
&lt;li&gt;Zap Desktop Wallet&lt;/li&gt;
&lt;li&gt;Lightning Desktop App&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;First get some testnet bitcoin&lt;/h3&gt;
&lt;p&gt;We use the wallets on the bitcoin testnet, so to play along you'll need some testnet bitcoin (tBTC). As in the old days for mainnet bitcoin, you can get them at a faucet. &lt;/p&gt;
&lt;p&gt;This &lt;a href="https://testnet.manu.backend.hamburg/faucet"&gt;faucet&lt;/a&gt; and &lt;a href="https://testnet.coinfaucet.eu/en/"&gt;this one also&lt;/a&gt; worked for me. If you have trouble getting testnet coins, please &lt;a href="https://twitter.com/pors"&gt;tweet to me&lt;/a&gt;, and I'll send you some.&lt;/p&gt;
&lt;p&gt;Note that testnet addresses have &lt;code&gt;m&lt;/code&gt;, &lt;code&gt;n&lt;/code&gt;, or &lt;code&gt;2&lt;/code&gt; as a &lt;a href="https://en.bitcoin.it/wiki/List_of_address_prefixes"&gt;prefix&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Testnet bitcoins haven't (and never will have) any value, but it still feels exciting to see a free 200.000.000 satoshis coming in :)&lt;/p&gt;
&lt;h3&gt;Lightning Wallet&lt;/h3&gt;
&lt;p&gt;&lt;img src="/img/lightning-network-wallet.jpg" class="left" width="30%" /&gt;&lt;/p&gt;
&lt;p&gt;This &lt;a href="http://lightning-wallet.com/"&gt;Lightning Wallet&lt;/a&gt; is for Android only; you can download it here: &lt;a href="https://play.google.com/store/apps/details?id=com.lightning.wallet"&gt;Bitcoin + Lightning Wallet&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I love this wallet as it is a one-guy project in the person of &lt;a href="https://github.com/btcontract"&gt;Anton Kumaigorodskiy&lt;/a&gt; and it has some innovative features.&lt;/p&gt;
&lt;p&gt;This wallet has an excellent online user manual, let's walk through it:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://lightning-wallet.com/setting-up-bitcoin-wallet.html"&gt;Setting up a Bitcoin wallet&lt;/a&gt;: this app is very convenient as it is an &lt;a href="https://bitcoin.org/en/developer-guide#simplified-payment-verification-spv"&gt;SPV&lt;/a&gt; Bitcoin node with a Lightning node built on top of it. Follow the instructions in the manual and send some testnet coins to your wallet. Note that you need a wait for the transaction to be confirmed a couple of times to proceed.&lt;/p&gt;
&lt;p&gt;Next: &lt;a href="http://lightning-wallet.com/using-lightning-wallet.html"&gt;Using the Lightning wallet&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Select the &lt;code&gt;Lightning&lt;/code&gt; tab and click &lt;code&gt;Open new channel&lt;/code&gt;. Now select a channel or search for one of the &lt;a href="https://bitcointalk.org/index.php?topic=2735482.0"&gt;recommended channels&lt;/a&gt; by Anton. I picked &lt;code&gt;oh hi mark&lt;/code&gt; as it made me feel very welcome. Then fund the channel (hey, you can fund the channel with a sub-satoshi resolution!) and wait for two confirmations.&lt;/p&gt;
&lt;p&gt;These confirmations can take a while as it is an actual bitcoin transaction. The amount you funded determines the maximum of the sum of the payments done through this channel. We'll dive into all this in the next episode of this guide.&lt;/p&gt;
&lt;p&gt;As soon as we have an active payment channel, we can buy something.&lt;/p&gt;
&lt;p&gt;My first purchase was an article at &lt;a href="https://yalls.org"&gt;yalls.org&lt;/a&gt; for 100 test-satoshi, then left a comment for 21 test-satoshi. Micropayments are a reality!&lt;/p&gt;
&lt;p&gt;I also bought a Blockaccino at &lt;a href="https://starblocks.acinq.co/"&gt;starblocks&lt;/a&gt;. A few more places where you can spend tBTC &lt;a href="http://lightningnetworkstores.com/testnet"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;What happens here is that the payment is routed over a series of payment channels through a number of nodes. And all in a trustless way, with super low fees and very very fast. Pretty amazing no?&lt;/p&gt;
&lt;p&gt;Watch the whole process in this &lt;a href="https://www.youtube.com/watch?v=yNFfUfyL2xE"&gt;Mobile Lightning wallet demo&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Anton also created another useful video: &lt;a href="https://www.youtube.com/watch?v=H-WJPjAp5u8"&gt;When Lightning goes wrong&lt;/a&gt;. It describes the various scenarios when channels are closed or when payments get stuck. These are the scenarios he describes:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;A mutual (cooperative) closing transaction: both peers of the channel agree to close the channel, and the remaining balance is settled on the blockchain without any delays. Both peers need to be online for this to work.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Forced channel closing if a peer does not respond or becomes uncooperative. The peer that forces the channel to close is "punished" by a very long waiting time for their bitcoin to become spendable.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Your peer wants to steal from you by sending a previous commitment transaction to the blockchain. We see that the peer is punished for that and gets less than he would have had he played by the rules.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;We'll find out in the next episode how all this is accomplished.&lt;/p&gt;
&lt;p&gt;A last cool feature of this wallet consists of two parts: the app on your phone and a server that offloads some of the work from the mobile app. It's named &lt;a href="http://lightning-wallet.com/what-does-olympus-server-do"&gt;Olympus&lt;/a&gt;, and there's a video about it &lt;a href="https://www.youtube.com/watch?v=26JM53asTWE"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To &lt;em&gt;receive&lt;/em&gt; a Lightning Network payment, we need another peer so let's move on to the next LN wallet...&lt;/p&gt;
&lt;h3&gt;HTLC.me&lt;/h3&gt;
&lt;p&gt;&lt;a href="https://htlc.me/"&gt;HTLC.me&lt;/a&gt; is the easiest way to get started, as you don't need to install anything and it gives you a bit tBTC to play with.&lt;/p&gt;
&lt;p&gt;From the user's perspective this is not a wallet, but a centralized front-end to a Lightning Network node. It keeps track of your balance, and you can access it by applying the recovery secret they provide the first time you activate your "wallet".&lt;/p&gt;
&lt;p&gt;Anyway, now that I created a wallet on HTLC.me and funded it with some tBTC, I can use it to test the receiving function on Anton's Lightning Wallet:&lt;/p&gt;
&lt;p&gt;From Anton's Lightning Wallet user guide:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Receiving Lightning funds&lt;/p&gt;
&lt;p&gt;In order to receive Lightning payments, some conditions must be met:&lt;/p&gt;
&lt;p&gt;Nothing can be received immediately after creating a new payment channel, as ‘room’ for incoming funds has to be made by spending some funds first. A payment channel can be thought of as a full bottle of water: in order to pour something in one first has to pour something out.&lt;/p&gt;
&lt;p&gt;Each channel implicitly contains a reserve which is unspendable and typically takes about 1% of the channel’s capacity. You must spend that reserve before receiving is allowed. Unspendable channel reserve is the reason you see a negative receive limit when a new channel is full. It indicates how much you need to spend before anything can be received through the channel.&lt;/p&gt;
&lt;p&gt;Every payment request is disposable, they can’t be fulfilled multiple times. So you will need to issue a new individual payment request for every incoming payment you wish to receive.&lt;/p&gt;
&lt;p&gt;Your Lightning wallet needs to be online in order to receive funds.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Next to that, there is also a risk receiving payments on a mobile app that is not always online. The peer can attempt to steal from you by sending a previous commitment transaction. Your LN client can only correct this if it is online at least once per day.&lt;/p&gt;
&lt;p&gt;&lt;img src="/img/htlc-me-payment.png" width="90%" /&gt;&lt;/p&gt;
&lt;p&gt;After making some space in the channel from my mobile app, I gave it a shot. Although the steps are very smooth, the actual payment failed as HTLC.me couldn't establish a connection to my mobile wallet.&lt;/p&gt;
&lt;p&gt;Let's try again with another wallet!&lt;/p&gt;
&lt;h3&gt;Eclair Wallet&lt;/h3&gt;
&lt;p&gt;The &lt;a href="https://play.google.com/store/apps/details?id=fr.acinq.eclair.wallet&amp;amp;hl=en"&gt;Eclair wallet&lt;/a&gt; is also for Android only. It was announced in &lt;a href="https://medium.com/@ACINQ/announcing-eclair-wallet-a8d8c136fc7e"&gt;this blog post&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It works more or less the same as Anton's Lightning Wallet. One difference is that it doesn't allow receiving tBTC as explained in the announcement above.&lt;/p&gt;
&lt;p&gt;The Eclair Wallet exposes some of the technical details like the Node id (Lightning Network's public identifier) of the wallet and the connected peers. Node addresses have the form of &lt;code&gt;some-public-key@ip-address:port&lt;/code&gt;, e.g., &lt;code&gt;03dc39d7f43720c2c0f86778dfd2a77049fa4a44b4f0a8afb62f3921567de41375@213.133.99.89:9735&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Speaking of peers, the Eclair wallet allows connecting to multiple peers (aka more than one payment channel). If you know the Node id you can look it up in this brilliant explorer: &lt;a href="https://explorer.acinq.co/#/n/03dc39d7f43720c2c0f86778dfd2a77049fa4a44b4f0a8afb62f3921567de41375"&gt;https://explorer.acinq.co/#/n/03dc39d7f43720c2c0f86778dfd2a77049fa4a44b4f0a8afb62f3921567de41375&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;&lt;img src="/img/eclair-wallet.jpg" class="left" width="30%" /&gt;&lt;/p&gt;
&lt;p&gt;From the wallet, you can scan that Node id and add it as another peer.&lt;/p&gt;
&lt;p&gt;Let me sit down a bit to let this sink in... It is a cliche, but we are living in the future. Visa et al. should be scared.&lt;/p&gt;
&lt;p&gt;Now, let's try again if we can receive with Anton's Lightning Wallet. I have both wallets connected to the same node to make it a bit easier (is it?). Unfortunately, we have no influence which channel the Eclair wallet uses.&lt;/p&gt;
&lt;p&gt;A little while later I wake up in the now: one forever pending payment and another one failed. Visa can breath normal again.&lt;/p&gt;
&lt;p&gt;Let's try with another wallet, maybe we have more luck there.&lt;/p&gt;
&lt;h3&gt;Zap Desktop Wallet&lt;/h3&gt;
&lt;p&gt;The &lt;a href="https://zap.jackmallers.com/"&gt;Zap wallet&lt;/a&gt; is a different beast; it uses a full &lt;a href="https://github.com/lightningnetwork/lnd"&gt;lnd&lt;/a&gt; node.&lt;/p&gt;
&lt;p&gt;This wallet was first announced in this article: &lt;a href="https://medium.com/@JimmyMow/announcing-zap-a-lightning-network-wallet-47622acd89fb"&gt;Announcing Zap: A Lightning Network Wallet&lt;/a&gt;. It has an embedded video with a walk-through that gives a good idea how it all works. But the better option is to download the wallet and play along! (BTW be warned this app is not ready for real use, it uses all CPU now and then, so only proceed if you like the sound of your computer's fans).&lt;/p&gt;
&lt;p&gt;Download the latest release for your platform here: &lt;a href="https://github.com/LN-Zap/zap-desktop/releases"&gt;releases&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;When running it the first time it takes a long time before you can use it. While it syncs, you can watch a couple of video's: &lt;a href="https://www.youtube.com/playlist?list=PLMj6UA3-f3cRfKmG1xRm3j0KBRCvbX4vW"&gt;Zap Lightning Network Wallet Tutorial&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I find this wallet not as intuitive as the other ones I played with, but it compensates this with the fact it is powered by a full lightning node. That hopefully means we can finally see how receiving tBTC works.&lt;/p&gt;
&lt;p&gt;&lt;img src="/img/zap-wallet.png" width="90%" /&gt;&lt;/p&gt;
&lt;p&gt;Another try to pay from Zap to Anton's app failed again, and payments to the Zap wallet from either mobile app also resulted in a &lt;code&gt;RouteNotFound&lt;/code&gt;. Not sure what is going on here, but receiving money is harder than spending it, just like in real life.&lt;/p&gt;
&lt;p&gt;Let's move on to our last wallet...&lt;/p&gt;
&lt;h3&gt;Lightning Desktop App&lt;/h3&gt;
&lt;p&gt;The latest release of this wallet (still massively in development) can be downloaded &lt;a href="https://github.com/lightninglabs/lightning-app/releases"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It was announced here: &lt;a href="https://blog.lightning.engineering/announcement/2017/10/12/test-blitz.html"&gt;Announcing Our Lightning Desktop App, Now Available for Testing&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Unfortunately, I couldn't get it to work on my Mac. I created an &lt;a href="https://github.com/lightninglabs/lightning-app/issues/245"&gt;issue&lt;/a&gt;, so when things get fixed (or they point me out what is wrong on my side) I'll update this article.&lt;/p&gt;
&lt;h2&gt;First Conclusions&lt;/h2&gt;
&lt;p&gt;Making payments is unreal, fast and cheap!&lt;/p&gt;
&lt;p&gt;Adding a peer node by reading a QR-code on the &lt;a href="https://explorer.acinq.co/#/"&gt;Lightning Network Explorer&lt;/a&gt; is like magic!&lt;/p&gt;
&lt;p&gt;Receiving payments works very smooth &lt;em&gt;if&lt;/em&gt; it worked... All my attempts failed, but OTOH, wallets that are not always online shouldn't receive payments in the first place. We have full nodes running on a server for that. Soon to be seen on this blog!&lt;/p&gt;
&lt;p&gt;Of all the wallets both mobile wallets are my favorite, as it is more natural to pay with a QR scan from your phone than copy-pasting payment requests.&lt;/p&gt;
&lt;p&gt;The next episode will be a bit less hands-on. I will dive deeper into the LN protocol, and hopefully, I can share that with you in an easy to understand way.&lt;/p&gt;</content></entry><entry><title>Ten terrible attempts to make IPFS human-friendly</title><link href="https://decentralized.blog/ten-terrible-attempts-to-make-ipfs-human-friendly.html" rel="alternate"></link><published>2017-09-14T16:44:00+02:00</published><updated>2017-09-14T16:44:00+02:00</updated><author><name>Mark Pors</name></author><id>tag:decentralized.blog,2017-09-14:/ten-terrible-attempts-to-make-ipfs-human-friendly.html</id><summary type="html">&lt;p&gt;&lt;strong&gt;This article is part 6 of the Blockchain train journal, start reading here: &lt;a href="/catching-the-blockchain-train.html"&gt;Catching the Blockchain Train&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;IPFS human-friendly naming; is it possible?&lt;/h2&gt;
&lt;p&gt;Did you see the traffic-magnet-title I came up with? It is a bit over the top; we're just looking at how the addressing of content can be …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;This article is part 6 of the Blockchain train journal, start reading here: &lt;a href="/catching-the-blockchain-train.html"&gt;Catching the Blockchain Train&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;IPFS human-friendly naming; is it possible?&lt;/h2&gt;
&lt;p&gt;Did you see the traffic-magnet-title I came up with? It is a bit over the top; we're just looking at how the addressing of content can be made a bit easier than &lt;code&gt;ipfs cat /ipfs/QmcJTRZuGVdqUoNS1414G2mim3mt39RU14JsTmbh4KJYeV&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;As mentioned in the previous post, adding some mutable "label" to point to (immutable) IPFS content is sometimes desired.&lt;/p&gt;
&lt;p&gt;An example is the content of this blog: the original address (hash) for the home page &lt;code&gt;/ipfs/QmcPx9ZQboyHw8T7Afe4DbWFcJYocef5Pe4H3u7eK1osnQ/&lt;/code&gt; is different from the current (ah no, already expired!) home page &lt;code&gt;/ipfs/QmcJTRZuGVdqUoNS1414G2mim3mt39RU14JsTmbh4KJYeV/&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Mutable links are essential, but not enough for us humans. They are hard to read, let alone remember.&lt;/p&gt;
&lt;p&gt;What we'll do in this episode is to explore different ways to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;resolve this problem of adding mutable links, and&lt;/li&gt;
&lt;li&gt;to make the links more human-friendly, while&lt;/li&gt;
&lt;li&gt;trying to stay decentralized where possible.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We'll see the following methods in action:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The IPFS gateway&lt;/li&gt;
&lt;li&gt;IPNS&lt;/li&gt;
&lt;li&gt;DNS TXT IPNS Records&lt;/li&gt;
&lt;li&gt;Browser extensions&lt;/li&gt;
&lt;li&gt;Namecoin &lt;/li&gt;
&lt;li&gt;Blockstack ID&lt;/li&gt;
&lt;li&gt;Ethereum Name Service&lt;/li&gt;
&lt;li&gt;Proquint Pronounceable Identifiers&lt;/li&gt;
&lt;li&gt;Name shorteners&lt;/li&gt;
&lt;li&gt;Filecoin&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;
To make IPFS more human-friendly, in the context of a decentralized IPFS powered website, there is currently no other way than sacrificing a part of decentralization using HTTP-to-IPFS gateways and old school DNS.
Naming systems in the blockchain sphere (Blockstack, Namecoin, EthNames) are possible candidates to improve the UX while keeping it 100% decentralized, but at this point of time none of these work out of the box. Filecoin might be the way to go, but that is still far away.&lt;/p&gt;
&lt;h2&gt;The IPFS gateway&lt;/h2&gt;
&lt;p&gt;The most obvious step to make content available on the old skool internet with a regular browser is to make use of the IPFS gateway. These gateways speak HTTP and access content through their IPFS node.&lt;/p&gt;
&lt;p&gt;Any gateway will do, but the gateway where content is pinned is of course faster. Examples of accessing the previous (before this post) home page of this blog:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://decentralized.blog:8080/ipfs/QmcJTRZuGVdqUoNS1414G2mim3mt39RU14JsTmbh4KJYeV/"&gt;http://decentralized.blog:8080/ipfs/QmcJTRZuGVdqUoNS1414G2mim3mt39RU14JsTmbh4KJYeV/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gateway.ipfs.io/ipfs/QmcJTRZuGVdqUoNS1414G2mim3mt39RU14JsTmbh4KJYeV/"&gt;https://gateway.ipfs.io/ipfs/QmcJTRZuGVdqUoNS1414G2mim3mt39RU14JsTmbh4KJYeV/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://localhost:8080/ipfs/QmcJTRZuGVdqUoNS1414G2mim3mt39RU14JsTmbh4KJYeV/"&gt;http://localhost:8080/ipfs/QmcJTRZuGVdqUoNS1414G2mim3mt39RU14JsTmbh4KJYeV/&lt;/a&gt; (if you have a local IPFS node running)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So while that works, it has a couple of problems:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;when the content of the home page changes these URL's still point to old content&lt;/li&gt;
&lt;li&gt;the hash is not very human-friendly (a.k.a. ugly)&lt;/li&gt;
&lt;li&gt;it introduced an element of centralization (sort of, there is no dependence on a particular single gateway)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;IPNS&lt;/h2&gt;
&lt;p&gt;To solve the first of these three problems we can, of course, use IPNS. Any time the content changes we publish the latest content hash like:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;ipfs name publish QmcJTRZuGVdqUoNS1414G2mim3mt39RU14JsTmbh4KJYeV
Published to QmRf4ERGvYpVo6HRa2VueZT8pWi8YvyLS3rW6ad2y83tdN: /ipfs/QmcJTRZuGVdqUoNS1414G2mim3mt39RU14JsTmbh4KJYeV
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Now we can access the home page through any gateway but with the mutable IPNS link: &lt;a href="http://decentralized.blog:8080/ipns/QmRf4ERGvYpVo6HRa2VueZT8pWi8YvyLS3rW6ad2y83tdN/"&gt;http://decentralized.blog:8080/ipns/QmRf4ERGvYpVo6HRa2VueZT8pWi8YvyLS3rW6ad2y83tdN/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Much better, but still ugly...&lt;/p&gt;
&lt;p&gt;Note: IPNS is still a bit shaky and forgets published names after about 12 hours. You might want to run a cron job to republish every 8 hours or so.&lt;/p&gt;
&lt;h2&gt;DNS TXT IPNS Records&lt;/h2&gt;
&lt;p&gt;Now, let's get rid of the hash. The white paper mentions the use of a DNS TXT record. This is what Wikipedia has to say about it:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A TXT record (short for text record) is a type of resource record in the Domain Name System (DNS) used to provide the ability to associate some arbitrary and unformatted text with a host or other name, such as human readable information about a server, network, data center, and other accounting information.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;So the owner of a domain can associate any data to this domain by adding a TXT record. It is like a key-value store where only the owner of the domain can write, and the world can read.&lt;/p&gt;
&lt;p&gt;This is used by IPNS to look up the &lt;code&gt;/ipns/&amp;lt;peerID&amp;gt;&lt;/code&gt; path if you insert a valid domain as the path.&lt;/p&gt;
&lt;p&gt;This is how IPNS normally resolves:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;# Publish
ipfs name publish QmcJTRZuGVdqUoNS1414G2mim3mt39RU14JsTmbh4KJYeV
Published to QmRf4ERGvYpVo6HRa2VueZT8pWi8YvyLS3rW6ad2y83tdN: /ipfs/QmcJTRZuGVdqUoNS1414G2mim3mt39RU14JsTmbh4KJYeV

# Normally IPFS resolves the peerID hash
$ ipfs name resolve /ipns/QmRf4ERGvYpVo6HRa2VueZT8pWi8YvyLS3rW6ad2y83tdN
/ipfs/QmcJTRZuGVdqUoNS1414G2mim3mt39RU14JsTmbh4KJYeV
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;To be able to resolve a domain we need to add a &lt;a href="https://github.com/ipfs/go-dnslink"&gt;dnslink&lt;/a&gt; to the TXT record for that domain.&lt;/p&gt;
&lt;p&gt;After doing so for the domain name of this blog (decentralized.blog) pointing to the &lt;code&gt;/ipfs&lt;/code&gt; link&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ dig txt decentralized.blog
.
.
&lt;span class="p"&gt;;;&lt;/span&gt; ANSWER SECTION:
decentralized.blog. &lt;span class="m"&gt;900&lt;/span&gt; IN  TXT &lt;span class="s2"&gt;&amp;quot;dnslink=/ipfs/QmcJTRZuGVdqUoNS1414G2mim3mt39RU14JsTmbh4KJYeV&amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;we can resolve by domain name&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ ipfs name resolve decentralized.blog
/ipfs/QmcJTRZuGVdqUoNS1414G2mim3mt39RU14JsTmbh4KJYeV
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;which allows us to use a much nicer address:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://ipfs.io/ipns/decentralized.blog/"&gt;/ipns/decentralized.blog&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This works, but every time I change the content, I have to change the DNS TXT record and wait for propagation. The cool thing is that I can make the DNS TXT record point to a &lt;code&gt;/ipns&lt;/code&gt; link, and simply do a &lt;code&gt;ipfs name publish&lt;/code&gt; when content has changed:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ dig TXT decentralized.blog
.
.
&lt;span class="p"&gt;;;&lt;/span&gt; ANSWER SECTION:
decentralized.blog. &lt;span class="m"&gt;900&lt;/span&gt; IN  TXT &lt;span class="s2"&gt;&amp;quot;dnslink=/ipns/QmRf4ERGvYpVo6HRa2VueZT8pWi8YvyLS3rW6ad2y83tdN&amp;quot;&lt;/span&gt;

&lt;span class="c1"&gt;# points to /ipns path now&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Note, I should have done this in the first place, but I was led on the wrong track by this example in the white paper:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;# this DNS TXT record
ipfs.benet.ai. TXT &amp;quot;ipfs=XLF2ipQ4jD3U ...&amp;quot;
# behaves as symlink
ln -s /ipns/XLF2ipQ4jD3U /ipns/fs.benet.ai
&lt;/pre&gt;&lt;/div&gt;


&lt;/blockquote&gt;
&lt;p&gt;That is probably a typo, although the ipfs.io domain also points to an immutable &lt;code&gt;/ipfs&lt;/code&gt; path for some reason:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ dig TXT ipfs.io
.
.
&lt;span class="p"&gt;;;&lt;/span&gt; ANSWER SECTION:
ipfs.io.        &lt;span class="m"&gt;60&lt;/span&gt;  IN  TXT &lt;span class="s2"&gt;&amp;quot;dnslink=/ipfs/QmPCawMTd7csXKf7QVr2B1QRDZxdPeWxtE4EpkDRYtJWty&amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;More about how IPFS resolves paths &lt;a href="https://discuss.ipfs.io/t/how-does-resolution-and-routing-work-with-ipfs/365/3"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So now we have a human-friendly URL but at the cost of adding more centralization (the DNS).&lt;/p&gt;
&lt;h2&gt;Browser extensions&lt;/h2&gt;
&lt;p&gt;I was hoping there was a browser extension that allowed me to browse a web of &lt;code&gt;/ipfs&lt;/code&gt; and &lt;code&gt;/ipns&lt;/code&gt; paths, but the extensions that do exist are not made for that purpose.&lt;/p&gt;
&lt;p&gt;Because it is still interesting, I'll mention it anyway. The most up to date extension is &lt;a href="https://github.com/ipfs/ipfs-companion"&gt;ipfs-companion&lt;/a&gt;. There are browser extensions available for &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/ipfs-companion/"&gt;Firefox&lt;/a&gt; and &lt;a href="https://chrome.google.com/webstore/detail/ipfs-companion/nibjojkomfdiaoajekhjakgkdhaomnch/"&gt;Chrome&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;One of the cool things it does is helping to distribute data by redirecting requests to the public gateway to your local node.&lt;/p&gt;
&lt;p&gt;Another exciting project is the &lt;a href="https://github.com/beakerbrowser/beaker"&gt;Beaker browser&lt;/a&gt; that used to support IPFS, but not anymore. It is a browser for distributed content based on &lt;a href="https://datproject.org/"&gt;Dat&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Namecoin&lt;/h2&gt;
&lt;h3&gt;What is Namecoin?&lt;/h3&gt;
&lt;p&gt;&lt;a href="https://namecoin.org/"&gt;Namecoin&lt;/a&gt; is a very interesting protocol based on blockchain technology. I won't go into it here in much depth, because I want to start exploring the mother of all blockchains first (i.e., Bitcoin, but you knew that).&lt;/p&gt;
&lt;p&gt;I just realized, this is episode 6 of &lt;a href="/catching-the-blockchain-train.html"&gt;Catching the Blockchain Train&lt;/a&gt;, and we haven't seen a single blockchain yet! And worst, we are not going into that here either... Please bear with me, and we will get there eventually.&lt;/p&gt;
&lt;p&gt;So, Namecoin. This is what they say about themselves on the website:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Namecoin is an experimental open-source technology which improves decentralization, security, censorship resistance, privacy, and speed of certain components of the Internet infrastructure such as DNS and identities.&lt;/p&gt;
&lt;p&gt;(For the technically minded, Namecoin is a key/value pair registration and transfer system based on the Bitcoin technology.)&lt;/p&gt;
&lt;p&gt;Bitcoin frees money – Namecoin frees DNS, identities, and other technologies.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The part about DNS might be able to help us here. Namecoin facilitates the &lt;code&gt;.bit&lt;/code&gt; TLD, which has its own &lt;a href="https://bit.namecoin.org/"&gt;portal&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Getting a .bit domain&lt;/h3&gt;
&lt;p&gt;To get started we need to get hold of a .bit name. I rented one a while ago at an exchange, but I now &lt;a href="https://bit.namecoin.org/your_website.html"&gt;see&lt;/a&gt; that there is a better way: using a Namecoin client. If you go the exchange way, realize that you don't have the private keys to control the domain (change value in the KV pair), so you don't own it.&lt;/p&gt;
&lt;p&gt;To get your own .bit domain name, follow the steps at &lt;a href="https://wiki.namecoin.org/index.php?title=Register_and_Configure_.bit_Domains"&gt;Register and Configure .bit Domains&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You'll see that you need a bit of namecoin (NMC) to get your .bit domain, but mining is not really an option (it is done alongside Bitcoin mining and hard), but you can also buy some. Here is a list of exchanges where you can buy NMC, &lt;a href="https://coinmarketcap.com/currencies/namecoin/#markets"&gt;Namecoin Markets&lt;/a&gt;, but I'd recommend &lt;a href="https://shapeshift.io/#/coins"&gt;ShapeShift&lt;/a&gt; if you already own some bitcoin or altcoin. You need 0.02 NMC which is about &lt;a href="https://coinmarketcap.com/currencies/namecoin/"&gt;nothing&lt;/a&gt;.
You can use this &lt;a href="https://namecha.in"&gt;namecoin explorer&lt;/a&gt; to see if your desired name is still available.&lt;/p&gt;
&lt;h3&gt;How a .bit lookup works&lt;/h3&gt;
&lt;p&gt;.bit domains have a unix-path equivalent like this: &lt;code&gt;d/somedotbitname&lt;/code&gt;. These paths are the key of a record stored in the Namecoin's blockchain. So to see what the value is you have to have access to a Namecoin node, and ask for the value of the record with key &lt;code&gt;d/somedotbitname&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;That value can be anything, but in practice, it is either a reference to nameservers (standard DNS) or directly to an IP address, or to a &lt;a href="https://en.wikipedia.org/wiki/Bitmessage"&gt;Bitmessage&lt;/a&gt; address. Others add their email and say the .bit address is for sale.&lt;/p&gt;
&lt;p&gt;We need access to a namecoin node to query it, but there are online REST API's (introducing a central point of failure) we can use, like &lt;a href="https://namecoin.webbtc.com/api/name"&gt;webbtc&lt;/a&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;# Bitmessage address value
$ curl http://namecoin.webbtc.com/name/d/mysite.json
{
  &amp;quot;name&amp;quot;: &amp;quot;d/mysite&amp;quot;,
  &amp;quot;value&amp;quot;: &amp;quot;BM-2cUyrUNq91XqdPSKvcHSytuED9nnTazf5r&amp;quot;,
  &amp;quot;txid&amp;quot;: &amp;quot;78e212c47b41b3ae80413a7064c7bee044f8f2bc27362e9c37d5474b68bfd9e3&amp;quot;,
  &amp;quot;address&amp;quot;: &amp;quot;NFE3ED8C3BGRXuzjBRD3YGJV6jrmbS5h3Q&amp;quot;,
  &amp;quot;expires_in&amp;quot;: 23292
}

# IP address value
$ curl http://namecoin.webbtc.com/name/d/dappersoftware.json
{
  &amp;quot;name&amp;quot;: &amp;quot;d/dappersoftware&amp;quot;,
  &amp;quot;value&amp;quot;: &amp;quot;{\&amp;quot;ip\&amp;quot;:\&amp;quot;207.111.216.146\&amp;quot;,\&amp;quot;map\&amp;quot;:{\&amp;quot;*\&amp;quot;:{\&amp;quot;ip\&amp;quot;:\&amp;quot;207.111.216.146\&amp;quot;}}}&amp;quot;,
  &amp;quot;txid&amp;quot;: &amp;quot;da72c6b0cf85c94d7b2d4f2f8534d1cdafa47ca94fd00489bf205f00c3fc1cb2&amp;quot;,
  &amp;quot;address&amp;quot;: &amp;quot;N2hrunEcP3PNxdKvihMKCoEnvLUcCcBhKw&amp;quot;,
  &amp;quot;expires_in&amp;quot;: 4344
}
&lt;/pre&gt;&lt;/div&gt;


&lt;h3&gt;How browsing .bit websites works&lt;/h3&gt;
&lt;p&gt;Obviously the normal DNS system doesn't know what to do with a &lt;code&gt;.bit&lt;/code&gt; domain, so in a browser that won't resolve to anything. The Namecoin team provides a layer on top op the namecoin node to be able to browse &lt;code&gt;.bit&lt;/code&gt; domains: &lt;a href="https://github.com/namecoin/ncdns"&gt;ncdns&lt;/a&gt;. I'll leave it at that since we are diverging from our goal...&lt;/p&gt;
&lt;h3&gt;How do we resolve a .bit domain to an IPFS hash?&lt;/h3&gt;
&lt;p&gt;What are we trying to do again? So much exciting stuff is going on that we almost got lost in the shapeshiftbitmessagewebbtcncdnschain. Focus!&lt;/p&gt;
&lt;p&gt;The goal of this exploration is to be able to pass around a human-friendly address like &lt;code&gt;dweb.bit&lt;/code&gt; to bring up an IPFS-powered website. That would be possible if the IPNS system knew how to read the value of &lt;code&gt;dweb.bit&lt;/code&gt; in the Namecoin blockchain and interpret it and resolve it to an IPFS address.&lt;/p&gt;
&lt;p&gt;It's just like we saw with the DNS TXT record trick, but now the IPFS node would need to have access to the Namecoin blockchain (or a centralized public API like webbtc we saw before).&lt;/p&gt;
&lt;p&gt;So: &lt;code&gt;/ipns/dweb.bit&lt;/code&gt; needs to resolve to &lt;code&gt;/ipfs/&amp;lt;some multihash&amp;gt;&lt;/code&gt;. The value field of a .bit record can be anything, so that is easy to solve. The other part would be that the IPNS resolver implementation needs to recognize .bit domains and access the Namecoin network somehow. This was not implemented as can be easily shown:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ ipfs name resolve dweb.bit
Error: Could not resolve name.
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The IPFS-Namecoin integration is discussed &lt;a href="https://github.com/ipfs/notes/issues/41"&gt;here&lt;/a&gt;. Personally, I would start by providing a central .bit lookup service on ipfs.io, and extend that later with a Namecoin resolver implementation in the ipfs code. It doesn't look like it has priority now in the IPFS project though.&lt;/p&gt;
&lt;p&gt;In any case, I'm ready: &lt;a href="https://namecha.in/name/d/dweb"&gt;dweb.bit&lt;/a&gt; points to &lt;code&gt;{ "ipns": "/ipns/QmRf4ERGvYpVo6HRa2VueZT8pWi8YvyLS3rW6ad2y83tdN" }&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;Blockstack ID&lt;/h2&gt;
&lt;p&gt;Another contestant for the naming layer that is mentioned in Juan Benet's presentations is Blockstack.&lt;/p&gt;
&lt;h3&gt;What is Blockstack?&lt;/h3&gt;
&lt;p&gt;This is what Wikipedia has to say about it:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Blockstack is the first implementation of a decentralized DNS system on top of the Bitcoin blockchain. It combines DNS functionality with public key infrastructure and is primarily meant to be used by new blockchain applications. &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;That sounds very similar to what Namecoin does, but it uses the Bitcoin blockchain instead of its own fork. In the past, &lt;a href="http://blog.onename.com/namecoin-to-bitcoin/"&gt;it used&lt;/a&gt; the Namecoin blockchain, but the idea is that it should be &lt;a href="https://www.youtube.com/watch?v=Itp6eRv1wRQ"&gt;blockchain agnostic&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;On the homepage of Blockstack a bigger goal is stated:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A New Internet for Decentralized Apps&lt;/p&gt;
&lt;p&gt;Blockstack is a new decentralized internet where users own their data and apps run locally. A browser portal is all that’s needed to get started.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;But for now, let's limit our focus to the decentralized DNS system.&lt;/p&gt;
&lt;h3&gt;How to register a Blockstack ID&lt;/h3&gt;
&lt;p&gt;The naming system is called Blockstack ID, and the TLD is &lt;code&gt;.id&lt;/code&gt;. You can get your own .id at &lt;a href="https://onename.com"&gt;onename&lt;/a&gt; or use the terminal as described here: &lt;a href="https://blockstack.org/docs"&gt;Blockstack CLI&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Let's try that:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;# First install blockstack with pip (Python2 only, booh!)

# Create a wallet; not mentioned in the documentation, but required to do first
$ blockstack setup 

# Check price for the desired name, the shorter the name, the more expensive
$ blockstack price dweb.id
{
    &amp;quot;name_price&amp;quot;: {
        &amp;quot;btc&amp;quot;: 0.016,
        &amp;quot;satoshis&amp;quot;: 1600000
    },
    &amp;quot;preorder_tx_fee&amp;quot;: {
        &amp;quot;btc&amp;quot;: 0.00219904,
        &amp;quot;satoshis&amp;quot;: 219904
    },
    &amp;quot;register_tx_fee&amp;quot;: {
        &amp;quot;btc&amp;quot;: 0.0020583,
        &amp;quot;satoshis&amp;quot;: 205830
    },
    &amp;quot;total_estimated_cost&amp;quot;: {
        &amp;quot;btc&amp;quot;: 0.02213352,
        &amp;quot;satoshis&amp;quot;: 2213352
    },
    &amp;quot;total_tx_fees&amp;quot;: 613352,
    &amp;quot;update_tx_fee&amp;quot;: {
        &amp;quot;btc&amp;quot;: 0.00187618,
        &amp;quot;satoshis&amp;quot;: 187618
    }
}

# Get a bitcoin address to pay the fee to
$ blockstack deposit
{
    &amp;quot;address&amp;quot;: &amp;quot;3BmAHjCLgELuRdg3jM1MMgm5twXPWWxr7s&amp;quot;,
    &amp;quot;message&amp;quot;: &amp;quot;Send bitcoins to the address specified.&amp;quot;
}

# Start the API server; also not documented, but the error on register is helpful
$ blockstack api start
{
    &amp;quot;status&amp;quot;: true
}

# Now register a name
$ blockstack register dweb.id
Calculating total registration costs for dweb.id...
Registering dweb.id will cost about 0.02213352 BTC.
Use `blockstack price dweb.id` for a cost breakdown

The entire process takes 48 confirmations, or about 5 hours.
You need to have Internet access during this time period, so
this program can send the right transactions at the right
times.

Continue? (y/N): y
{
    &amp;quot;message&amp;quot;: &amp;quot;Name queued for registration.  The process takes several hours.  You can check the status with `blockstack info`.&amp;quot;,
    &amp;quot;success&amp;quot;: true,
    &amp;quot;transaction_hash&amp;quot;: &amp;quot;c4fc237f4b13d9925f8180fbe9e131cd0a1ee54d9b8c7455c4b2e2464fbe1315&amp;quot;
}

# Check the status
$ blockstack info
{
    &amp;quot;cli_version&amp;quot;: &amp;quot;0.14.4.2&amp;quot;,
    &amp;quot;consensus_hash&amp;quot;: &amp;quot;47f015a3959a80e7ce9c5fb425833860&amp;quot;,
    &amp;quot;last_block_processed&amp;quot;: 482064,
    &amp;quot;last_block_seen&amp;quot;: 482070,
    &amp;quot;queues&amp;quot;: {
        &amp;quot;preorder&amp;quot;: [
            {
                &amp;quot;confirmations&amp;quot;: 0,
                &amp;quot;name&amp;quot;: &amp;quot;dweb.id&amp;quot;,
                &amp;quot;tx_hash&amp;quot;: &amp;quot;c4fc237f4b13d9925f8180fbe9e131cd0a1ee54d9b8c7455c4b2e2464fbe1315&amp;quot;
            }
        ]
    },
    &amp;quot;server_alive&amp;quot;: true,
    &amp;quot;server_host&amp;quot;: &amp;quot;node.blockstack.org&amp;quot;,
    &amp;quot;server_port&amp;quot;: 6264,
    &amp;quot;server_version&amp;quot;: &amp;quot;0.14.4.0&amp;quot;
}
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This is a Bitcoin transaction which can be inspected here &lt;a href="https://live.blockcypher.com/btc/tx/c4fc237f4b13d9925f8180fbe9e131cd0a1ee54d9b8c7455c4b2e2464fbe1315/"&gt;c4fc237f4b13d9925f8180fbe9e131cd0a1ee54d9b8c7455c4b2e2464fbe1315&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;About 5 hours later the registration was completed:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;# Check if we own the dweb.id name now
$ blockstack names
{
    &amp;quot;addresses&amp;quot;: [
        {
            &amp;quot;address&amp;quot;: &amp;quot;3PR8Js7pLt5Bagk5MZHffXoR43EpQrJHxT&amp;quot;,
            &amp;quot;names_owned&amp;quot;: [
                &amp;quot;pors.id&amp;quot;,
                &amp;quot;dweb.id&amp;quot;
            ]
        }
    ],
    &amp;quot;names_owned&amp;quot;: [
        &amp;quot;error&amp;quot;
    ]
}
# Hmm, sort of I guess :)
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;All in all, it seems more like an identity thing, but the &lt;code&gt;.id&lt;/code&gt; domains can also be used as a DNS record (BNS in this case). Blockstack also introduced namespaces, the bit after the dot (now id), which is obviously expensive.&lt;/p&gt;
&lt;h3&gt;How a .id lookup works&lt;/h3&gt;
&lt;p&gt;There is a command for lookups in the client:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ blockstack lookup timblee.id
&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;&amp;quot;profile&amp;quot;&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;&amp;quot;@type&amp;quot;&lt;/span&gt;: &lt;span class="s2"&gt;&amp;quot;Person&amp;quot;&lt;/span&gt;,
        &lt;span class="s2"&gt;&amp;quot;account&amp;quot;&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
            &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="s2"&gt;&amp;quot;@type&amp;quot;&lt;/span&gt;: &lt;span class="s2"&gt;&amp;quot;Account&amp;quot;&lt;/span&gt;,
                &lt;span class="s2"&gt;&amp;quot;identifier&amp;quot;&lt;/span&gt;: &lt;span class="s2"&gt;&amp;quot;timbl&amp;quot;&lt;/span&gt;,
                &lt;span class="s2"&gt;&amp;quot;proofType&amp;quot;&lt;/span&gt;: &lt;span class="s2"&gt;&amp;quot;http&amp;quot;&lt;/span&gt;,
                &lt;span class="s2"&gt;&amp;quot;proofUrl&amp;quot;&lt;/span&gt;: &lt;span class="s2"&gt;&amp;quot;https://gist.github.com/timbl/04e8ac7c81cd2dee2f51a5e8c672188d&amp;quot;&lt;/span&gt;,
                &lt;span class="s2"&gt;&amp;quot;service&amp;quot;&lt;/span&gt;: &lt;span class="s2"&gt;&amp;quot;github&amp;quot;&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;,
            &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="s2"&gt;&amp;quot;@type&amp;quot;&lt;/span&gt;: &lt;span class="s2"&gt;&amp;quot;Account&amp;quot;&lt;/span&gt;,
                &lt;span class="s2"&gt;&amp;quot;identifier&amp;quot;&lt;/span&gt;: &lt;span class="s2"&gt;&amp;quot;timberners_lee&amp;quot;&lt;/span&gt;,
                &lt;span class="s2"&gt;&amp;quot;proofType&amp;quot;&lt;/span&gt;: &lt;span class="s2"&gt;&amp;quot;http&amp;quot;&lt;/span&gt;,
                &lt;span class="s2"&gt;&amp;quot;proofUrl&amp;quot;&lt;/span&gt;: &lt;span class="s2"&gt;&amp;quot;https://twitter.com/timberners_lee/status/740677355950080001&amp;quot;&lt;/span&gt;,
                &lt;span class="s2"&gt;&amp;quot;service&amp;quot;&lt;/span&gt;: &lt;span class="s2"&gt;&amp;quot;twitter&amp;quot;&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;]&lt;/span&gt;,
        &lt;span class="s2"&gt;&amp;quot;image&amp;quot;&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
            &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="s2"&gt;&amp;quot;@type&amp;quot;&lt;/span&gt;: &lt;span class="s2"&gt;&amp;quot;ImageObject&amp;quot;&lt;/span&gt;,
                &lt;span class="s2"&gt;&amp;quot;contentUrl&amp;quot;&lt;/span&gt;: &lt;span class="s2"&gt;&amp;quot;https://s3.amazonaws.com/97p/lUU.jpeg&amp;quot;&lt;/span&gt;,
                &lt;span class="s2"&gt;&amp;quot;name&amp;quot;&lt;/span&gt;: &lt;span class="s2"&gt;&amp;quot;cover&amp;quot;&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;]&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;,
    &lt;span class="s2"&gt;&amp;quot;zonefile&amp;quot;&lt;/span&gt;: &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$ORIGIN&lt;/span&gt;&lt;span class="s2"&gt; timblee.id\n&lt;/span&gt;&lt;span class="nv"&gt;$TTL&lt;/span&gt;&lt;span class="s2"&gt; 3600\n_http._tcp URI 10 1 \&amp;quot;https://blockstack.s3.amazonaws.com/timblee.id\&amp;quot;\n&amp;quot;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The zonefile bit is the interesting part in our use case; we can store routing information in there.&lt;/p&gt;
&lt;p&gt;Also, there is an API (it seems a bit shaky, but it works for some accounts): &lt;a href="https://core.blockstack.org/v2/users/werner"&gt;https://core.blockstack.org/v2/users/werner&lt;/a&gt;. 
For &lt;a href="https://core.blockstack.org/v2/users/pors"&gt;pors.id&lt;/a&gt; the API doesn't work, but the &lt;a href="https://explorer.blockstack.org/name/pors.id"&gt;blockstack explorer&lt;/a&gt; does return data for this account.&lt;/p&gt;
&lt;p&gt;So how can we use all this?&lt;/p&gt;
&lt;h3&gt;How do we resolve a .id domain to an IPFS hash?&lt;/h3&gt;
&lt;p&gt;As said, the zone file entry seems to be the best spot to store routing information. This can be done with the CLI client with the &lt;code&gt;blockstack update&lt;/code&gt; command. But to what value do we need to set it? That all depends on what the Blockstack and IPFS teams have agreed on.&lt;/p&gt;
&lt;p&gt;A bit of Googling and digging in the Blockstack and IPFS forums didn't give me any answers and my hope was set on this duo-presentation &lt;a href="https://www.coindesk.com/events/construct-2017/videos/"&gt;Muneeb Ali &amp;amp; Juan Benet: Blockstack IPFS "CTO Briefing" at CONSTRUCT 2017&lt;/a&gt;, but not a word about integration there (at least not the addressing bit).&lt;/p&gt;
&lt;p&gt;There is some work about the integration between Blockstack and IPFS as a &lt;a href="https://github.com/blockstack/blockstack-core/issues/430"&gt;data storage layer&lt;/a&gt;. But that's not what we are looking for here.&lt;/p&gt;
&lt;p&gt;So just as with Namecoin, there is no way to use Blockstack as the name layer for IPFS.&lt;/p&gt;
&lt;p&gt;But again, I want to be ready when they are so I updated my zonefile:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;{&amp;quot;ipns&amp;quot;:&amp;quot;ipns/QmRf4ERGvYpVo6HRa2VueZT8pWi8YvyLS3rW6ad2y83tdN&amp;quot;}&amp;#39;&lt;/span&gt; &amp;gt; new_zone_file.txt
$ blockstack update dweb.id new_zone_file.txt
&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;&amp;quot;message&amp;quot;&lt;/span&gt;: &lt;span class="s2"&gt;&amp;quot;Name queued for update.  The process takes ~1 hour.  You can check the status with `blockstack info`.&amp;quot;&lt;/span&gt;,
    &lt;span class="s2"&gt;&amp;quot;success&amp;quot;&lt;/span&gt;: true,
    &lt;span class="s2"&gt;&amp;quot;transaction_hash&amp;quot;&lt;/span&gt;: &lt;span class="s2"&gt;&amp;quot;026c739761ec6ed60119b4d80da2ccf81f274d558f53f377d6862a6020d767b8&amp;quot;&lt;/span&gt;,
    &lt;span class="s2"&gt;&amp;quot;zonefile_hash&amp;quot;&lt;/span&gt;: &lt;span class="s2"&gt;&amp;quot;4db474dd1dda7502c6152d248b7a24302f6e104a&amp;quot;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;See the resulting Blockstackified zone file &lt;a href="https://explorer.blockstack.org/name/dweb.id"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I will revisit Blockstack in depth in a future post, as soon as we got a better understanding of blockchain technology in general.&lt;/p&gt;
&lt;h2&gt;Ethereum Name Service&lt;/h2&gt;
&lt;p&gt;We start to see a trend here: very cool blockchain powered name systems, but no support in IPFS. Let's see how ENS fares.&lt;/p&gt;
&lt;h3&gt;What is ENS?&lt;/h3&gt;
&lt;p&gt;From the documentation:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;ENS is the Ethereum Name Service, a distributed, open, and extensible naming system based on the Ethereum blockchain.&lt;/p&gt;
&lt;p&gt;ENS can be used to resolve a wide variety of resources. The initial standard for ENS defines resolution for Ethereum addresses, but the system is extensible by design, allowing more resource types to be resolved in future without the core components of ENS requiring upgrades.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;We haven't looked at &lt;a href="https://www.ethereum.org/"&gt;Ethereum&lt;/a&gt; yet, but that will, of course, be the case in an upcoming post (multiple posts most likely). It is next to Bitcoin the most important blockchain around.&lt;/p&gt;
&lt;p&gt;In short: Ethereum is building a decentralized virtual machine where you can run applications. From the Ethereum website:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Ethereum is a  decentralized platform that runs smart contracts: applications that run exactly as programmed without any possibility of downtime, censorship, fraud or third party interference.&lt;/p&gt;
&lt;p&gt;These apps run on a custom built  blockchain, an enormously powerful shared global infrastructure that can move value around and represent the ownership of property. This enables developers to create markets, store registries of debts or promises, move funds in accordance with instructions given long in the past (like a will or a futures contract) and many other things that have not been invented yet, all without a middle man or counterparty risk.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;As said, more on that later, for now we just look at the naming system.&lt;/p&gt;
&lt;p&gt;To understand the ENS basics, I recommend to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;read &lt;a href="http://docs.ens.domains/en/latest/introduction.html"&gt;ENS documentation introduction&lt;/a&gt; and&lt;/li&gt;
&lt;li&gt;watch &lt;a href="https://www.youtube.com/watch?v=pLDDbCZXvTE"&gt;ENS Ethereum Domain Name System&lt;/a&gt;, slides &lt;a href="https://arachnid.github.io/devcon2/#/title"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The currently available TLD is &lt;code&gt;.eth&lt;/code&gt;. Let's try to get one...&lt;/p&gt;
&lt;h3&gt;How to register a .eth name&lt;/h3&gt;
&lt;p&gt;The registration for a .eth name is set up as an auction. The details are not really relevant, but you can read more about it here: &lt;a href="https://registrar.ens.domains/"&gt;registrar.ens.domains&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This is also the officail app, but it didn't work for me for some reason. This one works much nicer: &lt;a href="https://www.myetherwallet.com/#ens"&gt;myetherwallet&lt;/a&gt;. It operates in combination with an Ethereum browser or this browser extension: &lt;a href="https://metamask.io/"&gt;metamask&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You need some Ether (the Ethereum currency) and a bit patience, and you will be the owner of a &lt;code&gt;.eth&lt;/code&gt; address.&lt;/p&gt;
&lt;p&gt;Progress can be followed here &lt;a href="https://etherscan.io/enslookup?q=yourname.eth"&gt;etherscan.io&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;How a .eth lookup works&lt;/h3&gt;
&lt;p&gt;There is a &lt;a href="https://github.com/ethereum/ens/blob/master/ensutils.js"&gt;javascript library&lt;/a&gt; that allows you to hook into the ENS system. This code needs to run on the Ethereum virtual machine. Currently, there seems no other way to interact with it.&lt;/p&gt;
&lt;h3&gt;How do we resolve a .eth domain to an IPFS hash?&lt;/h3&gt;
&lt;p&gt;Well, we don't. Although IPFS is mentioned once in the ENS documentation (in the intro) there is no code that makes integration possible. &lt;/p&gt;
&lt;h2&gt;Intermission: now what?&lt;/h2&gt;
&lt;p&gt;As we have seen so far, there is no (easy) way to use blockchain-based names to address IPFS content. We want to be able to pass around &lt;code&gt;.eth&lt;/code&gt;, &lt;code&gt;.id&lt;/code&gt;, and &lt;code&gt;.bit&lt;/code&gt; addresses and know it will resolve in a trusted way to the correct piece of content. I.e., the content that the owner of such an address wants it to point to.&lt;/p&gt;
&lt;p&gt;One way forward that will certainly happen for Ethereum and Blockstack is that IPFS will be used as one of the supported file systems. In that case, the user lives in the Ethereum or Blockstack world and will be able to use &lt;code&gt;.eth&lt;/code&gt; or &lt;code&gt;.id&lt;/code&gt; addresses.&lt;/p&gt;
&lt;p&gt;The alternative, where IPFS itself resolves these addresses is harder because IPFS nodes need trusted access to nodes of the other network. For example, this &lt;a href="https://github.com/llopv/go-ipfs/commit/c206f41072f405b09c05b7a0ed929218e1c15c55"&gt;proof of concept&lt;/a&gt; relies on having access to a Namecoin node on the same machine where the IPFS node runs. This is obviously not feasible (who wants to run a node for every naming system that comes out next to its IPFS node?).&lt;/p&gt;
&lt;p&gt;A proposal to solve this that I like is &lt;a href="https://github.com/ipfs/go-ipfs/issues/3942"&gt;pluggable ipns resolvers&lt;/a&gt;. I have added my own 2 cents to it, let's see where it leads. But till there is a solution, we still have a couple of contestants, starting with...&lt;/p&gt;
&lt;h2&gt;Proquint Pronounceable Identifiers&lt;/h2&gt;
&lt;p&gt;Another round another chance!&lt;/p&gt;
&lt;p&gt;From the white paper:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;There have always been schemes to encode binary into pronounceable words. IPNS supports Proquint. Thus:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;# this proquint phrase
/ipns/dahih-dolij-sozuk-vosah-luvar-fuluh
# will resolve to corresponding
/ipns/KhAwNprxYVxKqpDZ
&lt;/pre&gt;&lt;/div&gt;


&lt;/blockquote&gt;
&lt;p&gt;I'm not sure if this is an improvement, especially because the definition of "pronounceable" is stretched a bit here.&lt;/p&gt;
&lt;p&gt;As an aside, this remembers me of my first open source contribution &lt;code&gt;Sort-of-pronounceable password generator&lt;/code&gt; back in 2000. There was no github yet, so the source code is gone, but someone put it in a &lt;a href="https://pastebin.com/HaDBpB8Z"&gt;pastebin&lt;/a&gt; 11 years later (I found it when I Googled for my own name, ahem). To make sure this &lt;a href="http://localhost:8080/ipfs/QmZBN1F7r6FFPndxRxvYCvLS3cHWzdo74crmzEykjj6wgB"&gt;historic piece of code&lt;/a&gt; never gets lost I added it to IPFS.&lt;/p&gt;
&lt;p&gt;Back to Proquint! This is actually implemented in IPFS. So let's give it a try:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ ipfs name resolve -r /ipns/dahih-dolij-sozuk-vosah-luvar-fuluh
EU�o�C.��M�
&lt;span class="c1"&gt;# yuk&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;So yeah that works, but &lt;code&gt;/ipns/KhAwNprxYVxKqpDZ&lt;/code&gt; is not something valid.&lt;/p&gt;
&lt;p&gt;You can replay it with these online tools:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://l-ra.github.io/proquint/js/proquint.html"&gt;Proquint online tool&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://lenschulwitz.com/base58"&gt;Base58 encoder/decoder online&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To encode a valid IPNS peerId is a bit more work to figure out. I'm not interested in that now and also lazy, so I'll leave that to anyone who likes to &lt;a href="https://github.com/Bren2010/proquint/blob/master/proquint.go"&gt;dive into that&lt;/a&gt; :)&lt;/p&gt;
&lt;p&gt;Another solution mentioned in the white paper is...&lt;/p&gt;
&lt;h2&gt;Name shorteners&lt;/h2&gt;
&lt;p&gt;From the white paper:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Services are bound to spring up that will provide name shortening as a service, offering up their namespaces to users. This is similar to what we see today with DNS and Web URLs:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;# User can get a link from
/ipns/shorten.er/foobar
# To her own namespace
/ipns/XLF2ipQ4jD3UdeX5xp1KBgeHRhemUtaA8Vm
&lt;/pre&gt;&lt;/div&gt;


&lt;/blockquote&gt;
&lt;p&gt;So this is based on the ipns feature it can resolve domains via a DNS TXT record.&lt;/p&gt;
&lt;p&gt;Resolving goes like this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A request for &lt;code&gt;/ipns/shorten.er/foobar&lt;/code&gt; is resolved to &lt;code&gt;/ipns/&amp;lt;hash-of-shortener-service-provider&amp;gt;/foobar&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;This file &lt;code&gt;/ipns/&amp;lt;hash-of-shortener-service-provider&amp;gt;/foobar&lt;/code&gt; &lt;em&gt;points&lt;/em&gt; to the peerID address of &lt;code&gt;foobar&lt;/code&gt;, like: &lt;code&gt;/ipns/XLF2ipQ4jD3UdeX5xp1KBgeHRhemUtaA8Vm&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now, this pointing is not as easy as it sounds. This was probably the intended use of what is described in the white paper as Peer Links:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;As encouraged by SFS, users can link other users' Objects directly into their own Objects (namespace, home, etc). This has the benefit of also creating a web of trust (and supports the old Certificate Authority model):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;# Alice links to bob Bob
ipfs link /&amp;lt;alice-pk-hash&amp;gt;/friends/bob /&amp;lt;bob-pk-hash&amp;gt;
# Eve links to Alice
ipfs link /&amp;lt;eve-pk-hash/friends/alice /&amp;lt;alice-pk-hash&amp;gt;
# Eve also has access to Bob
/&amp;lt;eve-pk-hash/friends/alice/friends/bob
# access Verisign certified domains
/&amp;lt;verisign-pk-hash&amp;gt;/foo.com
&lt;/pre&gt;&lt;/div&gt;


&lt;/blockquote&gt;
&lt;p&gt;Unfortunately, the &lt;code&gt;ipfs link&lt;/code&gt; command is not implemented yet which probably explains why no-one implemented an IPFS name shortener.&lt;/p&gt;
&lt;p&gt;There is a way to do something similar to peer links with &lt;code&gt;ipfs files&lt;/code&gt;, but it is not suitable to build a name resolver. See here for my search for a solution: &lt;a href="https://discuss.ipfs.io/t/are-peer-links-supported/1035"&gt;Are Peer Links supported?&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Again no success here, but there might be hope for the future...&lt;/p&gt;
&lt;h2&gt;Filecoin&lt;/h2&gt;
&lt;p&gt;As mentioned in a previous post, Filecoin will be the cryptocurrency to help incentivize the file storage marketplace. This means that there will be a blockchain available in the IPFS network. The primary function of this blockchain is to pay and get paid for storage, but since it's there, it can also be used for other functionality. Like identity or a name system. &lt;/p&gt;
&lt;p&gt;In other words, just like Namecoin, Blockstack and ENS provide blockchain enabled identity/naming, Filecoin can do the same. We'll have to see how this all plays out in the next months (years?) but this seems like an attractive option since the IPFS nodes and the Filecoin nodes will most likely be one and the same or at least tightly integrated.&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://filecoin.io/filecoin.pdf"&gt;Filecoin white paper&lt;/a&gt; doesn't mention anything about naming, but it is still very early to say anything definite about it.&lt;/p&gt;
&lt;p&gt;This is an fascinating introduction &lt;a href="https://www.youtube.com/watch?v=e02czCnCuCM"&gt;Filecoin | White Paper Breakdown and Token Sale Analysis&lt;/a&gt; although he gets into a hate speech for a couple of minutes about the ICO (which I think is not completely undeserved).&lt;/p&gt;
&lt;p&gt;OK, more than enough about friendly naming I'd say! Time to move on to the next step in our journey to decentralizing this blog (more soon in the next episode...).&lt;/p&gt;</content></entry><entry><title>Understanding the IPFS White Paper part 2</title><link href="https://decentralized.blog/understanding-the-ipfs-white-paper-part-2.html" rel="alternate"></link><published>2017-08-21T17:44:00+02:00</published><updated>2017-08-21T17:44:00+02:00</updated><author><name>Mark Pors</name></author><id>tag:decentralized.blog,2017-08-21:/understanding-the-ipfs-white-paper-part-2.html</id><summary type="html">&lt;p&gt;&lt;strong&gt;This article is part 5 of the Blockchain train journal, start reading here: &lt;a href="/catching-the-blockchain-train.html"&gt;Catching the Blockchain Train&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;The IPFS White Paper: IPFS Design&lt;/h2&gt;
&lt;p&gt;The IPFS stack is visualized as follows:&lt;/p&gt;
&lt;p&gt;&lt;img src="/img/ipfs-stack.jpg" width="100%" /&gt;&lt;/p&gt;
&lt;p&gt;or with more detail:&lt;/p&gt;
&lt;p&gt;&lt;img src="/img/thin-waist.jpg" width="100%" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;I borrowed both images from presentations by Juan Benet (the BDFL of IPFS).&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The IPFS design …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;This article is part 5 of the Blockchain train journal, start reading here: &lt;a href="/catching-the-blockchain-train.html"&gt;Catching the Blockchain Train&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;The IPFS White Paper: IPFS Design&lt;/h2&gt;
&lt;p&gt;The IPFS stack is visualized as follows:&lt;/p&gt;
&lt;p&gt;&lt;img src="/img/ipfs-stack.jpg" width="100%" /&gt;&lt;/p&gt;
&lt;p&gt;or with more detail:&lt;/p&gt;
&lt;p&gt;&lt;img src="/img/thin-waist.jpg" width="100%" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;I borrowed both images from presentations by Juan Benet (the BDFL of IPFS).&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The IPFS design in the white paper goes more or less through these layers, bottom-up:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The IPFS Protocol is divided into a stack of sub-protocols responsible for different functionality:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Identities - manage node identity generation and verification.&lt;/li&gt;
&lt;li&gt;Network - manages connections to other peers, uses various underlying network protocols. Configurable.&lt;/li&gt;
&lt;li&gt;Routing - maintains information to locate specific peers and objects. Responds to both local and remote queries. Defaults to a DHT, but is swappable.&lt;/li&gt;
&lt;li&gt;Exchange - a novel block exchange protocol (BitSwap) that governs efficient block distribution. Modelled as a market, weakly incentivizes data replication. Trade Strategies swappable.&lt;/li&gt;
&lt;li&gt;Objects - a Merkle DAG of content-addressed immutable objects with links. Used to represent arbitrary data structures, e.g. file hierarchies and communication systems.&lt;/li&gt;
&lt;li&gt;Files - versioned file system hierarchy inspired by Git.&lt;/li&gt;
&lt;li&gt;Naming - A self-certifying mutable name system.&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;
&lt;p&gt;Here's my alternative naming of these sub-protocols:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Identities: name those nodes&lt;/li&gt;
&lt;li&gt;Network: talk to other clients&lt;/li&gt;
&lt;li&gt;Routing: announce and find stuff&lt;/li&gt;
&lt;li&gt;Exchange: give and take&lt;/li&gt;
&lt;li&gt;Objects: organize the data&lt;/li&gt;
&lt;li&gt;Files: uh?&lt;/li&gt;
&lt;li&gt;Naming: adding mutability&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Let's go through them and see if we can increase our understanding of IPFS a bit!&lt;/p&gt;
&lt;h2&gt;Identities: name those nodes&lt;/h2&gt;
&lt;p&gt;IPFS is a P2P network of clients; there is no central server. These clients are the nodes of the network and need a way to be identified by the other nodes. If you just number the nodes 1,2,3,... anyone can add a node with an existing ID and claim to be that node. To prevent that some cryptography is needed. IPFS does it like this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;generate a &lt;a href="https://en.wikipedia.org/wiki/Public_key_infrastructure"&gt;PKI&lt;/a&gt; key pair (public + private key)&lt;/li&gt;
&lt;li&gt;hash the public key&lt;/li&gt;
&lt;li&gt;the resulting hash is the NodeId&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All this is done during the &lt;code&gt;init&lt;/code&gt; phase of a node: &lt;code&gt;ipfs init&lt;/code&gt; &amp;gt; the resulting keys are stored in &lt;code&gt;~/.ipfs/config&lt;/code&gt; and returns the NodeId.&lt;/p&gt;
&lt;p&gt;When two nodes start communicating the following happens:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;exchange public keys&lt;/li&gt;
&lt;li&gt;check if: &lt;code&gt;hash(other.PublicKey) == other.NodeId&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;if so, we have identified the other node and can e.g. request for data objects&lt;/li&gt;
&lt;li&gt;if not, we disconnect from the "fake" node&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The actual hashing algorithm is not specified in the white paper, read the note about that here:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Rather than locking the system to a particular set of function choices, IPFS favors self-describing values. Hash digest values are stored in multihash format, which includes a short header specifying the hash function used, and the digest length in bytes. &lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;p&gt;\&lt;function code&gt;\&lt;digest length&gt;\&lt;digest bytes&gt;&lt;/p&gt;
&lt;p&gt;This allows the system to (a) choose the best function for the use case (e.g. stronger security vs faster performance), and (b) evolve as function choices change. Self-describing values allow using different parameter choices compatibly.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;These multihashes are part of a whole family of self-describing hashes, and it is brilliant, check it out: &lt;a href="https://github.com/multiformats/multiformats"&gt;multiformats&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Network: talk to other clients&lt;/h2&gt;
&lt;p&gt;The summary is this: IPFS works on top of any network (see the image above).&lt;/p&gt;
&lt;p&gt;Interesting here is the network addressing to connect to a peer. IPFS uses &lt;a href="https://github.com/multiformats/multiaddr"&gt;multiaddr&lt;/a&gt; formatting for that. You can see it in action when starting a node:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Swarm listening on /ip4/127.0.0.1/tcp/4001&lt;/p&gt;
&lt;p&gt;Swarm listening on /ip4/172.17.0.1/tcp/4001&lt;/p&gt;
&lt;p&gt;Swarm listening on /ip4/185.24.123.123/tcp/4001&lt;/p&gt;
&lt;p&gt;Swarm listening on /ip6/2a02:1234:9:0:21a:4aff:fed4:da32/tcp/4001&lt;/p&gt;
&lt;p&gt;Swarm listening on /ip6/::1/tcp/4001&lt;/p&gt;
&lt;p&gt;API server listening on /ip4/127.0.0.1/tcp/5001&lt;/p&gt;
&lt;p&gt;Gateway (read-only) server listening on /ip4/0.0.0.0/tcp/8080&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;Routing: announce and find stuff&lt;/h2&gt;
&lt;p&gt;The routing layer is based on a DHT, as discussed in the &lt;a href="/understanding-the-ipfs-white-paper-part-1.html"&gt;previous episode&lt;/a&gt;, and its purpose is to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;announce that this node has some data (a &lt;code&gt;block&lt;/code&gt; as discussed in the next chapter), or&lt;/li&gt;
&lt;li&gt;find which nodes have some specific data (by referring to the multihash of a block), and&lt;/li&gt;
&lt;li&gt;if the data is small enough (=&amp;lt; 1KB) the DHT stores the data as its value.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The command line interface and API don't expose the complete routing interface as specified in the white paper. What does work:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;# tell the DHT we have this specific content:
$ ipfs dht provide QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG

# ask for peers who have the content:
$ ipfs dht findprovs QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG
QmYebHWdWStasXWZQiXuFacckKC33HTbicXPkdSi5Yfpz6
QmczCvhy6unZEVC5ukR3BC3BPxYie4jBeRApTUKq97ZnEo
QmPM3WzZ3q1SR3pzXuGPHD7e6z3eWEWCnAvrNw7Wegyc8o
QmPKSqtkDmYsSxQbqNkZG1AmVnZSFyv5WF7fFE2YebNBFG
QmPMJ3HLLLBtW53R2YixhVHmVb3pkR2bHni3qbqq23vBSv
QmPNHJJphV1TB6Z99L6r9Y7bKaCBUQ67X17hicnEmsgWDJ
QmPNhiqGg81o2Perk2i7VNvvVuuLLUMKDxMNwVauP8r5Yv
QmPQJRgP3Vxi52Ho7HfnYdiCRJTRM1TXwgEnyjcwcLuKfb
QmNNxr1ZoyPbwNe2CvYz1CVyvSNWsE8WNwDWQ9t9BDjnj5
QmNT744VjtRFpDYB25EVLx7ha1zAVDKsd3qFjxfQLjPEXq
QmNWwGRWTYeut6qvKDhJBuEJZnbqMPMfuF81MPvHvPBX89
QmNZM5NmzZNPkvH2kPXDYNAB1cAeBNfxLyM9B1crgt3VeJ
QmNZRDzSJybdf4rmt972SH4U9TF6sEK8q2NSEJpEt7SkTp
QmNZdBUV9QXytVcPjcYM8i9AG22G2qwjZmh4ZwpJs9KvXi
QmNbSJ9okrwMphfjudiXVeE7QWkJiEe4JHHiKT8L4Pv7z5
QmNdqMkVqLTsJWj7Ja3oKwLNWcAYUkRjSZPg22B7rvKFMr
QmNfyHTzAetJGBFTRkXXHe5om13Qj4LLjd9SDwJ87T6vCK
QmNmrRTP5sJMUkobujpVXzzjpLACBTzf9weND6prUjdstW
QmNkGG9EZrq699KnjbENARLUg3HwRBC7nkojnmYY8joBXL
QmP6CHbxjvu5dxdJLGNmDZATdu3TizkRZ6cD9TUQsn4oxY

# Get all multiaddr&amp;#39;s for a peer
$ ipfs dht findpeer QmYebHWdWStasXWZQiXuFacckKC33HTbicXPkdSi5Yfpz6
/ip4/192.168.1.14/tcp/4001
/ip6/::1/tcp/4001
/ip4/127.0.0.1/tcp/4001
/ip4/1.2.3.4/tcp/37665
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;&lt;code&gt;ipfs put&lt;/code&gt; and &lt;code&gt;ipfs get&lt;/code&gt; only work for ipns records in the API. Maybe storing small data on the DHT itself was not implemented (yet)?&lt;/p&gt;
&lt;h2&gt;Exchange: give and take&lt;/h2&gt;
&lt;p&gt;Data is broken up into &lt;code&gt;blocks&lt;/code&gt;, and the exchange layer is responsible for distributing these blocks. It looks like BitTorrent, but it's different, so the protocol warrants its own name: BitSwap.&lt;/p&gt;
&lt;p&gt;The main difference is that wherein BitTorrent blocks are traded with peers looking for blocks of the same file (torrent swarm), in BitSwap blocks are traded cross-file. So one big swarm for all IPFS data.&lt;/p&gt;
&lt;p&gt;BitSwap is modeled as a marketplace that incentivizes data replication. The way this is implemented is called the BitSwap Strategy, and the white paper describes a feasible strategy and also states that the strategy can be replaced by another strategy. One such a bartering system can be based on a virtual currency, which is where &lt;a href="https://filecoin.io/"&gt;FileCoin&lt;/a&gt; comes in. &lt;/p&gt;
&lt;p&gt;Of course, each node can decide on its own strategy, so the generally used strategy must be resilient against abuse. When most nodes are set up to have some fair way of bartering it will work something like this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;when peers connect, they exchange which blocks they have (&lt;code&gt;have_list&lt;/code&gt;) and which blocks they are looking for (&lt;code&gt;want_list&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;to decide if a node will actually share data, it will apply its &lt;code&gt;BitSwap Strategy&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;this strategy is based on previous data exchanges between these two peers&lt;/li&gt;
&lt;li&gt;when peers exchange blocks they keep track of the amount of data they share (builds credit) and the amount of data they receive (builds debt)&lt;/li&gt;
&lt;li&gt;this accounting between two peers is kept track of in the &lt;code&gt;BitSwap Ledger&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;if a peer has credit (shared more than received), our node will send the requested block&lt;/li&gt;
&lt;li&gt;if a peer has debt, our node will share or not share, depending on a deterministic function where the chance of sharing becomes smaller when the debt is bigger&lt;/li&gt;
&lt;li&gt;a data exchange always starts with the exchange of the ledger, if it is not identical our node disconnects&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So this is set up kind of cool I think: game theory in action! The white paper further describes some edge cases like what to do if I have no blocks to barter with? The answer is simply to collect blocks that your peers are looking for, so you have something to trade. &lt;/p&gt;
&lt;p&gt;Now let's have a look how we can poke around in the innards of the BitSwap protocol.&lt;/p&gt;
&lt;p&gt;The command-line interface has a section &lt;code&gt;blocks&lt;/code&gt; and a section &lt;code&gt;bitswap&lt;/code&gt;; those sound relevant :)&lt;/p&gt;
&lt;p&gt;To see bitswap in action, I'm going to request a large file &lt;code&gt;Qmdsrpg2oXZTWGjat98VgpFQb5u1Vdw5Gun2rgQ2Xhxa2t﻿&lt;/code&gt; which is a video (download it to see what video!):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;# ask for the file
$ ipfs get Qmdsrpg2oXZTWGjat98VgpFQb5u1Vdw5Gun2rgQ2Xhxa2t﻿

# in a seperate terminal, after requesting the file, I inspect the &amp;quot;bitswap wantlist&amp;quot;
$ ipfs bitswap wantlist
QmYEqofNsPNQEa7yNx93KgDycmrzbFkr5oc3NMKXMxx5ff
QmUmDEBm9a8MYyqRdb3YQnoqPmqAo4cEWdKQErirFJdSWD
QmY5VJPbsRZzFCTMrFBx2qtZiyyeLhsjBysyfC1fx2gE9S
QmdbzYgyhqUNCNL8xU2HTSKwao1ck2Gmi5U1ygjQuJd92b
QmbZDe5Dcv9mJr8fiqp5aJL2cbyu64tgzwCS2Vy4P3krCL
QmRjzMzVeYRE5b6tDF3sTXMV1sTffno92uL3WwuFavBrWQ
QmPavzEJQw8atvErXQis6C6GF7DRFbb95doAaFkHe9M38u
QmY9fs1Pkr3nV7RkbGdfGh3q8HuKtMMCCUp22AAbwPYnrS
QmUtxZkuJuyydd124Z2cfx6jXMAMpcXZRF96QMAsXc2y6c
QmbYDTJkmLqMm6ojdL6pLP7C8mMVfVPnUxn3yp8HzXDcXf
QmbW9MZ7cwn8svpixosAuC7GQmUXDTZRuxJ8dJp6HyJzCS
QmdCLGWsYQFhi9y3BmkhUreX2S799iWGyJqvnbK9dzB55c
Qmc7EvnBPf2mPCUCfvjcsaQGLEakBbUN9iycnyrLF3b2or
Qmd1mNnDQPf1BAjFqDHjiLe4g4ZFPAheQCniYkbQPosjDE
QmPip8XzQhJFd487WWw7D8aBuGLwXtohciPtUDSnxpvMFR
QmZn5NAPEDtptMb3ybaMEdcVaoxWHs7rKQ4H5UBcyHiqTZ
.
.
.

# find a node where we have debt
$ ipfs dht findprovs Qmdsrpg2oXZTWGjat98VgpFQb5u1Vdw5Gun2rgQ2Xhxa2t
QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3
QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z
QmUh2KnjAvgEbJFSd5JZws4CNvt6LbC4C1sRpBgCbZQiqD
Qmc9pBLfKSwWboKHMvmKx1P7Z738CojuUXkPA1dsPrvSw2
QmZFhGyS2W833nKKkbqZAU2uSvBbWUytDJkKBHimwRmhd6
QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic
Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6

# try one to see if we have downloaded from that node
$ ipfs bitswap ledger QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3
Ledger for &amp;lt;peer.ID SoLMeW&amp;gt;
Debt ratio: 0.000000
Exchanges:  11
Bytes sent: 0
Bytes received: 2883738
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Thank you &lt;code&gt;QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3&lt;/code&gt;; what a generous peer you are!&lt;/p&gt;
&lt;p&gt;Now, have a look at the &lt;code&gt;block&lt;/code&gt; commands:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;# Let&amp;#39;s pick a block from the wantlist above
$ ipfs block stat QmYEqofNsPNQEa7yNx93KgDycmrzbFkr5oc3NMKXMxx5ff
Key: QmYEqofNsPNQEa7yNx93KgDycmrzbFkr5oc3NMKXMxx5ff
Size: 262158

$ ipfs block get QmYEqofNsPNQEa7yNx93KgDycmrzbFkr5oc3NMKXMxx5ff &amp;gt; slice_of_a_movie
# results in a binary file of 262 KB
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;We'll have another look at how blocks fit in in the next chapter.&lt;/p&gt;
&lt;p&gt;The three layers of the stack we described so far (network, routing, exchange) are implemented in &lt;a href="https://libp2p.io/"&gt;libp2p&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Let's climb up the stack to the core of IPFS...&lt;/p&gt;
&lt;h2&gt;Objects: organize the data&lt;/h2&gt;
&lt;p&gt;Now it gets fascinating. You could summarize IPFS as: Distributed, authenticated, hash-linked data structures. These hash-linked data structures are where the Merkle DAG comes in (remember our previous episode?). &lt;/p&gt;
&lt;p&gt;To create any data structure, IPFS offers a flexible and powerful solution:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;organize the data in a graph, where we call the nodes of the graph &lt;code&gt;objects&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;these objects can contain data (any sort of data, transparent to IPFS) and/or links to other objects&lt;/li&gt;
&lt;li&gt;these links - &lt;code&gt;Merkle Links&lt;/code&gt; - are simply the cryptographic hash of the target object&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This way of organizing data has a couple of useful properties (quoting from the white paper):&lt;/p&gt;
&lt;blockquote&gt;
&lt;ol&gt;
&lt;li&gt;Content Addressing: all content is uniquely identified by its multihash checksum, including links.&lt;/li&gt;
&lt;li&gt;Tamper resistance: all content is verified with its checksum. If data is tampered with or corrupted, IPFS detects it.&lt;/li&gt;
&lt;li&gt;Deduplication: all objects that hold the exact same content are equal, and only stored once. This is particularly useful with index objects, such as git trees and commits, or common portions of data.&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;
&lt;p&gt;To get a feel for IPFS objects, check out this &lt;a href="https://ipfs.io/ipfs/QmNZiPk974vDsPmQii3YbrMKfi12KTSNM7XMiYyiea4VYZ/example#/ipfs/QmP8WUPq2braGQ8iZjJ6w9di6mzgoTWyRLayrMRjjDoyGr/graphmd/README.md"&gt;objects visualization&lt;/a&gt; example.&lt;/p&gt;
&lt;p&gt;Another nifty feature is the use of unix-style paths, where a Merkle DAG has the structure:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;/ipfs/&amp;lt;hash-of-object&amp;gt;/&amp;lt;named-path-to-object&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;We'll see an example below.&lt;/p&gt;
&lt;p&gt;This is really all there is to it. Lets see it in action by replaying some examples from the &lt;a href="https://gateway.ipfs.io/ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/quick-start"&gt;quick-start&lt;/a&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ mkdir foo
$ mkdir foo/bar
$ &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;baz&amp;quot;&lt;/span&gt; &amp;gt; foo/baz
$ &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;baz&amp;quot;&lt;/span&gt; &amp;gt; foo/bar/baz
$ tree foo/
foo/
├── bar
│   └── baz
└── baz
$ ipfs add -r foo
added QmWLdkp93sNxGRjnFHPaYg8tCQ35NBY3XPn6KiETd3Z4WR foo/bar/baz
added QmWLdkp93sNxGRjnFHPaYg8tCQ35NBY3XPn6KiETd3Z4WR foo/baz
added QmeBpzHngbHes9hoPjfDCmpNHGztkmZFRX4Yp9ftKcXZDN foo/bar
added QmdcYvbv8FSBfbq1VVSfbjLokVaBYRLKHShpnXu3crd3Gm foo

&lt;span class="c1"&gt;# the last hash is the root-node, we can access objects through their path starting at the root, like:&lt;/span&gt;
$ ipfs cat /ipfs/QmdcYvbv8FSBfbq1VVSfbjLokVaBYRLKHShpnXu3crd3Gm/bar/baz
baz

&lt;span class="c1"&gt;# To inspect an object identified by a hash, we do&lt;/span&gt;
$ ipfs object get /ipfs/QmdcYvbv8FSBfbq1VVSfbjLokVaBYRLKHShpnXu3crd3Gm
&lt;span class="o"&gt;{&lt;/span&gt;  
  &lt;span class="s2"&gt;&amp;quot;Links&amp;quot;&lt;/span&gt;:&lt;span class="o"&gt;[&lt;/span&gt;  
    &lt;span class="o"&gt;{&lt;/span&gt;  
      &lt;span class="s2"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;:&lt;span class="s2"&gt;&amp;quot;bar&amp;quot;&lt;/span&gt;,
      &lt;span class="s2"&gt;&amp;quot;Hash&amp;quot;&lt;/span&gt;:&lt;span class="s2"&gt;&amp;quot;QmeBpzHngbHes9hoPjfDCmpNHGztkmZFRX4Yp9ftKcXZDN&amp;quot;&lt;/span&gt;,
      &lt;span class="s2"&gt;&amp;quot;Size&amp;quot;&lt;/span&gt;:61
    &lt;span class="o"&gt;}&lt;/span&gt;,
    &lt;span class="o"&gt;{&lt;/span&gt;  
      &lt;span class="s2"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;:&lt;span class="s2"&gt;&amp;quot;baz&amp;quot;&lt;/span&gt;,
      &lt;span class="s2"&gt;&amp;quot;Hash&amp;quot;&lt;/span&gt;:&lt;span class="s2"&gt;&amp;quot;QmWLdkp93sNxGRjnFHPaYg8tCQ35NBY3XPn6KiETd3Z4WR&amp;quot;&lt;/span&gt;,
      &lt;span class="s2"&gt;&amp;quot;Size&amp;quot;&lt;/span&gt;:12
    &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;]&lt;/span&gt;,
  &lt;span class="s2"&gt;&amp;quot;Data&amp;quot;&lt;/span&gt;:&lt;span class="s2"&gt;&amp;quot;\u0008\u0001&amp;quot;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# The above object has no data (except the mysterious \u0008\u0001) and two links&lt;/span&gt;

&lt;span class="c1"&gt;# If you&amp;#39;re just interested in the links, use &amp;quot;refs&amp;quot;:&lt;/span&gt;
$ ipfs refs QmdcYvbv8FSBfbq1VVSfbjLokVaBYRLKHShpnXu3crd3Gm
QmeBpzHngbHes9hoPjfDCmpNHGztkmZFRX4Yp9ftKcXZDN
QmWLdkp93sNxGRjnFHPaYg8tCQ35NBY3XPn6KiETd3Z4WR

&lt;span class="c1"&gt;# Now a leaf object without links&lt;/span&gt;
$ ipfs object get /ipfs/QmdcYvbv8FSBfbq1VVSfbjLokVaBYRLKHShpnXu3crd3Gm/bar/baz
&lt;span class="o"&gt;{&lt;/span&gt;  
  &lt;span class="s2"&gt;&amp;quot;Links&amp;quot;&lt;/span&gt;:&lt;span class="o"&gt;[&lt;/span&gt;  

  &lt;span class="o"&gt;]&lt;/span&gt;,
  &lt;span class="s2"&gt;&amp;quot;Data&amp;quot;&lt;/span&gt;:&lt;span class="s2"&gt;&amp;quot;\u0008\u0002\u0012\u0004baz\n\u0018\u0004&amp;quot;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# The string &amp;#39;baz&amp;#39; is somewhere in there :)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The Unicode characters that show up in the data field are the result of serialization of the data. IPFS uses &lt;a href="https://github.com/google/protobuf"&gt;protobuf&lt;/a&gt; for that I think. Correct me if I'm wrong :)&lt;/p&gt;
&lt;p&gt;At the time I'm writing this there is an experimental alternative for the &lt;code&gt;ipfs object&lt;/code&gt; commands: &lt;code&gt;ipfs dag&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ ipfs dag get QmdcYvbv8FSBfbq1VVSfbjLokVaBYRLKHShpnXu3crd3Gm
&lt;span class="o"&gt;{&lt;/span&gt;  
  &lt;span class="s2"&gt;&amp;quot;data&amp;quot;&lt;/span&gt;:&lt;span class="s2"&gt;&amp;quot;CAE=&amp;quot;&lt;/span&gt;,
  &lt;span class="s2"&gt;&amp;quot;links&amp;quot;&lt;/span&gt;:&lt;span class="o"&gt;[&lt;/span&gt;  
    &lt;span class="o"&gt;{&lt;/span&gt;  
      &lt;span class="s2"&gt;&amp;quot;Cid&amp;quot;&lt;/span&gt;:&lt;span class="o"&gt;{&lt;/span&gt;  
        &lt;span class="s2"&gt;&amp;quot;/&amp;quot;&lt;/span&gt;:&lt;span class="s2"&gt;&amp;quot;QmeBpzHngbHes9hoPjfDCmpNHGztkmZFRX4Yp9ftKcXZDN&amp;quot;&lt;/span&gt;
      &lt;span class="o"&gt;}&lt;/span&gt;,
      &lt;span class="s2"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;:&lt;span class="s2"&gt;&amp;quot;bar&amp;quot;&lt;/span&gt;,
      &lt;span class="s2"&gt;&amp;quot;Size&amp;quot;&lt;/span&gt;:61
    &lt;span class="o"&gt;}&lt;/span&gt;,
    &lt;span class="o"&gt;{&lt;/span&gt;  
      &lt;span class="s2"&gt;&amp;quot;Cid&amp;quot;&lt;/span&gt;:&lt;span class="o"&gt;{&lt;/span&gt;  
        &lt;span class="s2"&gt;&amp;quot;/&amp;quot;&lt;/span&gt;:&lt;span class="s2"&gt;&amp;quot;QmWLdkp93sNxGRjnFHPaYg8tCQ35NBY3XPn6KiETd3Z4WR&amp;quot;&lt;/span&gt;
      &lt;span class="o"&gt;}&lt;/span&gt;,
      &lt;span class="s2"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;:&lt;span class="s2"&gt;&amp;quot;baz&amp;quot;&lt;/span&gt;,
      &lt;span class="s2"&gt;&amp;quot;Size&amp;quot;&lt;/span&gt;:12
    &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

$ ipfs dag get /ipfs/QmdcYvbv8FSBfbq1VVSfbjLokVaBYRLKHShpnXu3crd3Gm/bar/baz
&lt;span class="o"&gt;{&lt;/span&gt;  
  &lt;span class="s2"&gt;&amp;quot;data&amp;quot;&lt;/span&gt;:&lt;span class="s2"&gt;&amp;quot;CAISBGJhegoYBA==&amp;quot;&lt;/span&gt;,
  &lt;span class="s2"&gt;&amp;quot;links&amp;quot;&lt;/span&gt;:&lt;span class="o"&gt;[&lt;/span&gt;  

  &lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;We see a couple of differences there, but let's not get into that. Both outputs follow the IPFS object format from the white paper. One interesting bit is the "Cid" that shows up; this refers to the newer &lt;a href="https://github.com/ipld/cid"&gt;Content IDentifier&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Another feature that is mentioned is the possibility to &lt;code&gt;pin&lt;/code&gt; objects, which results in storage of these objects in the file system of the local node. The current go implementation of ipfs stores it in a &lt;a href="https://github.com/google/leveldb"&gt;leveldb&lt;/a&gt; database under the &lt;code&gt;~/.ipfs/datastore&lt;/code&gt; directory. We have seen pinning in action in a previous post.&lt;/p&gt;
&lt;p&gt;The last part of this chapter mentions the availability of object level encryption. This is not implemented yet: &lt;code&gt;status wip&lt;/code&gt; (Work in Progress; I had to look it up as well). The project page is here: &lt;a href="https://github.com/ipfs/specs/tree/master/keystore"&gt;ipfs keystore proposal&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;ipfs dag&lt;/code&gt; command hints to something new...&lt;/p&gt;
&lt;h2&gt;Intermission: IPLD&lt;/h2&gt;
&lt;p&gt;If you studied the images at the start of this post carefully, you are probably wondering, what is IPLD and how does it fit in? According to the white paper, it doesn't fit in, as it isn't mentioned at all!&lt;/p&gt;
&lt;p&gt;My guess is that IPLD is not mentioned because it was introduced later, but it more or less maps to the Objects chapter in the paper. IPLD is broader, more general, than what the white paper specifies. Hey Juan, update the white paper will ya! :-)&lt;/p&gt;
&lt;p&gt;If you don't want to wait for the updated white paper, have a look here: the &lt;a href="https://ipld.io/"&gt;IPLD website&lt;/a&gt; (Inter Planetary Linked Data), the &lt;a href="https://github.com/ipld/specs/tree/master/ipld"&gt;IPLD specs&lt;/a&gt; and the &lt;a href="https://github.com/ipld/ipld#implementations"&gt;IPLD implementations&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;And this video is an excellent introduction: &lt;a href="https://www.youtube.com/watch?v=Bqs_LzBjQyk"&gt;Juan Benet: Enter the Merkle Forest&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;But if you don't feel like reading/watching more: IPLD is more or less the same as what is described in the "Objects" and "Files" chapters here.&lt;/p&gt;
&lt;p&gt;Moving on to the next chapter in the white paper...&lt;/p&gt;
&lt;h2&gt;Files: uh?&lt;/h2&gt;
&lt;p&gt;On top of the Merkle DAG objects IPFS defines a Git-like file system with versioning, with the following elements:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;blob&lt;/code&gt;: there is just data in blobs and it represents the concept of a file in IPFS. No links in blobs&lt;/li&gt;
&lt;li&gt;&lt;code&gt;list&lt;/code&gt;: lists are also a representation of an IPFS file, but consisting of multiple blobs and/or lists&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tree&lt;/code&gt;: a collection of blobs, lists and/or trees: acts as a directory&lt;/li&gt;
&lt;li&gt;&lt;code&gt;commit&lt;/code&gt;: a snapshot of the history in a tree (just like a git commit).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now I hear you thinking: aren't these blobs, lists, and trees the same things as what we saw in the Mergle DAG? We had objects there with data, with or without links, and nice Unix-like file paths.&lt;/p&gt;
&lt;p&gt;I heard you thinking that because I thought the same thing when I arrived at this chapter. After searching around a bit I started to get the feeling that this layer was discarded and IPLD stops at the "objects" layer, and everything on top of that is open to whatever implementation. If an expert is reading this and thinks I have it all wrong: please let me know, and I'll correct it with the new insight.&lt;/p&gt;
&lt;p&gt;Now, what about the &lt;code&gt;commit&lt;/code&gt; file type? The title of the white paper is "IPFS - Content Addressed, Versioned, P2P File System", but the versioning hasn't been implemented yet &lt;a href="https://github.com/ipfs/notes/issues/23"&gt;it seems&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;There is some brainstorming going on about versioning &lt;a href="https://gist.github.com/flyingzumwalt/a6821e843366d606aeb1ba53525b8669"&gt;here&lt;/a&gt; and &lt;a href="https://github.com/oduwsdl/ipwb/issues/61"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;That leaves one more layer to go...&lt;/p&gt;
&lt;h2&gt;Naming: adding mutability&lt;/h2&gt;
&lt;p&gt;Since links in IPFS are content addressable (a cryptographic hash over the content represents the block or object of content), data is immutable by definition. It can only be replaced by another version of the content, and it, therefore, gets a new "address".&lt;/p&gt;
&lt;p&gt;The solution is to create "labels" or "pointers" (just like git branches and tags) to immutable content. These labels can be used to represent the latest version of an object (or graph of objects).&lt;/p&gt;
&lt;p&gt;In IPFS this pointer can be created using the Self-Certified Filesystems I described in the previous post. It is named IPNS and works like this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The root address of a node is &lt;code&gt;/ipns/&amp;lt;NodeId&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;The content it points to can be changed by publishing an IPFS object to this address&lt;/li&gt;
&lt;li&gt;By publishing, the owner of the node (the person who knows the secret key that was generated with &lt;code&gt;ipfs init&lt;/code&gt;) cryptographically signs this "pointer".&lt;/li&gt;
&lt;li&gt;This enables other users to verify the authenticity of the object published by the owner.&lt;/li&gt;
&lt;li&gt;Just like IPFS paths, IPNS paths also start with a hash, followed by a Unix-like path.&lt;/li&gt;
&lt;li&gt;IPNS records are announced and resolved via the DHT.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I already showed the actual execution of the &lt;code&gt;ipfs publish&lt;/code&gt; command in the post &lt;a href="/getting-to-know-ipfs.html"&gt;Getting to know IPFS&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This chapter in the white paper also describes some methods to make addresses more human-friendly, but I'll leave that in store for the next episode which will be hands-on again. We gotta get rid of these hashes in the addresses and make it all work nicely in our good old browsers: &lt;a href="/ten-terrible-attempts-to-make-ipfs-human-friendly.html"&gt;Ten terrible attempts to make IPFS human-friendly&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Let me know what you think of this post by tweeting to me &lt;a href="https://twitter.com/pors"&gt;@pors&lt;/a&gt;!&lt;/p&gt;</content></entry><entry><title>Understanding the IPFS White Paper part 1</title><link href="https://decentralized.blog/understanding-the-ipfs-white-paper-part-1.html" rel="alternate"></link><published>2017-08-10T11:11:00+02:00</published><updated>2017-08-10T11:11:00+02:00</updated><author><name>Mark Pors</name></author><id>tag:decentralized.blog,2017-08-10:/understanding-the-ipfs-white-paper-part-1.html</id><summary type="html">&lt;p&gt;&lt;strong&gt;This article is part 4 of the Blockchain train journal, start reading here: &lt;a href="/catching-the-blockchain-train.html"&gt;Catching the Blockchain Train&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;Oh no, a White Paper!&lt;/h2&gt;
&lt;p&gt;The crypto currency/blockchain world loves its white papers, and IPFS is no exception. It started with the famous &lt;a href="https://bitcoin.org/bitcoin.pdf"&gt;Bitcoin: A Peer-to-Peer Electronic Cash System&lt;/a&gt; white paper by …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;This article is part 4 of the Blockchain train journal, start reading here: &lt;a href="/catching-the-blockchain-train.html"&gt;Catching the Blockchain Train&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;Oh no, a White Paper!&lt;/h2&gt;
&lt;p&gt;The crypto currency/blockchain world loves its white papers, and IPFS is no exception. It started with the famous &lt;a href="https://bitcoin.org/bitcoin.pdf"&gt;Bitcoin: A Peer-to-Peer Electronic Cash System&lt;/a&gt; white paper by Satoshi Nakamoto (which in turn references to another white paper you don't want to know about). We will have a look at the Bitcoin white paper in a future post when we dive into crypto currencies.&lt;/p&gt;
&lt;p&gt;Two things you need to know about white papers:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;They are distributed in PDF format (because it is harder to change than HTML!)&lt;/li&gt;
&lt;li&gt;white papers are hard, scary and contain at least one mathematical formula.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The IPFS white paper is here: &lt;a href="https://ipfs.io/ipfs/QmR7GSQM93Cx5eAg6a6yRzNde1FQv7uL6X1o4k7zrJa3LX/ipfs.draft3.pdf"&gt;IPFS - Content Addressed, Versioned, P2P File System
(DRAFT 3)&lt;/a&gt;. And, as it should, hosted on IPFS.&lt;/p&gt;
&lt;p&gt;To understand how IPFS works it's a good idea to walk through this white paper step by step. I'll limit this post to chapter 2 of the white paper, having a look at the underlying technologies:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Distributed Hash Tables&lt;/li&gt;
&lt;li&gt;Block Exchanges - BitTorrent&lt;/li&gt;
&lt;li&gt;Version Control Systems - Git&lt;/li&gt;
&lt;li&gt;Self-Certified Filesystems - SFS&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Mapped on a ISO like stack:&lt;/p&gt;
&lt;p&gt;&lt;img alt="IPFS is based on these technologies" src="/img/ipfs-based-on.png"&gt;&lt;/p&gt;
&lt;p&gt;OK, here we go!&lt;/p&gt;
&lt;h2&gt;Distributed Hash Tables (DHT)&lt;/h2&gt;
&lt;h3&gt;What is a DHT?&lt;/h3&gt;
&lt;p&gt;A DHT is like a Python dict or Perl hash (if you have the key, you can retrieve the value), but the data is distributed over multiple nodes. The Wikipedia article &lt;a href="https://en.wikipedia.org/wiki/Distributed_hash_table"&gt;Distributed hash table&lt;/a&gt; gives a good introduction.&lt;/p&gt;
&lt;p&gt;In the case of IPFS, the key is a hash over the content. So ask an IPFS node for the content with hash QmcPx9ZQboyHw8T7Afe4DbWFcJYocef5Pe4H3u7eK1osnQ and the IPFS node will lookup in the DHT which nodes have the content. &lt;/p&gt;
&lt;p&gt;How the specific value is found efficiently (fast, with a little as possible network requests) and how to manage the DHT so that changes (nodes that enter/leave the network, or new entries to the table) are absorbed easily is different for the various DHT implementations that exist.&lt;/p&gt;
&lt;p&gt;One such an implementation is called Pastry, and I like these two videos where the &lt;a href="https://www.youtube.com/watch?v=WqQRQz_XYg4"&gt;routing&lt;/a&gt; (how to find values) and the &lt;a href="https://www.youtube.com/watch?v=p8iugvHeGcg"&gt;dynamics&lt;/a&gt; (how to handle node additions/removals) are explained really well.&lt;/p&gt;
&lt;h3&gt;Kademlia and friends&lt;/h3&gt;
&lt;p&gt;Back to the white paper. Three DHT implementations are mentioned explicitly, starting with Kademlia. Kademlia has a &lt;a href="https://pdos.csail.mit.edu/~petar/papers/maymounkov-kademlia-lncs.pdf"&gt;white paper&lt;/a&gt; of its own but let's not go there...&lt;/p&gt;
&lt;p&gt;Kademlia is the DHT protocol that is used in almost all popular P2P systems and again the Wikipedia article on &lt;a href="https://en.wikipedia.org/wiki/Kademlia"&gt;Kedemlia&lt;/a&gt; is a great introduction.&lt;/p&gt;
&lt;p&gt;In short, Kedemlia uses the ID of the nodes to get step by step closer to the node with the desired hash (from the Wikipedia article): &lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;When searching for some value, the algorithm needs to know the associated key and explores the network in several steps. Each step will find nodes that are closer to the key until the contacted node returns the value or no more closer nodes are found. This is very efficient: Like many other DHTs, Kademlia contacts only O(log(n)) nodes during the search out of a total of n nodes in the system.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The details can start to get quite complicated and I don't think it won't add to our goal of understanding IPFS, so we move on. If you like this sort of thing: this is a &lt;a href="https://www.youtube.com/watch?v=kXyVqk3EbwE"&gt;nice introduction&lt;/a&gt; and if you want to dig deeper the link to the Kademlia white paper is ^^^.&lt;/p&gt;
&lt;p&gt;IPFS mentions two other DHT implementations that are added to standard Kedemlia:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Coral DSHT: this improves the lookup performance and decreases resource use.&lt;/li&gt;
&lt;li&gt;S/Kademlia: makes Kademlia more resistant against malicious attacks.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;The IPFS DHT in practice&lt;/h3&gt;
&lt;p&gt;The DHT is used in IPFS for routing, in other words:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;to announce added data to the network &lt;/li&gt;
&lt;li&gt;and help locate data that is requested by any node.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The white paper states:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Small values (equal to or less than 1KB) are stored directly on the DHT. For values larger, the DHT stores references, which are the NodeIds of peers who can serve the block.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;So let's have a look if we can access the DHT directly and add and retrieve small data blocks. &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ ipfs daemon &lt;span class="c1"&gt;# make sure this runs (and install/setup ipfs first)&lt;/span&gt;

$ &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;my tiny text&amp;#39;&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; ipfs add &lt;span class="c1"&gt;# add content to the node, smaller than 1KB&lt;/span&gt;
QmfQKcXMLGvCxx6opNDwb1ptD1LJER6MPHdsMHCB1CXpFF

$ ipfs cat QmfQKcXMLGvCxx6opNDwb1ptD1LJER6MPHdsMHCB1CXpFF &lt;span class="c1"&gt;# just check&lt;/span&gt;
my tiny text

$ ipfs dht get /ipfs/QmfQKcXMLGvCxx6opNDwb1ptD1LJER6MPHdsMHCB1CXpFF
&lt;span class="c1"&gt;# returns not found&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;So now we have that text there we would like to access it from the DHT, but apparently, the only &lt;code&gt;ipfs dht get&lt;/code&gt; request that is supported is for keys starting with &lt;code&gt;/ipns/&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;OK, and so we create an IPNS and see if we can query that directly:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ ipfs name publish QmfQKcXMLGvCxx6opNDwb1ptD1LJER6MPHdsMHCB1CXpFF &lt;span class="c1"&gt;# point a IPNS address to our content&lt;/span&gt;
Published to QmYebHWdWStasXWZQiXuFacckKC33HTbicXPkdSi5Yfpz6: /ipfs/QmfQKcXMLGvCxx6opNDwb1ptD1LJER6MPHdsMHCB1CXpFF

$ ipfs resolve QmYebHWdWStasXWZQiXuFacckKC33HTbicXPkdSi5Yfpz6 &lt;span class="c1"&gt;# check it&lt;/span&gt;
&lt;span class="c1"&gt;# never returns, hmm IPNS doesn&amp;#39;t seem to be ready for production&lt;/span&gt;

$ ipfs dht get /ipns/QmYebHWdWStasXWZQiXuFacckKC33HTbicXPkdSi5Yfpz6 &lt;span class="c1"&gt;# same thing but directly&lt;/span&gt;
&lt;span class="c1"&gt;# does return binary data starting with 4/ipfs/QmfQKcXMLGvCxx6opNDwb1ptD1LJER6MPHdsMHCB1CXpFF&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;It sort of does work, but it is limited to IPNS for now it seems.&lt;/p&gt;
&lt;p&gt;What else can we do with the DHT?&lt;/p&gt;
&lt;p&gt;Use the DHT to find out which nodes can provide some data:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ ipfs dht findprovs QmfQKcXMLGvCxx6opNDwb1ptD1LJER6MPHdsMHCB1CXpFF
QmYebHWdWStasXWZQiXuFacckKC33HTbicXPkdSi5Yfpz6
QmRf4ERGvYpVo6HRa2VueZT8pWi8YvyLS3rW6ad2y83tdN

&lt;span class="c1"&gt;# ^^^ there are both my nodes, so that works&lt;/span&gt;
&lt;span class="c1"&gt;# Now ask the DHT for the address of the first peer that was returned&lt;/span&gt;
$ ipfs dht findpeer QmYebHWdWStasXWZQiXuFacckKC33HTbicXPkdSi5Yfpz6
/ip4/176.92.234.78/tcp/4001
/ip4/85.74.239.218/tcp/38689
/ip4/127.0.0.1/tcp/4001
/ip4/192.168.1.30/tcp/4001
/ip6/::1/tcp/4001
/ip4/192.168.1.3/tcp/4001
/ip4/176.92.234.78/tcp/40443

&lt;span class="c1"&gt;# Oooh nice! We will visit this address notation in the next episode.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;All in all, we saw a bit of the DHT in action, but not as intuitive and functional as I hoped for. &lt;/p&gt;
&lt;p&gt;Time to move on to the next exciting technology applied by IPFS:&lt;/p&gt;
&lt;h2&gt;BitTorrent&lt;/h2&gt;
&lt;h3&gt;How does BitTorrent work?&lt;/h3&gt;
&lt;p&gt;We all know about BitTorrent, but some of us (yeah, me too) need to dig deeper to really get it. This presentation is a great introduction: &lt;a href="https://www.youtube.com/watch?t=961&amp;amp;v=kxHRATfvnlw"&gt;Feross Aboukhadijeh: WebTorrent - JSConf.Asia 2014&lt;/a&gt;. The speaker talks about how he implemented a BitTorrent client that can run in the browser, thanks to WebRTC (which is a cool technology that might come in handy later on for our project). It also explains the working of the DHT again to drive it home.&lt;/p&gt;
&lt;p&gt;More to read or watch:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://web.cs.ucla.edu/classes/cs217/05BitTorrent.pdf"&gt;Peer-to-peer networking with BitTorrent&lt;/a&gt; (PDF). If you read only one article, make it this one.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=nmgzOQf6NbQ"&gt;Peer to Peer Content Delivery -  BitTorrent&lt;/a&gt; (video) + &lt;a href="https://courses.cs.washington.edu/courses/cse461/17wi/section-slides/9-p2p.pdf"&gt;the slides&lt;/a&gt; (PDF).&lt;/li&gt;
&lt;li&gt;&lt;a href="http://bittorrent.org/beps/bep_0052.html"&gt;The BitTorrent Protocol Specification v2&lt;/a&gt; (the spec, not hard to read).&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;BitTorrent and IPFS&lt;/h3&gt;
&lt;p&gt;The exchange of data (blocks) in IPFS is inspired by BitTorrent but is not 100% BitTorrent. The white paper mentions two BitTorrent features that IPFS uses:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;tit-for-tat strategy (if you don't share, you won't receive either)&lt;/li&gt;
&lt;li&gt;get rare pieces first (improves performance and more, see the first PDF above)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A notable difference is that where in BitTorrent each file has a separate swarm of peers (forming a P2P network with each other) where IPFS is one big swarm of peers for all data. The IPFS BitTorrent variety is called BitSwap and I'll go over that in the next episode.&lt;/p&gt;
&lt;p&gt;Let's try if we can see something of the swarm in action.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;# Make sure you have the daemon running
$ ipfs swarm peers
/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
/ip4/104.236.151.122/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx
/ip4/128.199.219.111/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu
/ip4/178.62.61.185/tcp/4001/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;When you just start the daemon you get connected to a couple of "seed peers". After a while the number of peers grows rapidly.&lt;/p&gt;
&lt;p&gt;Another command to query the swarm:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ ipfs swarm addrs
QmNRuQrwtGgeVQgndTny4A4Rukg7GR7vzDJrVJxUBfqevk &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="m"&gt;4&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        /ip4/127.0.0.1/tcp/4001
        /ip4/172.31.41.39/tcp/4001
        /ip4/35.167.26.28/tcp/4001
        /ip6/::1/tcp/4001
QmNSJohkvvBVmHeN7KUZnm4X84GA6Znbv6ZmvsTAjbw3AB &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        /ip4/10.0.1.8/tcp/4001
        /ip4/127.0.0.1/tcp/4001
        /ip4/174.44.163.74/tcp/16012
        /ip6/::1/tcp/4001
        /ip6/fd15:462e:f8fd:695e:9161:27dd:7f78:d242/tcp/4001
QmNTJyhCYcbv5GdnqtdEwTfJCgY6pV4PJiNTtAmuoxnQak &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="m"&gt;3&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        /ip4/127.0.0.1/tcp/4001
        /ip4/94.176.232.68/tcp/4001
        /ip6/::1/tcp/4001
QmNTZy7TfXvsHczwwV3EYbxRZN5gthgicG9GiroD7C4ZrP &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="m"&gt;4&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        /ip4/127.0.0.1/tcp/4001
        /ip4/172.20.255.127/tcp/4001
        /ip4/54.229.227.53/tcp/4001
        /ip6/::1/tcp/4001
        .
        .
        .
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;These are the addresses in the swarm the node knows of, the hash on top is the peerId.&lt;/p&gt;
&lt;p&gt;With this information, you can connect to a peer like&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ ipfs swarm connect /ip4/114.91.202.180/tcp/34746/ipfs/QmfTgdg6GkqJtUrWAYo69GjcLrjQq9LjTjgW3KZ1ux1X6U
connect QmfTgdg6GkqJtUrWAYo69GjcLrjQq9LjTjgW3KZ1ux1X6U success
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;More about BitSwap later...&lt;/p&gt;
&lt;h2&gt;Let's take a break&lt;/h2&gt;
&lt;p&gt;Pfew, that was a lot of theory and dry material, and we are not even halfway! So to let it all sink in and to free up the brain for the rest go for a walk in the park and listen to this podcast: &lt;a href="https://tim.blog/2017/06/04/nick-szabo/"&gt;The Quiet Master of Cryptocurrency — Nick Szabo&lt;/a&gt;. It goes all over the place, but I found it very interesting. It zooms out from bit level to things like "what is money?".&lt;/p&gt;
&lt;p&gt;Highly recommended listening, and when you're done...&lt;/p&gt;
&lt;h2&gt;Version Control Systems - Git&lt;/h2&gt;
&lt;p&gt;The white paper's entire section on Version Control Systems is reproduced here:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Version Control Systems provide facilities to model files changing over time and distribute different versions efficiently. &lt;/p&gt;
&lt;p&gt;The popular version control system Git provides a powerful Merkle DAG object model that captures changes to a filesystem tree in a distributed-friendly way.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Immutable objects represent Files (blob), Directories (tree), and Changes (commit).&lt;/li&gt;
&lt;li&gt;Objects are content-addressed, by the cryptographic hash of their contents.&lt;/li&gt;
&lt;li&gt;Links to other objects are embedded, forming a Merkle DAG. This provides many useful integrity and workflow properties.&lt;/li&gt;
&lt;li&gt;Most versioning metadata (branches, tags, etc.) are simply pointer references, and thus inexpensive to create and update.&lt;/li&gt;
&lt;li&gt;Version changes only update references or add objects.&lt;/li&gt;
&lt;li&gt;Distributing version changes to other users is simply transferring objects and updating remote references.&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;
&lt;p&gt;Let's step through these lines one by one to understand it:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Ad 1. Immutable objects represent Files (blob), Directories (tree), and Changes (commit).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Git only adds data. So blobs, trees, and commits are immutable. What the last version of either of these is, is determined by special references (see point 4 and 5).&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Ad 2. Objects are content-addressed, by the cryptographic hash of their contents.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In git, the file or directory name is not used when they are referenced. Git hashes the content (or listing or commit) with SHA1 and uses these hashes in its database.
This article makes it very insightful how that works: &lt;a href="https://medium.freecodecamp.org/git-internals-for-curious-developers-a1e44e7ecafe"&gt;Git under the hood&lt;/a&gt; (Start reading at "Now let’s look at how Git does all this")&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Ad 3. Links to other objects are embedded, forming a Merkle DAG. This provides many useful integrity and workflow properties.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Oh my, a Merkle DAG! No worries, it is actually not as scary as it sounds. &lt;/p&gt;
&lt;p&gt;A &lt;a href="https://en.wikipedia.org/wiki/Merkle_tree"&gt;Merkle tree&lt;/a&gt; is a binary tree where the parent contains the hash of the concatenation of the hashes of the two children. This explains the integrity property: any change in a data block results in a change of the root node. With just a little bit of meta-data (uncles and parents, which can be untrusted) and a trusted root node, we can verify the validity of the block.&lt;/p&gt;
&lt;p&gt;Now, a Merkle DAG is not the same as a Merkle Tree. The difference is explained here: &lt;a href="https://bmcorser.github.io/2014/12/22/merkle-dag.html"&gt;Merkle DAG&lt;/a&gt; and &lt;a href="https://github.com/jbenet/random-ideas/issues/20"&gt;JRFC 20 - Merkle DAG&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In short: the Merkle DAG is more general as it is not a binary tree but a graph, and any node can contain data, not just the leaf nodes as in the Merkle Tree.&lt;/p&gt;
&lt;p&gt;It's still all a bit vague, but I'll address it again when we have a look at the IPFS Merkle DAG.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Ad 4. and 5 Most versioning metadata (branches, tags, etc.) are simply pointer references, and thus inexpensive to create and update. Version changes only update references or add objects.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This is visualized here: &lt;a href="http://eagain.net/articles/git-for-computer-scientists/"&gt;Git for Computer Scientists&lt;/a&gt; where the branch, the HEAD, and tags are simply references to commits.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Ad 6. Distributing version changes to other users is simply transferring objects and updating remote references.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;What it says here, no need to explain I think :)&lt;/p&gt;
&lt;h2&gt;Self-Certified Filesystems - SFS&lt;/h2&gt;
&lt;p&gt;This is used to implement the IPNS name system for IPFS. It allows us to generate an address for a remote filesystem, where the user can verify the validity of the address.&lt;/p&gt;
&lt;p&gt;From the white paper:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;SFS introduced a technique for building Self-Certified Filesystems: addressing remote filesystems using the following scheme&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;/sfs/&amp;lt;Location&amp;gt;:&amp;lt;HostID&amp;gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;where Location is the server network address, and:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;HostID = hash(public_key || Location)
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Thus the name of an SFS file system certifies its server.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I think that speaks for itself, we will see it in action in the next episode: &lt;a href="/understanding-the-ipfs-white-paper-part-2.html"&gt;Understanding the IPFS White Paper part 2&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Let me know what you think of this post by tweeting to me &lt;a href="https://twitter.com/pors"&gt;@pors&lt;/a&gt;!&lt;/p&gt;</content></entry><entry><title>Getting to know IPFS</title><link href="https://decentralized.blog/getting-to-know-ipfs.html" rel="alternate"></link><published>2017-08-03T19:11:00+02:00</published><updated>2017-08-03T19:11:00+02:00</updated><author><name>Mark Pors</name></author><id>tag:decentralized.blog,2017-08-03:/getting-to-know-ipfs.html</id><summary type="html">&lt;p&gt;This article is part 3 of the Blockchain train journal, start reading here: &lt;a href="/catching-the-blockchain-train.html"&gt;Catching the Blockchain Train&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Let's read a bit (reading is good for you!)&lt;/h2&gt;
&lt;p&gt;I already listed this article in the previous episode, but I mention it again because it is a great place to start to understand …&lt;/p&gt;</summary><content type="html">&lt;p&gt;This article is part 3 of the Blockchain train journal, start reading here: &lt;a href="/catching-the-blockchain-train.html"&gt;Catching the Blockchain Train&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Let's read a bit (reading is good for you!)&lt;/h2&gt;
&lt;p&gt;I already listed this article in the previous episode, but I mention it again because it is a great place to start to understand IPFS and its context: &lt;a href="https://ipfs.io/ipfs/QmNhFJjGcMPqpuYfxL62VVB9528NXqDNMFXiqN5bgFYiZ1/its-time-for-the-permanent-web.html"&gt;HTTP is obsolete. It's time for the distributed, permanent web&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;A couple of things we can pick up from it (a bit simplified):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;IPFS consists of a network of peer-to-peer nodes (aka computers that talk to each other directly)&lt;/li&gt;
&lt;li&gt;These nodes can store content (any type of file)&lt;/li&gt;
&lt;li&gt;Content is represented by a hash and is immutable (if the content changes, so does the hash)&lt;/li&gt;
&lt;li&gt;A node can request content from other nodes by using this hash. This is pretty cool: there is a permanent relation between the hash and the content itself. Unlike the current web where the content behind a URL can change.&lt;/li&gt;
&lt;li&gt;Nodes can decide to store a copy of any content&lt;/li&gt;
&lt;li&gt;The more nodes store a piece of content the harder it is to get rid of it (the permanent web).&lt;/li&gt;
&lt;li&gt;The network also gets faster that way, similar to bittorrent getting faster when the number of seeders goes up (IPFS is partly based on the bittorrent protocol, but one of the differences is that it &lt;a href="https://www.reddit.com/r/ipfs/comments/48ab4z/why_do_people_say_ipfs_is_permanent_torrents/d0z08of/"&gt;prevents duplicate pieces of identical content&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A bit more detail:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Content (files) is broken up into blocks, and each block gets a hash&lt;/li&gt;
&lt;li&gt;Duplicate blocks (identical content but different hash) are removed from the network&lt;/li&gt;
&lt;li&gt;IPFS has a directory concept (another hash) that points to the hashes of the content inside&lt;/li&gt;
&lt;li&gt;Git like version control is used for blocks&lt;/li&gt;
&lt;li&gt;To solve the problem of finding the last version of some content is solved by IPNS&lt;/li&gt;
&lt;li&gt;IPNS allows anyone to create a unique public link to any content that is out there. &lt;/li&gt;
&lt;li&gt;So an IPFS hash points to some immutable content, regardless the version; the IPNS address points to some file or directory determined by the creator of that address&lt;/li&gt;
&lt;li&gt;This IPNS address is implemented as a pubkeyhash which is similar to the public address in a Bitcoin wallet.&lt;/li&gt;
&lt;li&gt;IPNS hashes are long and ugly. Also, browsers don't speak IPFS. There are a couple of solutions to bridge the gap to the current time that we will look into later.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To read and discover more about IPFS, this page on github is a great starting point &lt;a href="https://github.com/ipfs/ipfs"&gt;ipfs/ipfs&lt;/a&gt;. Make sure to check out the &lt;a href="https://github.com/ipfs/ipfs#quick-summary"&gt;quick summary&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;OK, it is all still a bit abstract I guess, so time to play.&lt;/p&gt;
&lt;h2&gt;Terminal time (move those fingers buddy!)&lt;/h2&gt;
&lt;p&gt;Now we understand the basics lets start playing a bit.&lt;/p&gt;
&lt;p&gt;To get up and running and to be able to play along, first &lt;a href="https://ipfs.io/docs/install"&gt;install&lt;/a&gt; (I recommend the ipfs-update approach) and follow the &lt;a href="https://ipfs.io/docs/getting-started/"&gt;getting started&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Now it is time to set the first step into making this blog decentralized. BTW what a great domain this site has! Well, as long as you are reading the centralized version :)&lt;/p&gt;
&lt;p&gt;I uploaded the statically generated website to my server and it looks like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;├── archives.html
├── author
│   └── mark-pors.html
├── authors.html
├── catching-the-blockchain-train.html
├── categories.html
├── category
│   └── blockchain-train-journal.html
├── feeds
│   ├── all.atom.xml
│   └── blockchain-train-journal.atom.xml
├── getting-to-know-ipfs.html
├── index.html
├── picking-a-decentralized-storage-system.html
├── tags.html
└── theme
    ├── css
     ... // ...
            └── youtube.png
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;To shoot a file into the interplanetary file system, we simply do:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ ipfs init &lt;span class="c1"&gt;# this creates your node&amp;#39;s peer ID&lt;/span&gt;
$ ipfs daemon &lt;span class="c1"&gt;# start your local node&lt;/span&gt;
$ ipfs add catching-the-blockchain-train.html
added QmXyZcrThrfWQSTKzPiNT4Nd2RcqcVQ3tr7rmFqHYZ3fq4 catching-the-blockchain-train.html
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Now my node can serve this file and tell the network there is a piece of content (my first blog post!) available, just in case someone requests this hash: &lt;code&gt;QmXyZcrThrfWQSTKzPiNT4Nd2RcqcVQ3tr7rmFqHYZ3fq4&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;So, in your terminal:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;ipfs cat QmXyZcrThrfWQSTKzPiNT4Nd2RcqcVQ3tr7rmFqHYZ3fq4
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;should return the same as (for as long as I host it over HTTP of course):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;curl http://decentralized.blog/catching-the-blockchain-train.html
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Notice that when you request the file for the second time through ipfs, it gets it very fast. That is because your node now has a copy of the content locally. Pretty cool huh?&lt;/p&gt;
&lt;p&gt;The ipfs node comes with an HTTP gateway, so we can also access the file in a browser: &lt;a href="http://decentralized.blog:8080/ipfs/QmXyZcrThrfWQSTKzPiNT4Nd2RcqcVQ3tr7rmFqHYZ3fq4"&gt;http://decentralized.blog:8080/ipfs/QmXyZcrThrfWQSTKzPiNT4Nd2RcqcVQ3tr7rmFqHYZ3fq4&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This is what happened here (from the getting started document):&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The gateway served a file from your computer. The gateway queried the DHT, found your machine, requested the file, your machine sent it to the gateway, and the gateway sent it to your browser.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Note: this obviously introduces a central server into the picture, but at least anyone can run such a gateway. So it is still sort-of-decentralized. We have to look for something better later on.&lt;/p&gt;
&lt;h2&gt;Decentralize it! At last some progress&lt;/h2&gt;
&lt;p&gt;To push the whole website onto the interplanetary file system can't be more simple, just add the &lt;code&gt;-r&lt;/code&gt; flag and point to the directory containing all static files.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ ipfs add -r ../../www/dcb
added QmWu4hsywXoSrw5JRhjUadyMnDuxuvcgExwVD62cWeLVjb dcb/archives.html
added QmUCJ6z2EfikXEDUYbxfjdkrX2zw62XCAM93HHC61Qrmwg dcb/author/mark-pors.html
added QmV13vUiKU64oHoxbp5MN7bnehraW46de82PLvndbisn64 dcb/authors.html
added QmXyZcrThrfWQSTKzPiNT4Nd2RcqcVQ3tr7rmFqHYZ3fq4 dcb/catching-the-blockchain-train.html
added QmRiWHfYLQEJoKz2dDq2sXnW2keiKZG1nHbnaN55TTXN8b dcb/categories.html
added QmSCx2eV3BjHJWoXMBc7rKakPv3fAcewyroFCRmovcsYSy dcb/category/blockchain-train-journal.html
added QmVxVLT22KLGasBLxzSv6yXofx3GVXmWEd3HqSjPp1X6Zz dcb/feeds/all.atom.xml
added QmdKJY5VVd8Qm5xsLt8Vj5XwvTbe5mCQhK6DnZ9LkqTHwz dcb/feeds/blockchain-train-journal.atom.xml
added QmYpyQ3MXYZum3q2E9pRxUWnJXK74cLvFbuMDYukK9ivK1 dcb/index.html
added QmXkfv9ZXb9evxPXTMJC8fvgeZymYpTQo3CVFv7mDoSRTN dcb/picking-a-decentralized-storage-system.html
added QmSyuSjmzhwkoj6qH7s4MmKeB98Ub1DZ1Hm5anBBnR9yVu dcb/tags.html
added QmSfLETTMQc1b9cBJENH1S4NK5qniXSf79KSP8h5CbU3U8 dcb/theme/css/main.css
... // ...
added QmU8CmEYWV5aUuqoToq1xiyqftdY8MHQ8MdViA2ex23uyV dcb/theme/images/icons/youtube.png
added QmYBVeJkBRdJYj8jr3YTGWE537h26YqcfjvbX4ttjZ65X2 dcb/author
added QmPwQPX86RQi6MrZQigh2tWgztcbf46EjhRg1hzMzELvHN dcb/category
added QmfRxCPp417G3NTqEpBmwtGwtUKFzgQjBRvxNBq88HhC9F dcb/feeds
added QmYUnPcDPcnKA3WFembvNYG48m1oUWa7QLNWZxrkLv1vcE dcb/theme/css
added QmfBq8BDXxhu9cLAG4qhxqY6K5xDQCBWyoYqX5fTmQbfwW dcb/theme/images/icons
added Qme4Dt6vQ1eAVcEs7dY55cAMhTsRJxTakANhZjX9EKvGfF dcb/theme/images
added QmciTMAUiEqMpar2u9n1dJNJStmrP6fjMESyH6ZS5eo56H dcb/theme
added QmcPx9ZQboyHw8T7Afe4DbWFcJYocef5Pe4H3u7eK1osnQ dcb
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Note: my first try failed when I tried to add a symlink to the network, that doesn't work.&lt;/p&gt;
&lt;p&gt;See that the hash for &lt;code&gt;dcb/catching-the-blockchain-train.html&lt;/code&gt; is the same as we previously got? That's the de-duplication in action.&lt;/p&gt;
&lt;p&gt;Now when we take the bottom hash from this list and feed it to the gateway, we see the blog: &lt;a href="http://decentralized.blog:8080/ipfs/QmcPx9ZQboyHw8T7Afe4DbWFcJYocef5Pe4H3u7eK1osnQ/"&gt;http://decentralized.blog:8080/ipfs/QmcPx9ZQboyHw8T7Afe4DbWFcJYocef5Pe4H3u7eK1osnQ/&lt;/a&gt;. All relative links work just fine; it's beautiful!&lt;/p&gt;
&lt;p&gt;In case my gateway is down, just try the one provided by IPFS: &lt;a href="https://gateway.ipfs.io/ipfs/QmcPx9ZQboyHw8T7Afe4DbWFcJYocef5Pe4H3u7eK1osnQ/"&gt;https://gateway.ipfs.io/ipfs/QmcPx9ZQboyHw8T7Afe4DbWFcJYocef5Pe4H3u7eK1osnQ/&lt;/a&gt; or your local gateway: &lt;a href="http://127.0.0.1:8080/ipfs/QmcPx9ZQboyHw8T7Afe4DbWFcJYocef5Pe4H3u7eK1osnQ/"&gt;http://127.0.0.1:8080/ipfs/QmcPx9ZQboyHw8T7Afe4DbWFcJYocef5Pe4H3u7eK1osnQ/&lt;/a&gt;. Now is that cool or what?&lt;/p&gt;
&lt;p&gt;There is still a small issue: it is the previous version of the blog because I'm still writing this article and when I upload it when I'm done the hash changes, but then the new hash won't be in the article...&lt;/p&gt;
&lt;p&gt;There is a solution for that:&lt;/p&gt;
&lt;h2&gt;A permanent address for this blog with IPNS&lt;/h2&gt;
&lt;p&gt;The usage of IPNS is explained here: &lt;a href="https://ipfs.io/ipfs/QmNZiPk974vDsPmQii3YbrMKfi12KTSNM7XMiYyiea4VYZ/example#/ipfs/QmP8WUPq2braGQ8iZjJ6w9di6mzgoTWyRLayrMRjjDoyGr/ipns/readme.md"&gt;The Inter-Planetary Naming System&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So in our case, on the node that runs on my server, I do:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ ipfs name publish QmcPx9ZQboyHw8T7Afe4DbWFcJYocef5Pe4H3u7eK1osnQ
Published to QmRf4ERGvYpVo6HRa2VueZT8pWi8YvyLS3rW6ad2y83tdN: /ipfs/QmcPx9ZQboyHw8T7Afe4DbWFcJYocef5Pe4H3u7eK1osnQ
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This results in an address for the blog that won't change: &lt;code&gt;QmRf4ERGvYpVo6HRa2VueZT8pWi8YvyLS3rW6ad2y83tdN&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;This address points (when I executed the command just right now) to the directory containing the static files (index.html is served when it is in that directory BTW).&lt;/p&gt;
&lt;p&gt;When you read this, the address &lt;code&gt;QmRf4ERGvYpVo6HRa2VueZT8pWi8YvyLS3rW6ad2y83tdN&lt;/code&gt; is still the home page address, but it will contain new content (I will do another &lt;code&gt;publish&lt;/code&gt; when I'm done writing this post).&lt;/p&gt;
&lt;p&gt;So our static blog is now decentralized and available through &lt;a href="http://decentralized.blog:8080/ipns/QmRf4ERGvYpVo6HRa2VueZT8pWi8YvyLS3rW6ad2y83tdN/"&gt;http://decentralized.blog:8080/ipns/QmRf4ERGvYpVo6HRa2VueZT8pWi8YvyLS3rW6ad2y83tdN/&lt;/a&gt;. Note the &lt;code&gt;ipns&lt;/code&gt; part instead of &lt;code&gt;ipfs&lt;/code&gt; this time.&lt;/p&gt;
&lt;p&gt;IPFS is pretty cool, and it makes our lives much easier. Before we move on to improving our blog I'd like to look a little bit under the hood the understand the workings of IPFS (and IPNS) a bit more... &lt;/p&gt;
&lt;p&gt;Read on here: &lt;a href="/understanding-the-ipfs-white-paper-part-1.html"&gt;Understanding the IPFS White Paper part 1&lt;/a&gt;.&lt;/p&gt;</content></entry><entry><title>Picking a Decentralized Storage System</title><link href="https://decentralized.blog/picking-a-decentralized-storage-system.html" rel="alternate"></link><published>2017-08-02T19:11:00+02:00</published><updated>2017-08-02T19:11:00+02:00</updated><author><name>Mark Pors</name></author><id>tag:decentralized.blog,2017-08-02:/picking-a-decentralized-storage-system.html</id><summary type="html">&lt;p&gt;This article is part 2 of the Blockchain train journal, start reading here: &lt;a href="/catching-the-blockchain-train.html"&gt;Catching the Blockchain Train&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Some reading material to get started&lt;/h2&gt;
&lt;p&gt;A couple of articles that I found useful when learning about decentralized storage:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://media.consensys.net/decentralized-storage-the-backbone-of-the-third-web-d4bc54e79700"&gt;Decentralized Storage: The Backbone of the Third Web&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ipfs.io/ipfs/QmNhFJjGcMPqpuYfxL62VVB9528NXqDNMFXiqN5bgFYiZ1/its-time-for-the-permanent-web.html"&gt;HTTP is obsolete. It's time for …&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;This article is part 2 of the Blockchain train journal, start reading here: &lt;a href="/catching-the-blockchain-train.html"&gt;Catching the Blockchain Train&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Some reading material to get started&lt;/h2&gt;
&lt;p&gt;A couple of articles that I found useful when learning about decentralized storage:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://media.consensys.net/decentralized-storage-the-backbone-of-the-third-web-d4bc54e79700"&gt;Decentralized Storage: The Backbone of the Third Web&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ipfs.io/ipfs/QmNhFJjGcMPqpuYfxL62VVB9528NXqDNMFXiqN5bgFYiZ1/its-time-for-the-permanent-web.html"&gt;HTTP is obsolete. It's time for the distributed, permanent web&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ethereum.stackexchange.com/a/2422/16115"&gt;What is the difference between Swarm and IPFS?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Comparing decentralized storage systems&lt;/h2&gt;
&lt;p&gt;Our decentralized blog pages are in need of some sort of decentralized hosting. To build that from scratch seems like a lot of work and will probably result in a blockchain train crash.&lt;/p&gt;
&lt;p&gt;So let's see what is already out there we could use for our project.&lt;/p&gt;
&lt;p&gt;I searched a bit and came up with:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://storj.io/"&gt;Storj&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://sia.tech/"&gt;SIA&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://maidsafe.net/"&gt;MaidSafe&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ipfs.io/"&gt;IPFS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://zeronet.io/"&gt;ZeroNet&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.ethereum.org/"&gt;Ethereum Swarm&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.bigchaindb.com/"&gt;BigchainDB&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;did I forget a serious contender? Please &lt;a href="https://twitter.com/pors"&gt;let me know&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I’m not yet qualified to compare these technologies (still trying to catch the train!), but I’ll add some observations for each:&lt;/p&gt;
&lt;h3&gt;Storj&lt;/h3&gt;
&lt;p&gt;From the home page:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Blockchain-based, end-to-end encrypted, distributed object storage, where only you have access to your data.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;That doesn't sound like something that is handy for a blog, where we want content to be public.&lt;/p&gt;
&lt;p&gt;Storj looks like a great product though, it is a bit like &lt;a href="https://www.resilio.com/"&gt;Resilio Sync&lt;/a&gt;, but with a blockchain added to create a marketplace for buying or renting out disk space on the network.&lt;/p&gt;
&lt;h3&gt;SIA&lt;/h3&gt;
&lt;p&gt;SIA is another Dropbox killer, more or less the same as Storj.&lt;/p&gt;
&lt;h3&gt;MaidSafe&lt;/h3&gt;
&lt;p&gt;Where Storj and SIA pitch their service as a faster and cheaper way to store your data, Maidsafe promotes their SAFE network by scaring you. Cloud providers, government, and hackers can not be trusted is the message in their video. Apart from the funny name, it is very similar to the two services above.&lt;/p&gt;
&lt;h3&gt;IPFS&lt;/h3&gt;
&lt;p&gt;Now, this is a different beast. The first three services are &lt;code&gt;incentive platforms&lt;/code&gt;, which means they have their own cryptocurrency to support their marketplace. IPFS also has such a thing, &lt;a href="https://filecoin.io/"&gt;FileCoin&lt;/a&gt;, but it is neatly split from IPFS which is more like a decentralized storage protocol.&lt;/p&gt;
&lt;p&gt;IPFS stands for &lt;code&gt;interplanetary file system&lt;/code&gt;, but they hide the original name from their homepage. Too funny for a serious business!&lt;/p&gt;
&lt;p&gt;On the home page it says:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;IPFS is the Distributed Web&lt;/p&gt;
&lt;p&gt;A peer-to-peer hypermedia protocol to make the web faster, safer, and more open.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;IPFS seems like an great option for our project.&lt;/p&gt;
&lt;h3&gt;ZeroNet&lt;/h3&gt;
&lt;p&gt;ZeroNet doesn't have a cheesy video on their home page, so I had to actually &lt;em&gt;read&lt;/em&gt;. However, their awesome presentation is 100x better than the four videos from the others combined: &lt;a href="https://docs.google.com/presentation/d/1_2qK1IuOKJ51pgBvllZ9Yu7Au2l551t3XBgyTSvilew/pub?start=false&amp;amp;loop=false&amp;amp;delayms=3000&amp;amp;slide=id.g9a1cce9ee_0_4"&gt;ZeroNet preso&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;They also seem to operate a lot less like a serious business compared to the others, showing more of the idealistic open source spirit.&lt;/p&gt;
&lt;p&gt;On the home page:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Open, free and uncensorable websites, using Bitcoin cryptography and BitTorrent network&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Oh, oh, that is what &lt;em&gt;we&lt;/em&gt; are trying to do here! A competitor! Nah, let's just keep an eye on the code, maybe we can learn a thing or two.&lt;/p&gt;
&lt;h3&gt;Ethereum Swarm&lt;/h3&gt;
&lt;p&gt;On our trip to become blockchain developers, we have no other choice than to dive into Ethereum. We will address that in a future episode. But their decentralized file storage system, named Swarm, must be considered here.&lt;/p&gt;
&lt;p&gt;It took me a while to find the source code for this project, but &lt;a href="https://github.com/ethereum/go-ethereum/tree/master/swarm"&gt;here it is&lt;/a&gt;!&lt;/p&gt;
&lt;p&gt;From the &lt;a href="http://swarm-guide.readthedocs.io/en/latest/introduction.html#introduction"&gt;documentation&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Swarm is a distributed storage platform and content distribution service, a native base layer service of the ethereum web 3 stack. The primary objective of Swarm is to provide a sufficiently decentralized and redundant store of Ethereum’s public record, in particular to store and distribute dapp code and data as well as block chain data. &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It seems that Swarm is an incentive platform enforced with Ethereum smart contracts, so not the best choice for our purpose. We gotta stay hands-on here. We want to add a coin later ourselves!&lt;/p&gt;
&lt;h3&gt;BigchainDB&lt;/h3&gt;
&lt;p&gt;From their site:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;BigchainDB is complementary to decentralized storage, processing and communication building blocks. It can be used side by side with higher-level decentralized computing platforms and applications, and protocols for identity, financial assets, intellectual property and sidechains. BigchainDB fills a gap in the decentralized stack.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This is a brilliant solution, almost too good to be true. It is not just decentralized storage, but a full blown database.&lt;/p&gt;
&lt;p&gt;It is built on top of MongoDB and decentralized, so data is immutable, and there is no central authority.&lt;/p&gt;
&lt;p&gt;For our current project it might be a bit overkill, but let's keep an eye on it.&lt;/p&gt;
&lt;h2&gt;The winning decentralized storage system&lt;/h2&gt;
&lt;p&gt;OK, I’ll be honest, I already picked one before I did this quick research what is around :-)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;The winner is IPFS! Yay!&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The runner-up we might have a look at at a later stage: BigchainDB!&lt;/p&gt;
&lt;p&gt;Even in retrospect, IPFS seems like a good choice: all competitors have their "flaws" in the context of this project. By applying "selection by deduction", only IPFS remains.&lt;/p&gt;
&lt;p&gt;After this very scientific approach in picking IPFS, let's hope it is indeed useful for us. &lt;/p&gt;
&lt;p&gt;Let's move on to part 3: &lt;a href="/getting-to-know-ipfs.html"&gt;Getting to know IPFS&lt;/a&gt;&lt;/p&gt;</content></entry><entry><title>Catching the Blockchain Train</title><link href="https://decentralized.blog/catching-the-blockchain-train.html" rel="alternate"></link><published>2017-08-01T13:34:00+02:00</published><updated>2017-08-01T13:34:00+02:00</updated><author><name>Mark Pors</name></author><id>tag:decentralized.blog,2017-08-01:/catching-the-blockchain-train.html</id><summary type="html">&lt;h2&gt;What is this and for who?&lt;/h2&gt;
&lt;p&gt;This is a blog for techies who (almost) missed the blockchain train. Hmm, I also need to write a song "the blockchain train," it just sounds so good!&lt;/p&gt;
&lt;p&gt;I'm a bit late to the blockchain/Bitcoin party, and when you made it past the …&lt;/p&gt;</summary><content type="html">&lt;h2&gt;What is this and for who?&lt;/h2&gt;
&lt;p&gt;This is a blog for techies who (almost) missed the blockchain train. Hmm, I also need to write a song "the blockchain train," it just sounds so good!&lt;/p&gt;
&lt;p&gt;I'm a bit late to the blockchain/Bitcoin party, and when you made it past the previous line I assume you are too!&lt;/p&gt;
&lt;p&gt;No worries, there is still plenty of time to add blockchain technology to your skillset. I am confident that what we see happening now is just the very beginning of a decentralized Internet. So even though we feel we are late, we can still catch the blockchain train. Especially because you and I are pretty smart! Right?&lt;/p&gt;
&lt;p&gt;My approach to educating myself is two-fold:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;First by reading as much as I can about the blockchain, Bitcoin, smart contracts, Ethereum, dapps, ipfs, and all of that. &lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In parallel, I want to apply what I learn by turning this blog into a decentralized app (dapp) as much as possible. I will work in "naive mode" and start building and using technologies I found on my path, and backtrack (you know, refactor) when I see it was the wrong approach.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The code will, of course, be open source and available here: &lt;a href="https://github.com/blockchaintrain/blog"&gt;blockchaintrain&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;BTW this is not a tutorial; it's just a journal of my activities.&lt;/p&gt;
&lt;h2&gt;What I'm reading&lt;/h2&gt;
&lt;p&gt;I'm reading three books in parallel right now (next to the online article here and there):&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.goodreads.com/book/show/35432045-mastering-bitcoin"&gt;Mastering Bitcoin: Programming the Open Blockchain&lt;/a&gt;: a thorough technical introduction into the world of Bitcoin. I got stuck halfway when I read it a couple of years ago. This time I mean to finish it.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.goodreads.com/book/show/34890064-blockchain-for-dummies-for-dummies"&gt;Blockchain for dummies&lt;/a&gt;: yeah, I know...&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.goodreads.com/book/show/26457167-decentralized-applications"&gt;Decentralized Applications: Harnessing Bitcoin's Blockchain Technology&lt;/a&gt;: not very well received, but I like it so far.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I'll keep you updated on other books or articles I read.&lt;/p&gt;
&lt;h2&gt;Decentralized blog design part 1&lt;/h2&gt;
&lt;p&gt;The first version of this blog (you're reading it now) is a statically generated blog with &lt;a href="https://github.com/getpelican/pelican"&gt;Pelican&lt;/a&gt;*, and I uploaded the files to my server with SSH.&lt;/p&gt;
&lt;p&gt;So my progress towards a fully decentralized blog is 0/100!&lt;/p&gt;
&lt;p&gt;Excellent! That means there is still a lot to discover.&lt;/p&gt;
&lt;p&gt;In the next article, I will describe how I made a first step: load the content of the blog from a decentralized file system.&lt;/p&gt;
&lt;p&gt;*: if you don't like Python, you can use Hugo (Go) or Jekyll (Ruby) or
&lt;a href="https://www.netlify.com/blog/2017/05/25/top-ten-static-site-generators-of-2017/"&gt;any one of these&lt;/a&gt;. Let me know if you follow along with a different site generator, and I'll add it to this blog.&lt;/p&gt;
&lt;h2&gt;What can you expect in the next episodes?&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Using a decentralized file system&lt;/li&gt;
&lt;li&gt;From static pages to dynamic content (so from files to a dapp)&lt;/li&gt;
&lt;li&gt;Supporting identity&lt;/li&gt;
&lt;li&gt;Introduction of colored coins or sidechains or maybe even a mini-ICO&lt;/li&gt;
&lt;li&gt;Whatever seems like a useful feature to add...&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Wanna join me?&lt;/h2&gt;
&lt;p&gt;If you want to play along and contribute, please leave a note in the comments! Uhm, as soon as I have figured out how to support comments in a decentralized manner. Till then, tweet to me &lt;a href="https://twitter.com/pors"&gt;@pors&lt;/a&gt;!&lt;/p&gt;
&lt;p&gt;Continue reading here, part 2 of the Blockchain train journal: &lt;a href="/picking-a-decentralized-storage-system.html"&gt;Picking a Decentralized Storage System&lt;/a&gt;.&lt;/p&gt;</content></entry></feed>