InterPlanetary File System 소개 자료입니다.
풀 한글로 작성하고 싶었으나
시간관계 상 중반부 이상은 영문 번역을 손을 못댔네요.
(이후 시간이 된다면 수정해보겠습니다.
그림 및 도표의 출처는 모두 링크로 기재되어있습니다.
본자료는 흐름을 이해하는데 사용하시고
원문 링크를 한번씩 더 읽어보시길 추천드립니다.
3. IPFS
• InterPlanetary File System
– IPFS는 분산형 웹입니다. (https://ipfs.io/)
• 웹을 더 빠르고 안전하며 개방성있게 만들어줄 P2P hypermedia 프로토콜입니다.
– IPFS는 P2P 분산 파일 시스템이며, 본 기술을 통해 모든 컴퓨팅 기기들이 동일한 파일 시스템을
가질 수 있도록 연결할 수 있습니다. 어떤 측면에서는 IPFS가 World Wide Web과 비슷하기도
합니다. 하지만 IPFS는 하나의 Git repository 내에 존재하는 객체들을 관리 및 교환하기 위한
단일 BitTorrent Swarm으로 생각해 볼 수 있습니다.
다.(https://en.wikipedia.org/wiki/InterPlanetary_File_System)
– Wiki & git: https://github.com/ipfs/ipfs
– 백서 : IPFS - Content Addressed, Versioned, P2P File System (draft 3)
– 관련 영상 : IPFS: The Distributed, Permanent Web at Stanford
3
8. 네이버에 접속해보자
8
• 질문 2
– 버튼만 눌렀는데 위에 URL은 왜 바뀌지?
– 얘는 뭐가 이렇게 길게 적혀있지?
– 어떻게 웹툰을 띄워주는 거지?
9. 기술적 배경
9
https://ruslanspivak.com/lsbaws-part1/
• World wide Web
– URL
– HTTP
– Client Server model
• 웹 브라우저
• 웹 서버
“어디”로 가서
“무엇”을 찾고
“어떻게“ 하고싶다.
http://comic.naver.com/webtoon/detail.nhn?titleId=20853&no=1135&weekday=tue
“어떻게”
http(80 port)
프로토콜로
요청하는데
“어디”
Comic.naver.com
(“111.111.111.111”)
에 접속할거고
“무엇“
“webtoon/…”에
해당 하는
파일을 찾으면 돼
13. 기술적 배경
13
• 별로일지도..
– 웹 서버가 죽으면?
– 웹 서버로 가는 네트워크가 끊어진다면?
– 웹 서버에 요청하는 client가 너무 많아진다면?
– 웹 서버가 파일을 손실한다면?
– 웹 서버에 요청한 파일의 크기가 항상 매우 크다면?
• 이를 해결할 수 있는 솔루션은
– Petabyte 급의 데이터 셋을 분산시켜 호스팅,
– 조직 간에 대규모 데이터 컴퓨팅 지원,
– 대용량 고화질의 on-demand 혹은 실시간 미디어 스트리밍 지원,
– 대용량의 데이터셋에 대한 versioning과 linking 을 지원,
– 사고로 인한 중요한 파일 손실 문제를 방지
할 수 있어야 한다.
14. Contents
1. IPFS
2. 전통적인 웹 기술
3. 구조 및 특장점
– Architecture Overview
– Naming & Merkle DAG
– Exchange & Routing
– 특장점 정리
4. Application
14
15. IPFS 아키텍처 오버뷰
15
Server PC/cluster
http
Web server
program
Internal
File system
Web
browser
Bitswap or http
Browser
program
IPFS
IPFS
program
Merkle
DAG
IPFS node
client
client
DHT
IPFS
program
Merkle
DAG
IPFS node
DHT
IPFS
program
Merkle
DAG
IPFS node
DHT
IPFS
program
Merkle
DAG
IPFS node
DHT
Location-addressed
“어디”에 가서
“무엇”를 찾아서
보내줘
Content-addressed
“무엇”이 “어디”에
있는지 찾아서
보내줘
16. IPFS 아키텍처 오버뷰
16
• IPFS는 앞서 살펴본 기존의 웹 서비스가 가진 문제를 해결
하기 위한 구조를 갖고있음
– IPFS는 모듈 프로토콜들을 계층화한 구조.
– 각 layer들은 다양한 모듈들을 지원 하며 모듈별로 implementation이
모두 다를 수 있음
– IPFS의 spec은
• 각 layer의 역햘
• 각 layer에서 구현 가능한 implementation
• 각 layer 간에 interface로 나누어 볼 수 있음
• IPFS의 5 layer
– naming - a self-certifying PKI namespace (IPNS)
• “무엇”은 어떻게 정의되는가?
– merkleDAG - data structure format
• “무엇”을 어떻게 저장하는가?
– routing - locating peers and objects
• “무엇”이 “어디”에 있는지 어떻게 아는가?
– exchange - block transport and replication
• “무엇”을 어떻게 교환할 것인가?
– network - establishing connections between peers
• 위의 모든 것들을 위한 모든 연결은 어떻게 수립되는가?
17. IPFS 아키텍처 오버뷰
17
• 들어가기에 앞서
– BitTorrent의 동작과정과 비교
• 그림 출처 및 자세한 구동방식:
https://manhdh.blog.me/220038243469
• IPFS도 이와 유사한 동작 과정을 가짐
naming
exchange
routing
Piece
(= MerkleDAG)
• naming - “무엇”은 어떻게 정의되는가?
• routing - “무엇”이 “어디”에 있는지 어떻게 아는가?
• merkleDAG - “무엇”을 어떻게 저장하는가?
• exchange - “무엇”을 어떻게 교환할 것인가?
• network - 위의 모든 것들을 위한 모든 연결은 어떻게 수립되는가?
Network
- TCP/UDP, …
18. Merkle DAG
18
• IPFS Objects
• Demo
– D1 : https://ipfs.io/ipfs/QmRCJXG7HSmprrYwDrK1GctXHgbV7EYpVcJPQPwevoQuqF)
– D2 : https://youtu.be/pap18o5Ntxw?t=5m26s
• 기타 참고 자료
– https://ipfs.io/ipfs/QmNZiPk974vDsPmQii3YbrMKfi12KTSNM7XMiYyiea4VYZ/example#/ipfs/QmP8WUPq2braGQ8iZjJ6w9di6mzgoTWyRLayrMRjjDoyGr/graph
md/README.md
– https://cnsteem.com/kr/@kblock/8-ipfs-interplanetary-file-system-1-http-web-ipfs-web
demo
├── cat.jpg
└── test
├── bar
├── baz
│ ├── b
│ └── f
└── foo
19. Merkle DAG
19
• IPFS Objects
– IPFS는 기본적으로 IPFS Object를 검색하고 공유하기 위한
P2P 시스템
– IPFS Object 는 두 개의 필드로 이뤄진 자료 구조
• Data—사이즈가 265kB 미만인 unstructured
blob(binary large objects)
• Links—Link structures의 배열. 각 링크들은 다른
IPFS object를 가리킴
– A Link structure는 3개의 필드를 가짐
• Name—링크의 이름
• Hash—링크된 IPFS object 의 해시값
• Size— 링크된 IPFS object를 포함하여 이후 링크된
IPFS object들의 누적 사이즈
– 객체의 ID역할을 하는 hash값은 항상 “Qm”으로 시작
• multihash
– Multihash 결과값의 가장 앞 2byte가 해시 함수와 해시
값의 길이를 명시하고 있는 구조
https://medium.com/@ConsenSys/an-introduction-to-ipfs-9bba4860abd0
20. Merkle DAG
20
• IPFS Objects
Small Files (> 256KB)
• 원본 파일의 내용만을 사용해서 hash 값 생성
• 원본 파일의 이름은 IPFS object에 영향을 주지 않
음
• 원본 데이터는
• binary format으로 data 필드에 저장
• links array 필드는 비어있음
https://medium.com/@ConsenSys/an-introduction-to-ipfs-9bba4860abd0
21. Merkle DAG
21
• IPFS Objects
Large Files (> 256 kB)
• A large file is represented by
• a list of links to file chunks that are < 256 kB, only
minimal Data specifying that this object represents a
large file.
• The links to the file chunks have empty strings as
names.
https://medium.com/@ConsenSys/an-introduction-to-ipfs-9bba4860abd0
22. Merkle DAG
22
• IPFS Objects
Directory
Structures
• The names of the links are the names
of the files and directories.
• automatic deduplication of the file
containing Hello World!n, the data in
this file is only stored in one logical
place in IPFS
• seamlessly follow the directory link names to traverse the file system:
(a) Would first fetch + resolve Qma3qbWDGJc6he3syLUTaRkJD3vAq1k5569tNMbUtjAZjf
(b) Then look into the links of (a), find the hash for my_dir, and resolve it
(c) Then look into the links of (b), find the hash for my_file.txt, and resolve it
https://medium.com/@ConsenSys/an-introduction-to-ipfs-9bba4860abd0
23. Merkle DAG
23
• IPFS Objects
• Git commit Objects
– https://www.git-scm.com/book/en/v2/Git-
Internals-Git-Objects#Commit-Objects
Versioned File Systems on IPFS
https://medium.com/@ConsenSys/an-introduction-to-ipfs-9bba4860abd0
24. Naming
24
• IPFS is mostly concerned with content-addressed data, which by nature is
immutable:
– changing an object would change its hash -- and thus its address, making it
a different object altogether. (Think of it as a copy-on-write filesystem).
• The IPFS naming layer -- or IPNS -- handles the creation of:
– mutable pointers to objects
– human-readable names
25. Routing
25
• Routing
– The IPFS Routing layer serves two important purposes:
• peer routing -- to find other nodes
• content routing -- to find data published to ipfs
– The Routing Sytem is an interface that is satisfied by various kinds of implementations. For
example:
• DHTs: perhaps the most common, DHTs can be used to create a semi-persistent routing record
distributed cache in the network.
• mdns: used to find services advertised locally. mdns (or dnssd) is a local discovery service. We will
be using it.
• snr: supernode routing is a delegated routing system: it delegates to one of a set of supernodes.
This is roughly like federated routing.
• dns: ipfs routing could even happen over dns.
27. Exchange
27
• Exchange
– The IPFS Block Exchange takes care of negotiating bulk data transfers.
– Once nodes know each other -- and are connected -- the exchange protocols govern how
the transfer of content-addressed blocks occurs.
– The Block Exchange is an interface that is satisfied by various kinds of implementations. For
example:
• Bitswap: our main protocol for exchanging data. It is a generalization of BitTorrent to work with
arbitrary (and not known apriori) DAGs.
• HTTP: a simple exchange can be implemented with HTTP clients and servers.
– https://www.netmanias.com/ko/?m=view&id=techdocs&no=10645
• 사이트 가입 후 3, 4번 아티클 참조
28. 특장점 정리
28
• IPFS is a protocol:
– defines a content-addressed file system
– coordinates content delivery
– combines Kademlia + BitTorrent + Git
• IPFS is a filesystem:
– has directories and files
– mountable filesystem (via FUSE)
• IPFS is a web:
– can be used to view documents like the web
– files accessible via HTTP at
https://ipfs.io/<path>
– browsers or extensions can learn to use the
ipfs:// URL or dweb:/ipfs/ URI schemes directly
– hash-addressed content guarantees authenticity
• IPFS is modular:
– connection layer over any network protocol
– routing layer
– uses a routing layer DHT (kademlia/coral)
– uses a path-based naming service
– uses bittorrent-inspired block exchange
• IPFS uses crypto:
– cryptographic-hash content addressing
– block-level deduplication
– file integrity + versioning
– filesystem-level encryption + signing support
• IPFS is p2p:
– worldwide peer-to-peer file transfers
– completely decentralized architecture
– no central point of failure
• IPFS is a cdn:
– add a file to the filesystem locally, and it's now available to
the world
– caching-friendly (content-hash naming)
– bittorrent-based bandwidth distribution
• IPFS has a name service:
– IPNS, an SFS inspired name system
– global namespace based on PKI
– serves to build trust chains
– compatible with other NSes
– can map DNS, .onion, .bit, etc to IPNS
https://github.com/ipfs/ipfs#ipfs-papers
29. Contents
1. IPFS
2. 전통적인 웹 기술
3. 구조 및 특장점
4. Application
– Sharing File & Web
– Infrastructure Of Decentralized App
– Filecoin
– Etc
29
30. Sharing File & Web
• Securely sharing files
– https://medium.com/@mycoralhealth/learn-to-securely-share-files-on-the-blockchain-with-
ipfs-219ee47df54c
30
Simple file Sharing using IPFS Secure file Sharing using IPFS
31. Infrastructure Of Decentralized App
31
https://medium.com/@mycoralhealth/learn-to-securely-share-files-on-the-blockchain-with-ipfs-219ee47df54c
Ethereum DApp
https://www.slideshare.net/BigchainDB/blockchain-beyond-finance-cronos-groep-jan-17-2017
Blockchain Coupled with IPFS
https://medium.com/@ConsenSys/an-introduction-to-ipfs-9bba4860abd0
https://steemit.com/ipfs/@admiboss/simple-decentralized-app-architecture
32. Filecoin
32
• Filecoin: A Decentralized Storage Network
– Filecoin is a decentralized storage network that turns cloud
storage into an algorithmic market
– Filecoin works as an incentive layer on top of IPFS [1],
which can provide storage infrastructure for any data.
– 백서: https://filecoin.io/filecoin.pdf
– 그림 출처 및 참고용 자료: https://coincentral.com/filecoin-
beginners-guide-largest-ever-ico/
33. 기타 application
• Outline the Various Applications of IPFS, with Use Cases and Dependencies
– https://github.com/ipfs/ipfs/issues/230
33