Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 8c883de

Browse files
authored
Merge branch 'master' into feat/add-bootstrapers-through-dns
2 parents efaf1d9 + 1c12f46 commit 8c883de

File tree

215 files changed

+2361
-1381
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+2361
-1381
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,12 @@ The HTTP-API exposed by the js-ipfs daemon follows the [`http-api-spec`](https:/
200200
const repo = <IPFS Repo instance or repo path>
201201

202202
// Create the IPFS node instance
203-
const node = new IPFS(repo)
203+
const node = new IPFS({
204+
repo: repo,
205+
EXPERIMENTAL: {
206+
pubsub: false
207+
}
208+
})
204209

205210
// We need to init our repo, in this case the repo was empty
206211
// We are picking 2048 bits for the RSA key that will be our PeerId

RELEASE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Release checklist
2+
3+
> List of actions to perform before issuing a new js-ipfs release
4+
5+
- Robustness and quality
6+
- [ ] Ensure that all tests are passing, this includes:
7+
- [ ] unit
8+
- [ ] interop
9+
- [ ] sharness
10+
- [ ] Run tests of the following projects with the new release:
11+
- [ ] orbitdb
12+
- [ ] orbit-core
13+
- [ ] ipfs-log
14+
- Documentation
15+
- [ ] Ensure that README.md is up to date
16+
- [ ] Ensure that all the examples run
17+
- Communication
18+
- [ ] Create the release issue
19+
- [ ] Announcements (both pre-release and post-release)
20+
- [ ] Twitter
21+
- [ ] IRC

ci/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FROM quay.io/ipfs/js-base:6.9.4

ci/jenkins

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
javascript

examples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ Let us know if you find any issue or if you want to contribute and add a new tut
99
- [js-ipfs basic, how to spawn a node and add a file to IPFS](/examples)
1010
- [How to bundle js-ipfs with Browserify](/bundle-browserify)
1111
- [How to bundle js-ipfs with WebPack](/bundle-webpack)
12+
- [Use IPFS to explore the Ethereum BlockChain](/explore-ethereum)
1213

1314
## Tutorials

examples/basics/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ const IPFS = require('../../src/core')
1212
/*
1313
* Create a new IPFS instance, using default repo (fs) on default path (~/.ipfs)
1414
*/
15-
const node = new IPFS(path.join(os.tmpDir() + '/' + new Date().toString()))
15+
const node = new IPFS({
16+
repo: path.join(os.tmpdir() + '/' + new Date().toString()),
17+
EXPERIMENTAL: {
18+
pubsub: false
19+
}
20+
})
1621

1722
const fileToAdd = {
1823
path: 'hello.txt',

examples/bundle-browserify/package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,15 @@
44
"description": "Bundle js-ipfs with Browserify",
55
"main": "index.js",
66
"scripts": {
7-
"bundle": "browserify src/index.js > public/bundle.js",
7+
"bundle": "browserify src/index.js --require browserify-zlib-next:zlib > public/bundle.js",
88
"serve": "http-server public -a 127.0.0.1 -p 8888",
99
"start": "npm run bundle && npm run serve"
1010
},
11-
"browser": {
12-
"zlib": "browserify-zlib-next"
13-
},
1411
"keywords": [],
1512
"license": "MIT",
1613
"devDependencies": {
17-
"browserify": "^13.1.1",
18-
"concat-stream": "^1.5.2",
14+
"browserify": "^14.0.0",
15+
"concat-stream": "^1.6.0",
1916
"http-server": "^0.9.0",
2017
"browserify-zlib-next": "^1.0.1"
2118
},

examples/bundle-browserify/src/index.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
'use strict'
22

3-
var IPFS = require('../../../src/core') // replace this by line below
3+
const concat = require('concat-stream')
4+
const IPFS = require('../../../src/core') // replace this by line below
45
// var IPFS = require('ipfs')
56

67
// Create the IPFS node instance
78
// for simplicity, we create a new repo everytime the node
89
// is created, because you can't init already existing repos
910
const repoPath = String(Math.random())
10-
const node = new IPFS(repoPath)
11-
const concat = require('concat-stream')
11+
12+
const node = new IPFS({
13+
repo: repoPath,
14+
EXPERIMENTAL: {
15+
pubsub: false
16+
}
17+
})
18+
19+
// expose the node to the window, for the fun!
20+
window.ipfs = node
1221

1322
node.init({ emptyRepo: true, bits: 2048 }, function (err) {
1423
if (err) {

examples/bundle-webpack/src/components/app.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ class App extends React.Component {
2929
// for simplicity, we create a new repo everytime the node
3030
// is created, because you can't init already existing repos
3131
const repoPath = String(Math.random())
32-
node = new IPFS(repoPath)
32+
node = new IPFS({
33+
repo: repoPath,
34+
EXPERIMENTAL: {
35+
pubsub: false
36+
}
37+
})
3338

3439
node.init({ emptyRepo: true, bits: 2048 }, function (err) {
3540
if (err) {

examples/explore-ethereum/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Resolve the ethereum blockchain through IPFS
2+
3+
> This is a pre-example to a full Ethereum to IPFS bridge. It shows how to resolve Ethereum hashes through the IPFS DAG get API.
4+
5+
## Set up
6+
7+
Make sure to have the latest js-ipfs installed by doing
8+
9+
```sh
10+
> npm install ipfs -g
11+
```
12+
13+
If this is the first time you use js-ipfs, make sure to init your repo with
14+
15+
```sh
16+
> jsipfs init
17+
```
18+
19+
## Load ethereum chain data into ipfs
20+
21+
We've some ethereum blocks available at [eth-stuffs](/eth-stuffs) folder, you can add them to ipfs by running:
22+
23+
```sh
24+
> ./load-eth-stuffs.sh
25+
z43AaGEvwdfzjrCZ3Sq7DKxdDHrwoaPQDtqF4jfdkNEVTiqGVFW
26+
z43AaGEywSDX5PUJcrn5GfZmb6FjisJyR7uahhWPk456f7k7LDA
27+
z43AaGF42R2DXsU65bNnHRCypLPr9sg6D7CUws5raiqATVaB1jj
28+
z45oqTS2AQ9SgyVa31LRGZgfibtdoPvP2miMNaXbDLLgD9MdAAr
29+
z45oqTS8wZaNGU2eepKHRbXvmV93cKQbiL241RB3bRtMYZP8hNm
30+
z45oqTS8wZaNGU2eepKHRbXvmV93cKQbiL241RB3bRtMYZP8hNm
31+
z45oqTS4E1GeJujnKVJG3xSVnS64A8mMCWhKSkCWACNCeD95mtQ
32+
z45oqTS4MnurEeEaanvFieeJDNHH3jGNk9NJEiyrwXwYQSWfxUB
33+
z45oqTRwExySeMeivsU1Y9UdzWDp2mx71TtQhmTGzRaXCcsNujj
34+
z45oqTRzb9a5xyvx5RbfSXH1K5jibyZ4AxnXyYReuLw7KU5veYw
35+
```
36+
37+
## Explore these blocks using the DAG api
38+
39+
Some examples
40+
41+
```sh
42+
> jsipfs dag get z43AaGEvwdfzjrCZ3Sq7DKxdDHrwoaPQDtqF4jfdkNEVTiqGVFW/
43+
> jsipfs dag get z43AaGEvwdfzjrCZ3Sq7DKxdDHrwoaPQDtqF4jfdkNEVTiqGVFW/parentHash
44+
...
45+
```
530 Bytes
Binary file not shown.
530 Bytes
Binary file not shown.
527 Bytes
Binary file not shown.
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
�Q��������p����'�(�Eׅ=X�5�msi���(�0oE�]߀����k�^<|a�P����ް��u��.iK�j�-�����
Binary file not shown.
Binary file not shown.
Binary file not shown.
532 Bytes
Binary file not shown.

examples/explore-ethereum/eth-stuffs/state_r_302516

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
��'��^�9pe4����\�f��ʳ7�56�������|���̾����0ۃ�8��oTȖ}ʊf�C�Ϡc�?�B�ɣ-B!^N�1nǺ�n�nR���[��~۠YQ��f��̞Pa���#f�՝g����R��|�����X���72a���Q2ڱ����$��ť��a�,����`�F1�?Qm��3#{fM �(�wg����ޜw�G�2�?���?xN@��#�(�*(5����h1�������N\�#��U�ಚ�r��h�UqT9|��>�"��Iw����4���n3�.��R�I���I�~&V� ��$���Y��3Oʦr��^�hޕ��\i/kq�u1��U�uZ�*H9���7�^4��٪��zϿش�����Y����r���`;O'��µ��N�Y1͗w��'�2��ߠ2J?Z�V������1yF1�r66#�u��7/.����ktI2.N��8U�e����k y���|G����V�w�;Tk��g���I;���+�k��'Hiq��
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Blocks
2+
jsipfs block put --format=eth-block --mhtype=keccak-256 eth-stuffs/block_302515
3+
jsipfs block put --format=eth-block --mhtype=keccak-256 eth-stuffs/block_302516
4+
jsipfs block put --format=eth-block --mhtype=keccak-256 eth-stuffs/block_302517
5+
6+
# State Trie
7+
jsipfs block put --format=eth-state-trie --mhtype=keccak-256 eth-stuffs/state_000017_302516
8+
jsipfs block put --format=eth-state-trie --mhtype=keccak-256 eth-stuffs/state_00001_302516
9+
jsipfs block put --format=eth-state-trie --mhtype=keccak-256 eth-stuffs/state_00001_302516
10+
jsipfs block put --format=eth-state-trie --mhtype=keccak-256 eth-stuffs/state_000_302516
11+
jsipfs block put --format=eth-state-trie --mhtype=keccak-256 eth-stuffs/state_00_302516
12+
jsipfs block put --format=eth-state-trie --mhtype=keccak-256 eth-stuffs/state_0_302516
13+
jsipfs block put --format=eth-state-trie --mhtype=keccak-256 eth-stuffs/state_r_302516

gulpfile.js

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,70 @@
33
const gulp = require('gulp')
44
const parallel = require('async/parallel')
55
const series = require('async/series')
6-
const createTempNode = require('./test/utils/temp-node')
7-
const API = require('./src/http-api')
6+
const createTempRepo = require('./test/utils/create-repo-node.js')
7+
const IPFS = require('./src/core')
8+
const HTTPAPI = require('./src/http-api')
9+
const leftPad = require('left-pad')
810

911
let nodes = []
1012

11-
function startNode (num, done) {
12-
createTempNode(num, (err, node) => {
13-
if (err) {
14-
return done(err)
15-
}
13+
/*
14+
* spawns a daemon with ports numbers starting in 10 and ending in `num`
15+
*/
16+
function spawnDaemon (num, callback) {
17+
num = leftPad(num, 3, 0)
18+
19+
const repo = createTempRepo()
1620

17-
const api = new API(node.repo.path())
18-
nodes.push(api)
19-
api.start(done)
21+
const node = new IPFS({
22+
repo: repo,
23+
EXPERIMENTAL: {
24+
pubsub: true
25+
}
2026
})
27+
28+
series([
29+
(cb) => node.init({ emptyRepo: true, bits: 1024 }, cb),
30+
(cb) => {
31+
repo.config.get((err, config) => {
32+
if (err) { return callback(err) }
33+
34+
config.Addresses = {
35+
Swarm: [
36+
`/ip4/127.0.0.1/tcp/10${num}`,
37+
`/ip4/127.0.0.1/tcp/20${num}/ws`
38+
],
39+
API: `/ip4/127.0.0.1/tcp/31${num}`,
40+
Gateway: `/ip4/127.0.0.1/tcp/32${num}`
41+
}
42+
43+
config.Discovery.MDNS.Enabled = false
44+
45+
repo.config.set(config, cb)
46+
})
47+
},
48+
(cb) => node.load(cb),
49+
(cb) => {
50+
const daemon = new HTTPAPI(node.repo.path())
51+
nodes.push(daemon)
52+
daemon.start(cb)
53+
}
54+
], callback)
2155
}
2256

2357
gulp.task('libnode:start', (done) => {
2458
nodes = []
2559
parallel([
26-
(cb) => startNode(7, cb),
27-
(cb) => startNode(8, cb),
28-
(cb) => startNode(12, cb),
29-
(cb) => startNode(13, cb)
60+
(cb) => spawnDaemon(7, cb),
61+
(cb) => spawnDaemon(8, cb),
62+
(cb) => spawnDaemon(12, cb),
63+
(cb) => spawnDaemon(13, cb)
3064
], done)
3165
})
3266

3367
gulp.task('libnode:stop', (done) => {
3468
series(nodes.map((node) => (cb) => {
35-
setTimeout(() => node.stop(cb), 500)
69+
setTimeout(() => node.stop(cb), 200)
3670
}), done)
3771
})
3872

package.json

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ipfs",
3-
"version": "0.21.6",
3+
"version": "0.21.8",
44
"description": "JavaScript implementation of the IPFS specification",
55
"bin": {
66
"jsipfs": "src/cli/bin.js"
@@ -24,6 +24,8 @@
2424
"lint": "aegir-lint",
2525
"coverage": "gulp coverage",
2626
"test": "gulp test",
27+
"test:node": "npm run test:unit:node",
28+
"test:browser": "npm run test:unit:browser",
2729
"test:unit:node": "gulp test:node",
2830
"test:unit:node:core": "TEST=core npm run test:unit:node",
2931
"test:unit:node:http": "TEST=http npm run test:unit:node",
@@ -61,19 +63,20 @@
6163
},
6264
"homepage": "https://github.com/ipfs/js-ipfs#readme",
6365
"devDependencies": {
64-
"aegir": "^9.4.0",
66+
"aegir": "^10.0.0",
6567
"buffer-loader": "0.0.1",
6668
"chai": "^3.5.0",
6769
"delay": "^1.3.1",
6870
"detect-node": "^2.0.3",
71+
"dir-compare": "^1.3.0",
6972
"eslint-plugin-react": "^6.9.0",
7073
"execa": "^0.6.0",
7174
"expose-loader": "^0.7.1",
7275
"form-data": "^2.1.2",
73-
"fs-pull-blob-store": "^0.4.1",
76+
"fs-pull-blob-store": "~0.4.1",
7477
"gulp": "^3.9.1",
75-
"interface-ipfs-core": "^0.23.5",
76-
"ipfsd-ctl": "^0.18.1",
78+
"interface-ipfs-core": "~0.24.1",
79+
"ipfsd-ctl": "~0.18.3",
7780
"left-pad": "^1.1.3",
7881
"lodash": "^4.17.4",
7982
"mocha": "^3.2.0",
@@ -89,40 +92,41 @@
8992
"async": "^2.1.4",
9093
"bl": "^1.2.0",
9194
"boom": "^4.2.0",
92-
"debug": "^2.6.0",
93-
"fs-pull-blob-store": "^0.3.0",
95+
"debug": "^2.6.1",
96+
"fs-pull-blob-store": "~0.3.0",
9497
"glob": "^7.1.1",
9598
"hapi": "^16.1.0",
9699
"hapi-set-header": "^1.0.2",
97100
"hoek": "^4.1.0",
98-
"idb-pull-blob-store": "^0.5.1",
99-
"ipfs-api": "^12.1.4",
100-
"ipfs-bitswap": "^0.9.2",
101-
"ipfs-block": "^0.5.4",
102-
"ipfs-block-service": "^0.8.1",
103-
"ipfs-multipart": "^0.1.0",
104-
"ipfs-repo": "^0.11.2",
105-
"ipfs-unixfs": "^0.1.9",
106-
"ipfs-unixfs-engine": "^0.15.1",
107-
"ipld-resolver": "^0.4.2",
101+
"idb-pull-blob-store": "~0.5.1",
102+
"ipfs-api": "^12.1.7",
103+
"ipfs-bitswap": "~0.9.3",
104+
"ipfs-block": "~0.5.5",
105+
"ipfs-block-service": "~0.8.3",
106+
"ipfs-multipart": "~0.1.0",
107+
"ipfs-repo": "~0.11.3",
108+
"ipfs-unixfs": "~0.1.10",
109+
"ipfs-unixfs-engine": "~0.17.0",
110+
"ipld-resolver": "~0.8.1",
108111
"isstream": "^0.1.2",
109-
"libp2p-floodsub": "0.7.1",
110-
"joi": "^10.2.0",
111-
"libp2p-ipfs-nodejs": "^0.17.9",
112-
"libp2p-ipfs-browser": "^0.17.8",
112+
"joi": "^10.2.2",
113+
"libp2p-floodsub": "~0.7.3",
114+
"libp2p-ipfs-browser": "~0.18.2",
115+
"libp2p-ipfs-nodejs": "~0.18.1",
113116
"lodash.flatmap": "^4.5.0",
114117
"lodash.get": "^4.4.2",
115118
"lodash.has": "^4.5.2",
116119
"lodash.set": "^4.3.2",
117120
"lodash.sortby": "^4.7.0",
118121
"lodash.values": "^4.3.0",
119122
"mafmt": "^2.1.6",
120-
"multiaddr": "^2.2.0",
121-
"multihashes": "^0.3.2",
123+
"mkdirp": "^0.5.1",
124+
"multiaddr": "^2.2.1",
125+
"multihashes": "~0.3.3",
122126
"path-exists": "^3.0.0",
123-
"peer-book": "^0.3.0",
124-
"peer-id": "^0.8.1",
125-
"peer-info": "^0.8.2",
127+
"peer-book": "~0.3.1",
128+
"peer-id": "~0.8.2",
129+
"peer-info": "~0.8.3",
126130
"promisify-es6": "^1.0.2",
127131
"pull-file": "^1.0.0",
128132
"pull-paramap": "^1.2.1",
@@ -171,4 +175,4 @@
171175
"nginnever <[email protected]>",
172176
"npmcdn-to-unpkg-bot <[email protected]>"
173177
]
174-
}
178+
}

0 commit comments

Comments
 (0)