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/transfer-files/README.md
+77-20Lines changed: 77 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ TODO: Insert final screenshot here
51
51
52
52
## Step-by-step instructions
53
53
54
-
**Instructions:**
54
+
Here's what we are going to be doing, today:
55
55
56
56
-1. Set up, install a go-ipfs node in your machine
57
57
-2. Make your daemons listen on WebSockets
@@ -62,37 +62,85 @@ TODO: Insert final screenshot here
62
62
-7. Dial to a node using WebSockets (your Desktop ones)
63
63
-8. Transfer files between all of your nodes, have fun!
64
64
65
+
Let's go.
65
66
66
-
-------------------------
67
-
> Steps need to be updated once the final thing is finished
67
+
### 1. Set up
68
68
69
-
### Start a go-ipfs daemon
69
+
You'll need to have an implementation of IPFS running on your machine. Currently, this means either go-ipfs or js-ipfs.
70
70
71
-
1. Install go-ipfs from master (TODO: link).
71
+
Installing go-ipfs can be done by installing the binary [here](https://ipfs.io/ipns/dist.ipfs.io/#go-ipfs). Alternatively, you could follow the instructions in the README at [ipfs/go-ipfs](https://github.com/ipfs/go-ipfs).
72
72
73
-
2. Run `ipfs init`
73
+
Installing js-ipfs requires you to have node and [npm](https://www.npmjs.com). Then, you simply run:
74
74
75
-
3. Edit your IPFS config file, located at `~/.ipfs/config`
75
+
```sh
76
+
> npm install --global ipfs
77
+
...
78
+
> jsipfs --help
79
+
Commands:
80
+
...
81
+
```
82
+
83
+
This will alias `jsipfs` on your machine; this is to avoid issues with `go-ipfs` being called `ipfs`.
84
+
85
+
At this point, you have either js-ipfs or go-ipfs running. Now, initialize it:
86
+
87
+
```
88
+
> ipfs init
89
+
```
90
+
91
+
or
76
92
77
-
4. Add a Websocket listener address to `Addresses.Swarm`. It should look like this after editing:
78
93
```
79
-
"Addresses": {
80
-
"API": "/ip4/127.0.0.1/tcp/5001",
81
-
"Gateway": "/ip4/0.0.0.0/tcp/8080",
82
-
"Swarm": [
83
-
"/ip4/0.0.0.0/tcp/4001",
84
-
"/ip4/0.0.0.0/tcp/9999/ws"
85
-
]
86
-
},
94
+
> jsipfs init
87
95
```
88
96
89
-
5. Start the go-ipfs daemon with:
97
+
This will set up an `init` file in your home directory.
98
+
99
+
### 2. Make your daemons listen on WebSockets
100
+
101
+
At this point, you need to edit your `config` file, the one you just set up with `{js}ipfs init`. It should be in either `~/.jsipfs/config` or `~/.ipfs/config`, depending on whether you're using JS or Go. You can run `cat ~/.jsipfs/config` to see the contents of the JSON file.
102
+
103
+
Since websockets are currently not stable and are experimental, you'll need to add the ability for your daemon to listen on Websocket addresses. Look into your init file (using `cat`) and find the `Addresses` block:
104
+
105
+
```json
106
+
"Addresses": {
107
+
"Swarm": [
108
+
"/ip4/0.0.0.0/tcp/4002"
109
+
],
110
+
"API": "/ip4/127.0.0.1/tcp/5002",
111
+
"Gateway": "/ip4/127.0.0.1/tcp/9090"
112
+
}
90
113
```
91
-
ipfs daemon
114
+
115
+
To make Websockets work, open up the `config` file and add the following entry to your `Swarm` array: `/ip4/0.0.0.0/tcp/9999/ws`. Now, it should look like this:
116
+
117
+
118
+
```json
119
+
"Addresses": {
120
+
"Swarm": [
121
+
"/ip4/0.0.0.0/tcp/4002",
122
+
"/ip4/0.0.0.0/tcp/9999/ws"
123
+
],
124
+
"API": "/ip4/127.0.0.1/tcp/5002",
125
+
"Gateway": "/ip4/127.0.0.1/tcp/9090"
126
+
}
92
127
```
93
128
94
-
6. You should see the Websocket address in the output:
129
+
Now it should listen on Websockets. We're ready to...
130
+
131
+
### 3. Start the WebApp project
132
+
133
+
Ok. To do this, we'll need to start an IPFS daemon.
134
+
135
+
```sh
136
+
> ipfs daemon
95
137
```
138
+
139
+
(Again, either `jsipfs` or `ipfs` works. I'll stop explaining that from here on out.)
140
+
141
+
You should see the Websocket address in the output:
142
+
143
+
```sh
96
144
Initializing daemon...
97
145
Swarm listening on /ip4/127.0.0.1/tcp/4001
98
146
Swarm listening on /ip4/127.0.0.1/tcp/9999/ws
@@ -103,7 +151,16 @@ Gateway (readonly) server listening on /ip4/0.0.0.0/tcp/8080
103
151
Daemon is ready
104
152
```
105
153
106
-
If you see address like `Swarm listening on /ip4/127.0.0.1/tcp/9999/ws`, it means all good!
154
+
It's there in line 5 - see the `/ws`? Good. that means it is listening.
155
+
156
+
157
+
### 4. Create the frame for your IPFS enabled app
158
+
### 5. Add and cat a file
159
+
### 6. Use WebRTC to dial between browser nodes
160
+
### 7. Dial to a node using WebSockets (your Desktop ones)
161
+
### 8. Transfer files between all of your nodes, have fun!
0 commit comments