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

Commit

Permalink
Merge branch 'master' into feat/add-bootstrapers-through-dns
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias authored Feb 13, 2017
2 parents efaf1d9 + 1c12f46 commit 8c883de
Show file tree
Hide file tree
Showing 215 changed files with 2,361 additions and 1,381 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,12 @@ The HTTP-API exposed by the js-ipfs daemon follows the [`http-api-spec`](https:/
const repo = <IPFS Repo instance or repo path>

// Create the IPFS node instance
const node = new IPFS(repo)
const node = new IPFS({
repo: repo,
EXPERIMENTAL: {
pubsub: false
}
})

// We need to init our repo, in this case the repo was empty
// We are picking 2048 bits for the RSA key that will be our PeerId
Expand Down
21 changes: 21 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Release checklist

> List of actions to perform before issuing a new js-ipfs release
- Robustness and quality
- [ ] Ensure that all tests are passing, this includes:
- [ ] unit
- [ ] interop
- [ ] sharness
- [ ] Run tests of the following projects with the new release:
- [ ] orbitdb
- [ ] orbit-core
- [ ] ipfs-log
- Documentation
- [ ] Ensure that README.md is up to date
- [ ] Ensure that all the examples run
- Communication
- [ ] Create the release issue
- [ ] Announcements (both pre-release and post-release)
- [ ] Twitter
- [ ] IRC
1 change: 1 addition & 0 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM quay.io/ipfs/js-base:6.9.4
1 change: 1 addition & 0 deletions ci/jenkins
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
javascript
1 change: 1 addition & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ Let us know if you find any issue or if you want to contribute and add a new tut
- [js-ipfs basic, how to spawn a node and add a file to IPFS](/examples)
- [How to bundle js-ipfs with Browserify](/bundle-browserify)
- [How to bundle js-ipfs with WebPack](/bundle-webpack)
- [Use IPFS to explore the Ethereum BlockChain](/explore-ethereum)

## Tutorials
7 changes: 6 additions & 1 deletion examples/basics/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ const IPFS = require('../../src/core')
/*
* Create a new IPFS instance, using default repo (fs) on default path (~/.ipfs)
*/
const node = new IPFS(path.join(os.tmpDir() + '/' + new Date().toString()))
const node = new IPFS({
repo: path.join(os.tmpdir() + '/' + new Date().toString()),
EXPERIMENTAL: {
pubsub: false
}
})

const fileToAdd = {
path: 'hello.txt',
Expand Down
9 changes: 3 additions & 6 deletions examples/bundle-browserify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@
"description": "Bundle js-ipfs with Browserify",
"main": "index.js",
"scripts": {
"bundle": "browserify src/index.js > public/bundle.js",
"bundle": "browserify src/index.js --require browserify-zlib-next:zlib > public/bundle.js",
"serve": "http-server public -a 127.0.0.1 -p 8888",
"start": "npm run bundle && npm run serve"
},
"browser": {
"zlib": "browserify-zlib-next"
},
"keywords": [],
"license": "MIT",
"devDependencies": {
"browserify": "^13.1.1",
"concat-stream": "^1.5.2",
"browserify": "^14.0.0",
"concat-stream": "^1.6.0",
"http-server": "^0.9.0",
"browserify-zlib-next": "^1.0.1"
},
Expand Down
15 changes: 12 additions & 3 deletions examples/bundle-browserify/src/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
'use strict'

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

// Create the IPFS node instance
// for simplicity, we create a new repo everytime the node
// is created, because you can't init already existing repos
const repoPath = String(Math.random())
const node = new IPFS(repoPath)
const concat = require('concat-stream')

const node = new IPFS({
repo: repoPath,
EXPERIMENTAL: {
pubsub: false
}
})

// expose the node to the window, for the fun!
window.ipfs = node

node.init({ emptyRepo: true, bits: 2048 }, function (err) {
if (err) {
Expand Down
7 changes: 6 additions & 1 deletion examples/bundle-webpack/src/components/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ class App extends React.Component {
// for simplicity, we create a new repo everytime the node
// is created, because you can't init already existing repos
const repoPath = String(Math.random())
node = new IPFS(repoPath)
node = new IPFS({
repo: repoPath,
EXPERIMENTAL: {
pubsub: false
}
})

node.init({ emptyRepo: true, bits: 2048 }, function (err) {
if (err) {
Expand Down
45 changes: 45 additions & 0 deletions examples/explore-ethereum/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Resolve the ethereum blockchain through IPFS

> 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.
## Set up

Make sure to have the latest js-ipfs installed by doing

```sh
> npm install ipfs -g
```

If this is the first time you use js-ipfs, make sure to init your repo with

```sh
> jsipfs init
```

## Load ethereum chain data into ipfs

We've some ethereum blocks available at [eth-stuffs](/eth-stuffs) folder, you can add them to ipfs by running:

```sh
> ./load-eth-stuffs.sh
z43AaGEvwdfzjrCZ3Sq7DKxdDHrwoaPQDtqF4jfdkNEVTiqGVFW
z43AaGEywSDX5PUJcrn5GfZmb6FjisJyR7uahhWPk456f7k7LDA
z43AaGF42R2DXsU65bNnHRCypLPr9sg6D7CUws5raiqATVaB1jj
z45oqTS2AQ9SgyVa31LRGZgfibtdoPvP2miMNaXbDLLgD9MdAAr
z45oqTS8wZaNGU2eepKHRbXvmV93cKQbiL241RB3bRtMYZP8hNm
z45oqTS8wZaNGU2eepKHRbXvmV93cKQbiL241RB3bRtMYZP8hNm
z45oqTS4E1GeJujnKVJG3xSVnS64A8mMCWhKSkCWACNCeD95mtQ
z45oqTS4MnurEeEaanvFieeJDNHH3jGNk9NJEiyrwXwYQSWfxUB
z45oqTRwExySeMeivsU1Y9UdzWDp2mx71TtQhmTGzRaXCcsNujj
z45oqTRzb9a5xyvx5RbfSXH1K5jibyZ4AxnXyYReuLw7KU5veYw
```

## Explore these blocks using the DAG api

Some examples

```sh
> jsipfs dag get z43AaGEvwdfzjrCZ3Sq7DKxdDHrwoaPQDtqF4jfdkNEVTiqGVFW/
> jsipfs dag get z43AaGEvwdfzjrCZ3Sq7DKxdDHrwoaPQDtqF4jfdkNEVTiqGVFW/parentHash
...
```
Binary file added examples/explore-ethereum/eth-stuffs/block_302515
Binary file not shown.
Binary file added examples/explore-ethereum/eth-stuffs/block_302516
Binary file not shown.
Binary file added examples/explore-ethereum/eth-stuffs/block_302517
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions examples/explore-ethereum/eth-stuffs/state_00001_302516
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�Q��������p����'�(�Eׅ=X�5�msi���(�0oE�]߀����k�^<|a�P����ް��u��.iK�j�-�����
Binary file not shown.
Binary file not shown.
Binary file added examples/explore-ethereum/eth-stuffs/state_00_302516
Binary file not shown.
Binary file added examples/explore-ethereum/eth-stuffs/state_0_302516
Binary file not shown.
1 change: 1 addition & 0 deletions examples/explore-ethereum/eth-stuffs/state_r_302516
Original file line number Diff line number Diff line change
@@ -0,0 +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��
Expand Down
13 changes: 13 additions & 0 deletions examples/explore-ethereum/load-eth-stuffs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Blocks
jsipfs block put --format=eth-block --mhtype=keccak-256 eth-stuffs/block_302515
jsipfs block put --format=eth-block --mhtype=keccak-256 eth-stuffs/block_302516
jsipfs block put --format=eth-block --mhtype=keccak-256 eth-stuffs/block_302517

# State Trie
jsipfs block put --format=eth-state-trie --mhtype=keccak-256 eth-stuffs/state_000017_302516
jsipfs block put --format=eth-state-trie --mhtype=keccak-256 eth-stuffs/state_00001_302516
jsipfs block put --format=eth-state-trie --mhtype=keccak-256 eth-stuffs/state_00001_302516
jsipfs block put --format=eth-state-trie --mhtype=keccak-256 eth-stuffs/state_000_302516
jsipfs block put --format=eth-state-trie --mhtype=keccak-256 eth-stuffs/state_00_302516
jsipfs block put --format=eth-state-trie --mhtype=keccak-256 eth-stuffs/state_0_302516
jsipfs block put --format=eth-state-trie --mhtype=keccak-256 eth-stuffs/state_r_302516
64 changes: 49 additions & 15 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,70 @@
const gulp = require('gulp')
const parallel = require('async/parallel')
const series = require('async/series')
const createTempNode = require('./test/utils/temp-node')
const API = require('./src/http-api')
const createTempRepo = require('./test/utils/create-repo-node.js')
const IPFS = require('./src/core')
const HTTPAPI = require('./src/http-api')
const leftPad = require('left-pad')

let nodes = []

function startNode (num, done) {
createTempNode(num, (err, node) => {
if (err) {
return done(err)
}
/*
* spawns a daemon with ports numbers starting in 10 and ending in `num`
*/
function spawnDaemon (num, callback) {
num = leftPad(num, 3, 0)

const repo = createTempRepo()

const api = new API(node.repo.path())
nodes.push(api)
api.start(done)
const node = new IPFS({
repo: repo,
EXPERIMENTAL: {
pubsub: true
}
})

series([
(cb) => node.init({ emptyRepo: true, bits: 1024 }, cb),
(cb) => {
repo.config.get((err, config) => {
if (err) { return callback(err) }

config.Addresses = {
Swarm: [
`/ip4/127.0.0.1/tcp/10${num}`,
`/ip4/127.0.0.1/tcp/20${num}/ws`
],
API: `/ip4/127.0.0.1/tcp/31${num}`,
Gateway: `/ip4/127.0.0.1/tcp/32${num}`
}

config.Discovery.MDNS.Enabled = false

repo.config.set(config, cb)
})
},
(cb) => node.load(cb),
(cb) => {
const daemon = new HTTPAPI(node.repo.path())
nodes.push(daemon)
daemon.start(cb)
}
], callback)
}

gulp.task('libnode:start', (done) => {
nodes = []
parallel([
(cb) => startNode(7, cb),
(cb) => startNode(8, cb),
(cb) => startNode(12, cb),
(cb) => startNode(13, cb)
(cb) => spawnDaemon(7, cb),
(cb) => spawnDaemon(8, cb),
(cb) => spawnDaemon(12, cb),
(cb) => spawnDaemon(13, cb)
], done)
})

gulp.task('libnode:stop', (done) => {
series(nodes.map((node) => (cb) => {
setTimeout(() => node.stop(cb), 500)
setTimeout(() => node.stop(cb), 200)
}), done)
})

Expand Down
58 changes: 31 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ipfs",
"version": "0.21.6",
"version": "0.21.8",
"description": "JavaScript implementation of the IPFS specification",
"bin": {
"jsipfs": "src/cli/bin.js"
Expand All @@ -24,6 +24,8 @@
"lint": "aegir-lint",
"coverage": "gulp coverage",
"test": "gulp test",
"test:node": "npm run test:unit:node",
"test:browser": "npm run test:unit:browser",
"test:unit:node": "gulp test:node",
"test:unit:node:core": "TEST=core npm run test:unit:node",
"test:unit:node:http": "TEST=http npm run test:unit:node",
Expand Down Expand Up @@ -61,19 +63,20 @@
},
"homepage": "https://github.com/ipfs/js-ipfs#readme",
"devDependencies": {
"aegir": "^9.4.0",
"aegir": "^10.0.0",
"buffer-loader": "0.0.1",
"chai": "^3.5.0",
"delay": "^1.3.1",
"detect-node": "^2.0.3",
"dir-compare": "^1.3.0",
"eslint-plugin-react": "^6.9.0",
"execa": "^0.6.0",
"expose-loader": "^0.7.1",
"form-data": "^2.1.2",
"fs-pull-blob-store": "^0.4.1",
"fs-pull-blob-store": "~0.4.1",
"gulp": "^3.9.1",
"interface-ipfs-core": "^0.23.5",
"ipfsd-ctl": "^0.18.1",
"interface-ipfs-core": "~0.24.1",
"ipfsd-ctl": "~0.18.3",
"left-pad": "^1.1.3",
"lodash": "^4.17.4",
"mocha": "^3.2.0",
Expand All @@ -89,40 +92,41 @@
"async": "^2.1.4",
"bl": "^1.2.0",
"boom": "^4.2.0",
"debug": "^2.6.0",
"fs-pull-blob-store": "^0.3.0",
"debug": "^2.6.1",
"fs-pull-blob-store": "~0.3.0",
"glob": "^7.1.1",
"hapi": "^16.1.0",
"hapi-set-header": "^1.0.2",
"hoek": "^4.1.0",
"idb-pull-blob-store": "^0.5.1",
"ipfs-api": "^12.1.4",
"ipfs-bitswap": "^0.9.2",
"ipfs-block": "^0.5.4",
"ipfs-block-service": "^0.8.1",
"ipfs-multipart": "^0.1.0",
"ipfs-repo": "^0.11.2",
"ipfs-unixfs": "^0.1.9",
"ipfs-unixfs-engine": "^0.15.1",
"ipld-resolver": "^0.4.2",
"idb-pull-blob-store": "~0.5.1",
"ipfs-api": "^12.1.7",
"ipfs-bitswap": "~0.9.3",
"ipfs-block": "~0.5.5",
"ipfs-block-service": "~0.8.3",
"ipfs-multipart": "~0.1.0",
"ipfs-repo": "~0.11.3",
"ipfs-unixfs": "~0.1.10",
"ipfs-unixfs-engine": "~0.17.0",
"ipld-resolver": "~0.8.1",
"isstream": "^0.1.2",
"libp2p-floodsub": "0.7.1",
"joi": "^10.2.0",
"libp2p-ipfs-nodejs": "^0.17.9",
"libp2p-ipfs-browser": "^0.17.8",
"joi": "^10.2.2",
"libp2p-floodsub": "~0.7.3",
"libp2p-ipfs-browser": "~0.18.2",
"libp2p-ipfs-nodejs": "~0.18.1",
"lodash.flatmap": "^4.5.0",
"lodash.get": "^4.4.2",
"lodash.has": "^4.5.2",
"lodash.set": "^4.3.2",
"lodash.sortby": "^4.7.0",
"lodash.values": "^4.3.0",
"mafmt": "^2.1.6",
"multiaddr": "^2.2.0",
"multihashes": "^0.3.2",
"mkdirp": "^0.5.1",
"multiaddr": "^2.2.1",
"multihashes": "~0.3.3",
"path-exists": "^3.0.0",
"peer-book": "^0.3.0",
"peer-id": "^0.8.1",
"peer-info": "^0.8.2",
"peer-book": "~0.3.1",
"peer-id": "~0.8.2",
"peer-info": "~0.8.3",
"promisify-es6": "^1.0.2",
"pull-file": "^1.0.0",
"pull-paramap": "^1.2.1",
Expand Down Expand Up @@ -171,4 +175,4 @@
"nginnever <ginneversource@gmail.com>",
"npmcdn-to-unpkg-bot <npmcdn-to-unpkg-bot@users.noreply.github.com>"
]
}
}
Loading

0 comments on commit 8c883de

Please sign in to comment.