You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: examples/ipfm/README.md
+126-4
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,130 @@
2
2
3
3
**WIP**
4
4
5
+
InterPlanetary File Exchange enables you to share files with others via IPFS.
6
+
7
+
IPFE was built to demonstrate interoperability between the go-ipfs and js-ipfs (browser and Node.js) instances.
8
+
9
+
## Requirements
10
+
11
+
- Node.js >= v4.x
12
+
- Npm >= v3.x
13
+
14
+
## Step-by-step Instructions
15
+
16
+
### Start a go-ipfs daemon
17
+
18
+
1. Install go-ipfs from master (TODO: link).
19
+
20
+
2. Run `ipfs init`
21
+
22
+
3. Edit your IPFS config file, located at `~/.ipfs/config`
23
+
24
+
4. Add a Websocket listener address to `Addresses.Swarm`. It should look like this after editing:
25
+
```
26
+
"Addresses": {
27
+
"API": "/ip4/127.0.0.1/tcp/5001",
28
+
"Gateway": "/ip4/0.0.0.0/tcp/8080",
29
+
"Swarm": [
30
+
"/ip4/0.0.0.0/tcp/4001",
31
+
"/ip4/0.0.0.0/tcp/9999/ws"
32
+
]
33
+
},
34
+
```
35
+
36
+
5. Start the go-ipfs daemon with:
37
+
```
38
+
ipfs daemon
39
+
```
40
+
41
+
6. You should see the Websocket address in the output:
42
+
```
43
+
Initializing daemon...
44
+
Swarm listening on /ip4/127.0.0.1/tcp/4001
45
+
Swarm listening on /ip4/127.0.0.1/tcp/9999/ws
46
+
Swarm listening on /ip4/192.168.10.38/tcp/4001
47
+
Swarm listening on /ip4/192.168.10.38/tcp/9999/ws
48
+
API server listening on /ip4/127.0.0.1/tcp/5001
49
+
Gateway (readonly) server listening on /ip4/0.0.0.0/tcp/8080
50
+
Daemon is ready
51
+
```
52
+
53
+
If you see address like `Swarm listening on /ip4/127.0.0.1/tcp/9999/ws`, it means all good!
54
+
55
+
### Start an InterPlanetary File Exchange daemon
56
+
57
+
1. Install the project's dependencies:
58
+
```
59
+
npm install
60
+
```
61
+
62
+
2. Start the browser app with:
63
+
```
64
+
npm start
65
+
```
66
+
67
+
This will open the app in your browser at http://localhost:3000/.
68
+
69
+
3. In the browser app, open a file exchange feed url, eg. http://localhost:3000/hello-world.
70
+
71
+
4. Start the Node.js ipfe-daemon with:
72
+
```
73
+
node ipfe-daemon hello-world
74
+
```
75
+
76
+
The first argument after `ipfe-daemon` is the name of the file exchange feed.
77
+
78
+
5. In the browser app, open the Peers view by clicking on "Searching for peers..." or "1 peer". You will see which peers you're connected to.
79
+
80
+
6. Now go back to the terminal and find the Websocket multiaddress of your go-ipfs daemon by running:
81
+
```
82
+
ipfs id
83
+
```
84
+
85
+
This will output all the address your go-ipfs daemon is listening at. Find the one with `ws` in it, and the port you added to the go-ipfs configuration file. It looks something like this:
7. Copy the address and paste it into the "Connect" input field in the browser app and press "Connect".
91
+
92
+
8. You should now see the two IPFS instances connected. You can verify it by observing the Peer view in the browser app and running the following command in the terminal:
93
+
```
94
+
ipfs swarm peers
95
+
```
96
+
97
+
### Add files to InterPlanetary File Exchange
98
+
99
+
1. Add a file by running:
100
+
```
101
+
node ipfe-add hello-world ipfe-add.js
102
+
```
103
+
104
+
You should see the following output:
105
+
```
106
+
Starting...
107
+
Swarm listening on /libp2p-webrtc-star/ip4/127.0.0.1/tcp/9090/ws/ipfs/QmYRSN9BdRU5oYM1ryAWF518ogv8SkwZyux4aEWpxoaYZA
Note that the multihash at the end of the swarm address will be different.
118
+
119
+
6. Once you see the output above, it means the file was added successfully!
120
+
121
+
7. Now go back to the browser app and observe the file in the list of files.
122
+
123
+
8. Click the file to open it.
124
+
125
+
9. You have successfully added a file in go-ipfs and downloaded it to the browser.
126
+
127
+
You can also add files to the browser app by dragging and dropping them. Once you do so, you should see the updated file list in the terminal running `ipfe-daemon`.
128
+
5
129
## Dev & Run
6
130
```
7
131
npm install
@@ -12,12 +136,10 @@ See `package.json` for more dev scripts.
12
136
13
137
## Tutorial
14
138
139
+
**TODO**
140
+
15
141
This project was bootstrapped with [Create React App](https://github.com./facebookincubator/create-react-app).
0 commit comments