요약
1. Why IPFS ?
왜 IPFS를 써야 되는가 ?
- Blockchain + DIDs (Distribution Identifications) 인증 + IPFS 파일공유 를 통한 콜라보레이션(협업) !!
- 스팀잇 글쓰기 블록사이즈 (65k) 등의 한계를 넘을 수 있음. ( 예시 > d.Tube 등 )
- URL로 손쉽게 파일 공유가 가능
[그림] IPFS로 올려 본 IPFS 로고
주소 : https://ipfs.io/ipfs/QmTDfwTbTkq8k36wPcpAaJWKgUkdmfUFWotWEmKJscHFxE
[그림] IPFS로 올려 본 IPFS 로고
주소 : https://ipfs.io/ipfs/QmZ5GPnQMiAdfKcG6YfxizAavYx7qv7oKJe9u2Vx6G5z9G
커맨드 : curl -F 'image=@/Users/wonsama/Desktop/guidedog.jpg' http://192.168.0.101:5001/api/v0/add
2. 설치 및 사용법
- https://ipfs.io/docs/install/ 다운로드 ( windows, mac, linux 가능 )
- daemon을 기동 => http://localhost:5001:webui - file 탭을 통해 파일 업로드 가능 ( 일반적으로는 cli로 처리 )
3. 맺음말
- 향후에는 IPFS를 통해 다양한 컨텐츠가 공유 될 것이라고 생각 됩니다. 그래서 공부중 ...
- 잘 이해 안되시면 아래쪽 참조글 부터 읽어 보시길 권해 드립니다. ( 케블리 @kblock 최고 !! )
본문시작 !!
IPFS 란 ?
IPFS (InterPlanetary File System)는 모든 컴퓨팅 장치를 동일한 파일 시스템으로 연결하려고 하는 P2P 분산 파일 시스템입니다.
설치
- ( ubuntu 16.04 기준으로 작성 )
- https://dist.ipfs.io/go-ipfs/ 에 접속하여 최신 버전 정보 확인
sudo apt-get update
sudo apt-get install golang-go -y
wget https://dist.ipfs.io/go-ipfs/v0.4.15/go-ipfs_v0.4.15_linux-386.tar.gz
tar xvfz go-ipfs_v0.4.15_linux-386.tar.gz
sudo mv go-ipfs/ipfs /usr/local/bin/ipfs
설치 스크립트 / 위와 같이 설치 이후, 기존 tar와 폴더는 제거해도 무관
설치경로 설정
- 기본적으로는 저장소가 ~/.ipfs 에 기록된다.
- 변경하기 위해서는 환경 변수값(
IPFS_PATH
)을 추가 설정하면 됨.
echo 'export IPFS_PATH=/blockchain/.ipfs' >> ~/.profile
source ~/.profile
ipfs 설치 관련 환경변수 설정
설치 초기화
ipfs init
을 하면 위에서 설정한IPFS_PATH
폴더에 관련 파일이 생성된다.
ipfs init
[결과]
initializing IPFS node at /home/bc/dev/.ipfs
generating 2048-bit RSA keypair...done
peer identity: QmUGWEmvqir1NGWm2QiokuurbBRG6CksXFhPrD87SS3Zz2
to get started, enter:
ipfs cat /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/readme
설치 결과
ipfs cat /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/readme
Hello and Welcome to IPFS!
██╗██████╗ ███████╗███████╗
██║██╔══██╗██╔════╝██╔════╝
██║██████╔╝█████╗ ███████╗
██║██╔═══╝ ██╔══╝ ╚════██║
██║██║ ██║ ███████║
╚═╝╚═╝ ╚═╝ ╚══════╝
If you're seeing this, you have successfully installed
IPFS and are now interfacing with the ipfs merkledag!
-------------------------------------------------------
| Warning: |
| This is alpha software. Use at your own discretion! |
| Much is missing or lacking polish. There are bugs. |
| Not yet secure. Read the security notes for more. |
-------------------------------------------------------
Check out some of the other files in this directory:
./about
./help
./quick-start <-- usage examples
./readme <-- this file
./security-notes
위와 같이
ipfs cat ...
명령어를 입력하면 ipfs에 존재하는 readme 파일 정보를 읽어 볼 수 있다.
ipfs cat /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/quick-start
예시) quick-start 파일 보기
ipfs 파일 추가
$ ipfs add sample
[결과]
added QmeomffUNfmQy76CQGy9NdmqEnnHU9soCexBnGU3ezPHVH sample
샘플 파일 추가
참고로 파일은 1일이 지나면 ipfs 네트워크 상에서 지워집니다(가비지컬렉팅), 그래서 파일을 영속적으로 유지하고자 하려면 파일 추가 시 -pin 옵션을 로 설정된 파일(add 시 기본적으로 true임)이 네트워크 상에 존재해야 됩니다.(즉 파일이 pinned되어진 채로 daemon이 기동되어 있어야 파일이 유지됨)
ipfs 파일 감싸기
$ ipfs add wow.txt
added QmTppEckQeay4RZ5meNCSsUYbNDwVdYtd1FNz5vqRb3pap wow.txt
[web] 파일명 및 확장자 확인 불가
https://ipfs.io/ipfs/QmTppEckQeay4RZ5meNCSsUYbNDwVdYtd1FNz5vqRb3pap
$ ipfs add wow.txt -w
added QmTppEckQeay4RZ5meNCSsUYbNDwVdYtd1FNz5vqRb3pap wow.txt
added QmXKfsf2UKnLTnmaf87zerTeTT4DUrL6ZYg9pFeE6BvNPY
[web] 폴더로 감싸줘서 확인 가능
https://ipfs.io/ipfs/QmXKfsf2UKnLTnmaf87zerTeTT4DUrL6ZYg9pFeE6BvNPY/wow.txt
-w 옵션으로 파일을 감싸주면 손쉽게 파일의 정보를 확인할 수 있다.
ipfs 데몬 시작
- 데몬 등록 이후
http://localhost:5001/webui
페이지를 통해 webui를 통해 손쉽게 작업 수행 가능 - 본인의 PC IP주소가 192.168.0.xxx 등과 같은 내부망인 경우 반드시 port forwarding (4001) 또는 dmz 설정을 해야 외부망으로 등록이 가능해 진다. 그래야지만 https://ipfs.io 사이트 등에서 정상적으로 파일 다운로드가 가능해짐. (
Swarm announcing
정보 참조)
$ ipfs daemon
Initializing daemon...
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip4/192.168.0.11/tcp/4001
Swarm listening on /ip6/::1/tcp/4001
Swarm listening on /p2p-circuit/ipfs/QmdBS7g6pKF4S3pcrq8fm4e4NYNTBn6WaPAjTMxJmo7Ag5
Swarm announcing /ip4/127.0.0.1/tcp/4001
Swarm announcing /ip4/192.168.0.11/tcp/4001
Swarm announcing /ip6/::1/tcp/4001
API server listening on /ip4/127.0.0.1/tcp/5001
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Daemon is ready
ipfs에 파일 등록을 위한 데몬 기동
참조) 일반적으로
$ nohup ipfs daemon &
과 같이 background로 기동함.
ipfs 파일보기
http://localhost:8080/ipfs/[HASH_VALUE]
L 로컬에서만 됨 !! (빠름)
http://localhost:5001/webui
L 업로드 된 파일 목록 정보를 손쉽게 조회 할 수 있음
https://ipfs.io/ipfs/[HASH_VALUE]
L 웹에서 볼 수도 있음 !! (느림)
ipfs 데몬 종료
$ ipfs shutdown
기동중인 ipfs daemon을 종료 시킬 때 사용한다
관련링크
MAIN
참조 한글
[케블리] #8. IPFS(InterPlanetary File System)이해하기 1부 : HTTP Web을 넘어서, IPFS Web으로
[케블리]#27. IPFS(InterPlanetary File System)이해하기 2부 / IPFS와 블록체인, 그리고 파일코인(Filecoin)
[케블리]#36. IPFS(InterPlanetary File System)이해하기 3부 / IPFS와 SWARM
REFRENCE
버그 (ipfs version 0.4.15)
ipfs-update
동작하지 않음ipfs mount
이상동작 : /ipns 정상마운팅 /ipfs 비정상 마운팅 => 파일을 볼 수 없음 -_-;
백서들 보면 데이터저장은 IPFS에 한다고 하던데...새로운 세계를 또 알아가네요^^
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
파일 무결성은 보장되겠죠?ㅋ
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
파일 업로드 시 파일 기준으로 생성된 hash 을 가지고 주소를 생성하기 때문에 파일의 무결성을 보장합니다.
hash 값이 동일 할 확률은 로또를 연속으로 몇번 맞아야 될 확률일 것이에요 ... ^^
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
역시 모든확률은 로또로 시작하는군요.ㅋㅋㅋㅋ
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
아마존 서버에서 해봐야겠네요 ㅎㅎ
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
ipfs 뉴비입니다 ㅎㅎ 가이드를 보고 진행을 해보는 중입니다.
ipfs add <hash> 와 같이 제 노드(?)에 등록은 되어서 ipfs get <hash>와 같이 해당 파일을 다시 다운로드 하는것까지는 확인했는데요,
다른 노드에 저장되어 있는 파일들도 같은 명령으로 받을수 있는지요?
다른 노드들에 있는 hash들로 받아보려 시도했었는데 아무런 반응이 없더라구요...
웹 주소를 통해서는 접근이 가능하고 다운로드도 가능했습니다만,
ipfs get 명령이 제대로 못쓴것인지 동작을 안하는것 같습니다.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit