{"id":7731,"date":"2019-08-27T15:01:01","date_gmt":"2019-08-27T15:01:01","guid":{"rendered":"https:\/\/nkn.org\/community\/blog\/planet-hopping-or-galactic-express\/"},"modified":"2019-08-27T15:01:01","modified_gmt":"2019-08-27T15:01:01","slug":"planet-hopping-or-galactic-express","status":"publish","type":"post","link":"https:\/\/nkn.org\/de\/community\/blog\/planet-hopping-or-galactic-express\/","title":{"rendered":"\u201cPlanet Hopping\u201d or \u201cGalactic Express\u201d"},"content":{"rendered":"<p>Captain Narwhal\u2019s choices in transmitting data over NKN<\/p>\n<figure class=\"wp-caption\">\n<p><img decoding=\"async\" data-width=\"500\" data-height=\"281\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*ilsWr-tQnwn94BW_\"><figcaption class=\"wp-caption-text\">Captain Narwhal Planet Hopping Hyperdrive (image by\u00a0Izmo)<\/figcaption><\/figure>\n<p>Imagine you are Captain Narwhal of the Millennium Falcon starship, and need to go from Earth to Endor. You have two choices:<\/p>\n<ul>\n<li>\u201c<strong>Planet hopping<\/strong>\u201d: go via moon to Mars, from Mars to Tatooin, through Hoth and Naboo, and then land on Endor. It takes a bit of time, but costs little gas and travels securely.<\/li>\n<li>\u201c<strong>Galactic Express<\/strong>\u201d: Head to the nearest Hyperspace terminal (on the moon), pay for a lot of gas, and boom, it zooms your spaceship straight to Endor in a few minutes.<\/li>\n<\/ul>\n<p>Luckily, you also have these two choices when using NKN to send data from one client to another client. In the next two chapters, we will delve into the details of how they work, how they differ, and how they can best serve different types of applications over the NKN Network.<\/p>\n<h3>\u201cPlanet Hopping\u201d: Secure &amp;\u00a0Fast<\/h3>\n<figure>\n<p><img decoding=\"async\" data-width=\"1600\" data-height=\"904\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*p_c-PLT_urLREEmQ\"><br \/>\n<\/figure>\n<p>The \u201cnormal\u201d way to route packets through NKN Network is using <strong>NKN\u2019s significantly improved Chord Distributed Hash Table (DHT) algorithms<\/strong>. Chord DHT is <strong>secure and verifiable<\/strong>, meaning the choice of neighbors and route is verifiable given all the nodes addressed on the ring. The routing works such that:<\/p>\n<ul>\n<li>There is a virtual and very large ring<\/li>\n<li>All NKN nodes are given a random but verifiable NKN addresses and mapped onto the ring<\/li>\n<li>The sending node calculates the distance (clockwise on the ring) to find a neighbor closest to the destination address<\/li>\n<li>The selected Neighbor will relay the data to its neighbor closest to the receiver, etc, until the data reaches its destination.<\/li>\n<\/ul>\n<p>A more detailed description of the algorithm can be found in \u201cStephen Wolfram (Creator of NKS) Tries to Understand NKN\u201d:<\/p>\n<p><a href=\"https:\/\/forum.nkn.org\/t\/stephen-wolfram-creator-of-nks-tries-to-understand-nkn\/185\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/forum.nkn.org\/t\/stephen-wolfram-creator-of-nks-tries-to-understand-nkn\/185<\/a><\/p>\n<figure>\n<p><img decoding=\"async\" data-width=\"860\" data-height=\"774\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*s6DeAy6si_qLYLxC\"><br \/>\n<\/figure>\n<p>In some cases, this mode of routing will add more hops and potentially more latency compared to the default route a packet will travel without NKN. There is <strong>a tradeoff between efficiency and security<\/strong>. The reason is that NKN\u2019s mining reward is based on Proof of Relay, or how much data a node relays for the network. So in order to prevent collusion attacks, it is critical that nodes cannot manipulate neighbors nor routing.<\/p>\n<figure>\n<p><img decoding=\"async\" data-width=\"1534\" data-height=\"662\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*yDqjNQW0JvWrUclN\"><br \/>\n<\/figure>\n<p>But we have made two enhancements to the original Chord DHT algorithm to improve its efficiency without sacrificing the security and verifiability.<\/p>\n<h3>Latency optimized routing<\/h3>\n<figure>\n<p><img decoding=\"async\" data-width=\"638\" data-height=\"422\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*JsdxMXvoOAIHF78C\"><br \/>\n<\/figure>\n<ul>\n<li>Node A maintains latency information of all its neighbors (typically 50\u2013100 neighbors for each node in current NKN implementation). This latency data is based on not only the physical networking latency, but also the protocol level processing latency. Thus the NKN latency metric is a good indicator of overall quality of each hop.<\/li>\n<li>When data arrives at Node A for destination of Y, Node A has a choice among 3 next hop neighbors (B1, B2, B3) to forward. This group of neighbors is determined by NKN algorithm and cannot be picked by node A itself.<\/li>\n<li>Node A picks neighbor with the lowest latency, Node B1 at 23ms, among the 3 proposed by the NKN algorithm. Node A relay the data to Node B1.<\/li>\n<li>All decisions are local, and decisions are made at each subsequent hop until the data reaches the final destination.<\/li>\n<\/ul>\n<p>We have found that the default route in today\u2019s Internet is far from optimal. By selecting the lowest NKN Latency route, we can often improve the end user\u2019s Internet experience. But there is more.<\/p>\n<h3>Concurrent multi-path routing<\/h3>\n<p>We can also <strong>combine multiple NKN routes for not only better latency, but also higher aggregated bandwidth<\/strong>. One good use case is large file transfer based on http\/https and range request. The following diagram illustrates the concept of combining 3 NKN paths, but in reality our multi-client SDK supports any number of concurrent NKN routing paths. When one utilizes multiple concurrent path, he can either choose to minimize latency by sending more redundant data using different paths (e.g. nkn-multiclient: <a href=\"https:\/\/github.com\/nknorg\/nkn-multiclient-js\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/github.com\/nknorg\/nkn-multiclient-js<\/a>), or choose to maximize throughput by sending different pieces of data using different paths (e.g. nkn-file-transfer: <a href=\"https:\/\/github.com\/nknorg\/nkn-file-transfer\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/github.com\/nknorg\/nkn-file-transfer<\/a>).<\/p>\n<figure>\n<p><img decoding=\"async\" data-width=\"1512\" data-height=\"678\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*4tkOJp9uzZdsvf1J\"><br \/>\n<\/figure>\n<p>And the test results show significant improvements. In late 2018 we did a prototype of a web accelerator and achieved a 167%\u200a\u2014\u200a273% speed boost by using multi-path over our testnet. And the bigger the file, the better the boost.<\/p>\n<figure>\n<p><img decoding=\"async\" data-width=\"1200\" data-height=\"742\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*zYDTIexoTUH4nSuL\"><br \/>\n<\/figure>\n<p>In August 2019, a recent test of large file transfers over NKN mainnet using nkn-file-transfer (<a href=\"https:\/\/github.com\/nknorg\/nkn-file-transfer\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/github.com\/nknorg\/nkn-file-transfer<\/a>) shows we are 460% the speed of WeChat and 160% of QQ. We used 8 concurrent (randomized and secure) paths over NKN Mainnet, between PC clients in China and in California.<\/p>\n<figure>\n<p><img decoding=\"async\" data-width=\"1200\" data-height=\"742\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*Ductla33FXTvyqnV\"><br \/>\n<\/figure>\n<h3>\u201cGalactic Express\u201d: Direct &amp;\u00a0Faster<\/h3>\n<figure>\n<p><img decoding=\"async\" data-width=\"852\" data-height=\"480\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*KH8JldIrVmoFOtj3\"><br \/>\n<\/figure>\n<p>But what if you want an even faster experience? As fast as a Hyperspace jump? And willing to pay gas for it?<\/p>\n<p>Yes you definitely can with the NKN network,but with a different mode of operation as illustrated in the examples below. This mode is specifically designed for applications that require the most direct and fastest service possible. The key is to <strong>connect to a single NKN Node which offers a direct route to the destination<\/strong>. In this case, the client pays the node directly as the traffic does not go through NKN\u2019s consensus and therefore does not have the opportunity to earn mining rewards for the traffic.<\/p>\n<h3>App 1: nCDN for content\u00a0delivery<\/h3>\n<figure>\n<p><img decoding=\"async\" data-width=\"1330\" data-height=\"654\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*TenHzLVK1vHB2iLG\"><br \/>\n<\/figure>\n<ul>\n<li>Client connects to Node A, based on several factors such as geographical proximity, throughput, latency, and performance.<\/li>\n<li>Node A is an nCDN edge node, that caches content based on client demands.<\/li>\n<li>When a client wants to stream the latest \u201cStar Wars\u201d Movie, Node A discovers it does not have this movie in local cache. So Node A will fetch a copy from the Media Store. This only needs to happen once.<\/li>\n<li>Node A will serve the local copy of \u201cStar Wars\u201d directly to Client.<\/li>\n<li>If there are other users in the same geographical region that also want to stream \u201cStar Wars\u201d, then Node A can serve them directly with a local copy.<\/li>\n<li>Node A will be paid according to the amount of content delivery service it provided.<\/li>\n<\/ul>\n<h3>App 2: TUNA and universal tunneling<\/h3>\n<p>TUNA, short for <strong>T<\/strong>unnel <strong>U<\/strong>sing <strong>N<\/strong>KN for any <strong>A<\/strong>pplication, is a platform built on top of NKN that allows everyone to turn any network based application into a service and monetize it based on usage. Some concrete examples are:<\/p>\n<ul>\n<li>Play high quality games via streaming, such as DOTA2, on a remote high end server with performance GPU.<\/li>\n<li>Work on advanced machine learning algorithms using the Jupyter notebook, utilizing the idle computing power of a remote high performance multi-core server<\/li>\n<li>Accelerate access to a website using a remote web proxy or web accelerator<\/li>\n<\/ul>\n<p>In order to fulfill the <strong>high bandwidth and low latency<\/strong> requirements of these applications, the client only needs to connect to the NKN TUNA server where such services are hosted. The TUNA client pays via NKN to the TUNA node, based on the usage of certain services. In this case, we do not go through the randomized routing of NKN\u2019s \u201cNormal mode\u201d at all! So we can support services similar to the likes of the upcoming Google Stadia game streaming service.<\/p>\n<figure>\n<p><img decoding=\"async\" data-width=\"1318\" data-height=\"702\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*N7f_GeNZYEO3AHQ_\"><br \/>\n<\/figure>\n<p>If we dive one level deeper, you can see that TUNA acts as a multiplexer between many different applications to utilize the same tunnel between the client and the NKN TUNA node. So all the client side applications talk to the server side as if both are residing on the same computer. No modification to the applications at all, which is the beauty and main attraction of TUNA solution.<\/p>\n<figure>\n<p><img decoding=\"async\" data-width=\"1318\" data-height=\"732\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*Esbq2-GomlsUsMhF\"><br \/>\n<\/figure>\n<h3>Summary<\/h3>\n<p>So Captain Narwhal\u2019s choices are clear depending on the type of application you are using over NKN\u2019s network., A simple side-by-side comparison is provided below:<\/p>\n<figure>\n<p><img decoding=\"async\" data-width=\"1264\" data-height=\"600\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/1*oIfvKMOP2xZghoXw8SdXww.png\"><br \/>\n<\/figure>\n<p><strong>Captain Narwhal, may the force be with you and happy sailing across the vast NKN universe!<\/strong><\/p>\n<figure>\n<p><img decoding=\"async\" data-width=\"1600\" data-height=\"902\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*vzx7uXvyhAxGz3Cm\"><br \/>\n<\/figure>\n<h3>About NKN<\/h3>\n<p>NKN is the new kind of P2P network connectivity protocol &amp; ecosystem powered by a novel public blockchain. We use economic incentives to motivate Internet users to share network connection and utilize unused bandwidth. NKN\u2019s open, efficient, and robust networking infrastructure enables application developers to build the decentralized Internet so everyone can enjoy secure, low cost, and universally accessible connectivity.<\/p>\n<figure>\n<p><img decoding=\"async\" data-width=\"1000\" data-height=\"316\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*zE83U178W4OTvNBX.png\"><br \/>\n<\/figure>\n<p>Home:<a href=\"https:\/\/nkn.org\/de\/\" target=\"_blank\" rel=\"noopener noreferrer\"> https:\/\/nkn.org\/<\/a><\/p>\n<p>Email: <a href=\"mailto:contact@nkn.org\" target=\"_blank\" rel=\"noopener noreferrer\">contact@nkn.org<\/a><\/p>\n<p>Telegram:<a href=\"https:\/\/t.me\/nknorg\" target=\"_blank\" rel=\"noopener noreferrer\"> https:\/\/t.me\/nknorg<\/a><\/p>\n<p>Twitter:<a href=\"https:\/\/twitter.com\/NKN_ORG\" target=\"_blank\" rel=\"noopener noreferrer\"> https:\/\/twitter.com\/NKN_ORG<\/a><\/p>\n<p>Forum: <a href=\"https:\/\/forum.nkn.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/forum.nkn.org<\/a><\/p>\n<p>Medium:<a href=\"https:\/\/medium.com\/nknetwork\" target=\"_blank\" rel=\"noopener noreferrer\"> https:\/\/medium.com\/nknetwork<\/a><\/p>\n<p>Linkedin:<a href=\"https:\/\/www.linkedin.com\/company\/nknetwork\/\" target=\"_blank\" rel=\"noopener noreferrer\"> https:\/\/www.linkedin.com\/company\/nknetwork\/<\/a><\/p>\n<p>Github:<a href=\"https:\/\/github.com\/nknorg\" target=\"_blank\" rel=\"noopener noreferrer\"> https:\/\/github.com\/nknorg<\/a><\/p>\n<p>Discord:<a href=\"https:\/\/discord.gg\/yVCWmkC\" target=\"_blank\" rel=\"noopener noreferrer\"> https:\/\/discord.gg\/yVCWmkC 1<\/a><\/p>\n<p>YouTube:<a href=\"http:\/\/www.youtube.com\/c\/NKNORG\" target=\"_blank\" rel=\"noopener noreferrer\"> http:\/\/www.youtube.com\/c\/NKNORG<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Captain Narwhal\u2019s choices in transmitting data over NKN Captain Narwhal Planet Hopping Hyperdrive (image by\u00a0Izmo) Imagine you are Captain Narwhal of the Millennium Falcon starship, and need to go from Earth to Endor. You have two choices: \u201cPlanet hopping\u201d: go via moon to Mars, from Mars to Tatooin, through Hoth and Naboo, and then land [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"mc4wp_mailchimp_campaign":[]},"categories":[258,260,212],"tags":[438,295],"acf":[],"_links":{"self":[{"href":"https:\/\/nkn.org\/de\/wp-json\/wp\/v2\/posts\/7731"}],"collection":[{"href":"https:\/\/nkn.org\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nkn.org\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nkn.org\/de\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/nkn.org\/de\/wp-json\/wp\/v2\/comments?post=7731"}],"version-history":[{"count":0,"href":"https:\/\/nkn.org\/de\/wp-json\/wp\/v2\/posts\/7731\/revisions"}],"wp:attachment":[{"href":"https:\/\/nkn.org\/de\/wp-json\/wp\/v2\/media?parent=7731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nkn.org\/de\/wp-json\/wp\/v2\/categories?post=7731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nkn.org\/de\/wp-json\/wp\/v2\/tags?post=7731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}