왜 IPFS를 써야 되는가 ?
[그림] 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
IPFS (InterPlanetary File System)는 모든 컴퓨팅 장치를 동일한 파일 시스템으로 연결하려고 하는 P2P 분산 파일 시스템입니다.

[그림2] IPFS Skill Stack
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_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 add sample
[결과]
added QmeomffUNfmQy76CQGy9NdmqEnnHU9soCexBnGU3ezPHVH sample
샘플 파일 추가
참고로 파일은 1일이 지나면 ipfs 네트워크 상에서 지워집니다(가비지컬렉팅), 그래서 파일을 영속적으로 유지하고자 하려면 파일 추가 시 -pin 옵션을 로 설정된 파일(add 시 기본적으로 true임)이 네트워크 상에 존재해야 됩니다.(즉 파일이 pinned되어진 채로 daemon이 기동되어 있어야 파일이 유지됨)
$ 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 옵션으로 파일을 감싸주면 손쉽게 파일의 정보를 확인할 수 있다.
http://localhost:5001/webui 페이지를 통해 webui를 통해 손쉽게 작업 수행 가능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로 기동함.
http://localhost:8080/ipfs/[HASH_VALUE]
L 로컬에서만 됨 !! (빠름)
http://localhost:5001/webui
L 업로드 된 파일 목록 정보를 손쉽게 조회 할 수 있음
https://ipfs.io/ipfs/[HASH_VALUE]
L 웹에서 볼 수도 있음 !! (느림)
$ 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-update 동작하지 않음ipfs mount 이상동작 : /ipns 정상마운팅 /ipfs 비정상 마운팅 => 파일을 볼 수 없음 -_-;