星际文件系统是一个使互联网变得彻底分布式的想法

来源:无慢不快  作者:徐小剑  时间:2019-01-16

  ipfs-interplanetary-file-system-simply-explained

  > https://achainofblocks.com/2018/10/05/ipfs-interplanetary-file-system-simply-explained/

  The Internet is the most import tool in our everyday lives. It's how we consume media, conversate with friends and family, interact with colleagues, lear new skills, and handle our finances.

  我们每天的生活,互联网是最重要的工具。借助互联网,我们使用媒体,与朋友和家人交流,同事之间的互动,学习新技能,以及处理我们的金融财务状况。

  However, the internet that we know and love has flaws. The biggest of those flaws is that the information on it is mostly centralized. This means that the information we access every day is held on servers that are under the control of a central company.

  可是,我们所了解和热爱的互联网已破碎了。其中最大的裂痕就是,互联网的大部分信息数据中心化了。这意味着,每天我们所访问的信息,都是被某一家中央公司所控制的服务器中。

  The Interplanetary File System Mission

  星际文件系统的使命

  The InterPlanetary File System (IPFS) has a goal to create a distributed Web. A peer-to-peer hypermedia protocol to make the web faster, safer, and more open.

  星际文件系统(IPFS)的目标是建立一个分布式网络。一个点对点的超媒体协议,以使网络更快、更安全,同时更开放。

  2 'Central' Problems

  两个“中心化”问题

  Centralization poses a couple of main issues. The first is when you have a central company that controls a lot of data, what happens if access to those servers is not possible

  中心化会引发几个主要问题:第一个就是,一个控制着很多数据的中央公司,如果出现无法访问那些服务,那将会发生什么呢?

  A central company that controls servers that store a lot of valuable and useful data becomes a single point of failure. This failure could be due to an attack, or something as simple as a server that is offline.

  一个中央公司,它掌控的服务器存储着许多有价值和有用处的数据,成为了单点故障。这个故障的出现,可能是因为一个攻击,或某些简单的如某个服务器掉线了。

  The second issue with storing data in a central location is censorship. When large majorities of data are hosted on a few main servers it is easier for Governments to block access to them.

  存储数据在某个集中地,引发的问题是审查。当大多数人的数据存放在几个关键服务器,政府更容易可以阻止访问。

  In 2017, residents of Turkey were blocked from accessing Wikipedia.com. The Turkish government banned the website calling it, "A National Security Threat". This also happened in Egypt in January 2011, when the Government cut off Internet and Cell Phone access for over 95% of its citizens.

  2017 年,土耳其居民就被阻止访问 维基百科(Wikipedia.com)。土耳其政府取缔它,称之为“国家的安全威胁”。这样的情况,2011 年 1月发生于埃及,当时埃及政府对超过 95% 的埃及公民,切断互联网和移动电话。

  Why Do We Use a Flawed System

  为什么我们使用一个破碎的系统?

  The real reason we continue to accept this model is that we have become spoiled with regard to our internet access. We want web pages to load in milliseconds, images and videos to appear without lag, and of course, this all has to be in the highest HD or 4K quality.

  我们接受这种模式的真正原因,是我们已变得被我们的互联网访问所宠坏了。我们想要网页在好毫秒级加载完毕,图片和视频的展现没有延迟,且理所当然的是,它们是要以高清的 HD 和 4K 品质。

  Centralizing servers gives companies complete control over how fast they can deliver this content, and charge accordingly for it.

  集中化的服务器,得以使公司彻底掌控提供内容的速度快慢,并对不同的速度服务进行收费。

  Another reason that we continue with this method is that there really is not a good alternative.

  我们之所以继续使用这种方式的另一个原因,因为目前真的并没一个好的方式。

  IPFS -> The Good Alternative

  星际文件系统 -> 更好的方式

  The InterPlanet File System (also known as IPFS), is an idea to make the Internet completely distributed. The concept transforms the traditional 'HTTP' internet into a Peer to Peer network, similar to how BitTorrent works.

  星际文件系统(也称为 IPFS),是一个使互联网变得彻底分布式的想法。该概念方案革新传统的‘HTTP’互联网,成为一个点对点的同等网络,类似于 BitTorrent 的运作方式。

  Juan Benet is the creator of IPFS and the Founder of Protocol Labs. Protocol Labs is a tech research and development lab that is responsible for IPFS, they have also developed Filecoin & IPLD (and others). Benet studies Computer Science at Standford University and is pretty much obsessed with anything to do with Knowledge, Science, and Technology.

  Juan Benet 是星际文件系统的创造者和协议实验室的创办人。协议实验室是一个科技研究和发展实验室,对星际文件系统负责。同时他们开发了 Filecoin 、IPLD,与其他的。Benet 在斯坦福大学学习计算机科学,对与知识、科学和技术相关的任何东西,特别着迷。

  Juan Benet's original goal was not to necessarily create IPFS when he crafted the concept. What he was looking to do was find an efficient way to move scientific data sets, meaning data that could be 10-100 GB in size. IPFS was designed to look like what would happen if Git and BitTorrent had a baby together. BitTorrrent gives you the ability to move large files across a network rather quickly, and Git gives you the built-in versioning for data.

  当他在对概念构建草稿时,Juan Benet 的原始目标并不是创建星际系统。他想要做的事找到一个更有效的方式来移动科学数据集合,意味着数据的大小是 10 - 100 GB 大小。星际系统,被设计如同 Git 和 BitTorrent 在一起生出的儿子。BitTorrent 使你拥有相当快速地进行网络中传输大文件的能力,而 Git 使你拥有天生的数据版本管理。

  After creating this protocol, Benet soon realized the implications were much larger that just moving large data sets. He had actually created a protocol which could replace other popular protocols in place for how we access information via the web today.

  创建协议后,Benet 不久就意识到这个想法的作用,远远不止于只是移动大数据集。实际上,他已创建了一个协议,它可取代目前我们通过网络访问信息的流行协议。

  Where did the name InterPlanetary File System Come From

  星际文件系统的名字来自哪里?

  When they came up with the naming of the InterPlanetary File System (IPFS), the idea was to pay a bit of an homeage to how the Internet got its name. JCR Licklider, who is the creator of the Arpanet (the predecessor to the internet), had a goal to create an Intergalactic Network.

  当他们提出星际文件系统(IPFS)时,这个点子是向互联网的命名致以敬意。JCR Licklider,阿帕网(互联网的前身)的创造者,有创建一个星际的目标。

  Thus the Internet is really short for Intergalactic Network. InterPlanetary takes a little bit of that same naming convention, additionally, IPFS aims to be the File System (FS) for Internet Protocol (IP). When you put them together you have IPFS, the internet file system.

  因此互联网是一个星际的缩小。星际使用了部分同样的命名惯例,另外,IPFS 目标是成为网络协议(IP)文件系统(FS)。当你把它们放在一块,就有了 IPFS,互联网文件系统。

  I will dive into and explain how IPFS works as a filing system. But first, it is important to understand how we access files from the web today.

  我将会深入展开 IPFS 是如何作为一个文件系统来运作的。但首先,重要的是弄懂现在我们是如何从网络中访问文件。

  When you want to download an image from the internet you tell your computer exactly where to find the image that you are requesting. This location is normally in the form of a URL that contains the domain name of the company that is storing the photo, this is followed by an extension that specifies what the file is. An example request for this blog post would look like this: https://achainofblocks.com/ipfs-simple-guide.jpg.

  你想要从互联网上下载一张图,必须要明确地让计算机知道具体哪里可以找到你要请求的图片。一般这个地址是 URL 形式,包含公司的域名,所保存的图片。后面跟随着一个扩展名,说明该文件的类型。以这篇博客文章作为请求案例,具体就是:https://achainofblocks.com/ipfs-simple-guide.jpg。

  This method for accessing resources is called "Location Based Addressing", you tell the computer the Location where they can Access the information and the computer retrieves the information. The one problem with this method is if the location is not accessible (maybe the server is offline) then the users' computer cannot retrieve the information that they need.

  这种访问资源的方式,被称作为“基于位置的寻址”,你告诉计算机位置,哪里可以访问信息和接收到了信息。这种方式存在的一个问题是,如果位置 URL 无法访问了(可能服务器断线),用户的计算就获取到他们想要的信息。

  Server Down, We're All Down

  服务器宕机了,我们就玩完了

  With location-based addressing when a server goes down, everything contained within that server is not accessible over the internet. However, when a server goes down there is a high probability that another user has downloaded that image, and is storing it locally on their computer. But even if another computer does have this file, your computer is not able to connect with the other computer in possession to transport the file.

  基于位置的寻址式,服务器宕机了,服务器所有的内容再也无法通过互联网访问。可是,服务器宕机之前,更大的可能性是其他用户已下载了这张图片,保存在自己的本地电脑。可惜的是,即使其他计算机有这个文件,你的计算机也无法连接拥有该文件传输所有权的其他计算机。

  All About the Content

  一切皆是内容

  To help address this issue, IPFS introduces the concept of "Content-Based Addressing". With content-based addressing when requesting a specific resource you do not need to specify the location, you only need to specify what you want.

  为了解决该问题,星际文件系统采用了“基于内容寻址”的理念。使用基于内容的寻址,当你请求一个具体资源时,你不需要指定具体地址,你只需要明确指定你需要的是什么。

  Every file has a unique hash, which can be thought of as the fingerprint or identification of the file. When you want to access a specific file, you simply ask the network who has a copy of the file with the specified hash. Once the request is made, someone on the IPFS network will provide the resource that you have requested. You will download that resource, and a copy will be saved to you IPFS cache. Now when another person comes and requests the same file, you will be able to provide it to them. This creates a system that speeds as it is used more because the more files that are share the more readily available they are amongst a large group of nodes.

  每个文件有着一个唯一的哈希串,它可以理解为文件指纹或识别符。当你想要访问一个具体文件,简单地向网络询问谁有着某一具体哈希的文件复件。一旦请求发出,星际文件系统网络上的用户,将会提供你请求的文件。你可以下载资源,并且资源的复印件会被保存在你的 IPFS 缓存。现在如果有第三者来请求同样的文件,你将能够提供此文件给对方。随着系统被用得越来越多,这使得一个系统速度加快,因为更多的分享文件,意味着更多的可靠性。他们都是在一个大组的节点中。

  Change is Good...

  改变是好的...

  At this point, my guess is that you have the same question I did right about now. How do I know that the person or node that is providing me with the file hasn't tampered with it in some way Because you use a hash function to retrieve the file, you can verify what you have received.

  基于这一点,我的猜测是你会萌生一个与我现在所遇到的相同问题。如何才能知道信任某个人或节点,他所传送的文件是并没有被以某种方式篡改的呢?原因是你使用了一个哈希函数来接收文件,你可以校验你所接收到的。

  Changing the hash of a file would be equally as difficult as changing a transaction in the blockchain. A request is made for a file that has a specific hash, so when the file is received you make sure that the hash matches the request. This is the same method you would use for validating your Amazon purchase. If you ordered Green Socks, and Red Socks show up you would reject them and wait for your Green Socks to show up.

  修改一个文件的哈希值的困难度,等于改变区块链中的一个事务。每个文件的请求都有着一个具体的哈希,所以在接收该文件时,你可以确认该哈希值匹配该请求。这种方式,与你确认自己在亚马逊所购买的物品。如果你订购了绿色袜子,而送来的是红袜子,你会拒收。等待你的绿色袜子出现。

  Another feature of IPFS is deduplication, this means when multiple users post the same file it is only created one time on the network. This is something that helps to make the network more efficient.

  星际的另一个特性是重复数据删除,这意味着当多个用户发表了同一文件,在网络上该文件只会被创建一次。这个特性可以使网络更加高效。

  How IPFS Really Works

  星际文件系统如何实际运转

  Now you have the basics of how IPFS compares to today's traditional methods, let's dive a little deeper into how IPFS actually stores data and makes it accessible to users.

  对比星际文件系统与现代的传统方式,现在你有了基础认识。让我们再深入一点,看看星际文件系统如何保存数据,以及如何实现文件可以被用户访问的。

  星际文件系统是一个使互联网变得彻底分布式的想法

  In IPFS, files are stored in IPFS object, and each Object can store 256 kb of data. An Object can also contain a Link to another IPFS object, linking is what makes it possible to store data that is larger than 256 kb. For example, if you upload just a small text file, then one 256 kb object should be adequate for your small amout of text.

  星际文件系统中,文件都被存在的文件系统对象中,而且每个对象只能存储 256 kb 数据。一个对象可以包含指向另一对象的连接,连接使得对象可以保存大于 256 kb 的 数据。例如,如果你只是上传一个小文本文件,对于你的小文本文件,那么一个 256 kb 对象足够合适的。

  星际文件系统是一个使互联网变得彻底分布式的想法

  However, if you are storing a picture, this would be broken up into multiple objects that are each a maximum of 256 kb. The IPFS system will then create an Empty Object that would link to all the objects that make up that picture.

  可是,当你在保存一张图片,图片会被分隔称为多个对象,每个对象的大小都是最大的 256 kb。星际文件系统会创建一个「空对象」连接所有组成那张照片的对象。

  https://achainofblocks.com/wp-content/uploads/2018/10/InterPlanetary-File-System-IPFS-Content-Based-Addressing-Data-object-JPG.png

  星际文件系统是一个使互联网变得彻底分布式的想法

  This architecture is very simple, but it is also very powerful, the architecture is what truly enables IPFS to be used as a file system.

  这种架构师非常简单,可是同时也非常强大。该架构真正使得星际文件系统,可以如文件系统一样的使用。

  If you take a look at the simple file directory structure below, I'll explain how this could be translated to an IPFS structure:

  请看下面的简单文件目录结构,我将会解析如何将此结构转换为星际文件系统结构。

  https://achainofblocks.com/wp-content/uploads/2018/10/Interplanetary-File-System-IPFS-Simple-File-Structure.png

  星际文件系统是一个使互联网变得彻底分布式的想法

  This could be translated to IPFS by creating 1 Object for each File and each Folder/Directory, then link the files to the specified directories. However, it gets even better when you take into account the fact that IPFS uses Content-Based Addressing.

  转换到星际文件系统,就是为了每个文件和每个文件夹、目录创建一个对象,之后链接对应的文件到对应具体的目录。甚至,它会变得更好,如果你把星际文件系统使用内容寻址,这一事实算进去了。

  This means that files that are added are immutable, they can never be changed, very much like a blockchain. This means you can be assured that the resource you are accessing is the correct data, and has never been altered.

  该架构意味着,所被添加的问题是不可更改的,它们是不可再更改的,与区块链非常相似。这代表着你可确信正在的访问的资源,就是正确的数据,且从未改变过的。

  https://achainofblocks.com/wp-content/uploads/2018/10/InterPlanetary-File-System-IPFS-Content-Based-Addressing-Data-object-File-System.png

  星际文件系统是一个使互联网变得彻底分布式的想法

  How Can I Update My Data

  如何更新我的数据呢?

  IPFS supports file Versioning, this works similarly to how Git works as an open source code repository.

  星际文件系统支持文件版本,它的作用相同于作为一个开源代码仓库的 Git。

  https://achainofblocks.com/wp-content/uploads/2018/10/InterPlanetary-File-System-IPFS-Content-Based-Addressing-Data-object-commit-object-versioning.png

  星际文件系统是一个使互联网变得彻底分布式的想法

  For example, you are working on a text file called, 'Important Document-v1.doc', and you want to share this document with people using IFPS.

  例如,你正在编写一个名字为“Important Document-v1.doc”文件,而你想要与使用星际文件系统的人们分享该文档。

  When you add this file to IPFS, what happens behind the scenes is, IPFS will create a new Commit Object. This Object is very basic, all it does is tell IPFS which Commit preceded this one and it links to the IPFS Object associated with the File, 'Important Document-v1.doc'.

  在你添加该文件到星际文件系统时,该过程的所发生的事情是,星际文件系统将会创建一个新的提交对象。这个对象是非常简单基本的,它所做的事情是通知星际文件系统,哪个提交执行的,并且它会链接到与此文件(Important Document-v1.doc)相关联的星际文件系统对象。

  Now let's imagine some time has gone by and your 'Important Document.doc' needs a revision. This is done by simply adding the new file to IPFS 'Important Document-v2.doc', the software will create a new Commit Object for the updated file (same as the original process).

  现在我们想象过了段时间,你的文件 ‘Important Document.doc’ 需要更改。你可以轻松的通过添加新文件(Important Document-v2.doc)到星际文件系统来完成。系统会为更新的文件创建一个新提交对象(与原先的过程相同)。

  This Commit Object now links to the previous Committed Object, the first Commit serving as the Parent Object. This process can be repeated endlessly, creating a linked chain of versions of the same data all referencing the entire chain. IPFS makes sure that your file along with the entire file versioning history is accessible to all other nodes on the network.

  现在这个提交对象,关联到前一个提交对象,第一个提交对象作为父对象。此过程可以一直重复,创建一个连接链,所有引用整个链的相同数据的不同版本的链。星际文件保证了,你那整个文件和版本记录,都可被网络中的其他节点访问。

  https://achainofblocks.com/wp-content/uploads/2018/10/InterPlanetary-File-System-IPFS-Content-Based-Addressing-Data-object-commit-object-versioning.png

  星际文件系统是一个使互联网变得彻底分布式的想法

  No System is Perfect

  没有系统是完美的

  So far we have discussed many of the useful features and key concepts of the InterPlanetary File System. However, all protocols have limitation and drawbacks.

  目前为止,我们已经讨论「星际文件系统」的许多有用特性和核心内容。可是,所有的协议都存在局限性和缺点。

  As you might imagine, the biggest problem that IPFS currently face is keeping the file available. Every node on the network keeps a cache of the files that they have downloaded and helps to make them available as other users need them.

  正如你所想象,「星际文件系统」正面临着的最大问题是保证文件的可用性。网络中的每一节点,保存他已下载的文件缓存,使文件对其他有需要的用户是可用的。

  However, in a simple situation, if a Document is hosted by 4 nodes and they all go offline that document is no longer accessible.

  可惜,在一个简单的情况里,假如有一个文档被 4 个节点拥有,现在他们全部都离线,那么该文件就是不再可访问的。

  There are a couple of ways to tackle the problem above. One way is to incentivize nodes to stay online and keep the files available to the community. A reward for storage space that you can commit to the network, this would ensure that files have a high likelihood of being availabe when needed. The other way is to proactively distribute files throughout the network, making sure there are always enough copies online at any given time. You can think of this like redundancy on a massive scale.

  解决上面的问题,有着几种方式。一个方式是鼓励节点保持在线,保持文件对社区的可用性。对你为网络所提供的存储空间,提供奖励,这会保证当我们需要时,文件有着一个高可能的可用性。另一个方式是主动分发文件到整个网络,以使在任何时刻都存在足够的文件备份在线。你可以将它理解为规模庞大的冗余。

  Filecoin

  文件币

  This issue is the exact issue that Filecoin is aiming to solve. Filecoin was created by the same group that founded IPFS. Filecoin is a blockchain that is built on top of IPFS with the goal of creating a decentralized market for storage. What that means is that users that have extra storage available on their hard drive can rent it out for use as IPFS storage and make some money off it in the process.

  该问题是文件币所致力于解决的同一问题。文件币是由发起星际文件系统的同一组人所创建的。文件币是建立在「星际文件系统」之上的区块链,目标是去中心化的存储市场。这等于是,用户有着额外可用的硬盘存储空间的,可出租这些空间用作星际文件系统存储,并且可以在过程中赚取一些金钱收益。

  You can think of Filecoin as a similar service to Airbnb, instead of renting out the available space in your house, you rent out the space available on your computer for storage.

  你可以将文件币理解为像「空客」一样的服务,它是出租你电脑的存储空间,而不是出租你房子的空间。

  Filecoin creates an incentive for nodes to keep the data online and retain for as long as possible. In addition to an incentive, which keeps the nodes online, it also replicates the data across many nodes making it highly available and easily accessible (even if a few nodes are offline). Filecoin and IPFS have the same goal and that is to be Offline First, meaning they are constantly striving to make a better experience without needing to make a call to a server to access resources.

  文件币对节点创建了一个激励,使得数据尽可能的长时间在线与保留,它也跨越很多节点复制数据,使得高可用和易访问(即使某几个节点离线)。文件币和星际文件系统,有着相同目的就是「离线优先」,意味着它们一直在为了不需通过服务器就可以访问资源的体验而努力。

  This is a very high-level quick summary of Filecoin. I will go deeper into Filecoin, along with some of the other great projects from Protocol labs in future articles.

  星际文件系统是一个使互联网变得彻底分布式的想法

您可能喜欢
Copyright © 2017 iIPFS.cn IPFS/FileCoin资讯站