Skip to content

A plugin that enables your Lisk node to upload and download files from the IPFS network

Notifications You must be signed in to change notification settings

Lemii/lisk-ipfs-plugin

Repository files navigation

@lemii/lisk-ipfs-plugin

Lisk IPFS is a plugin that enables your Lisk node to upload and download files from the IPFS network. When using the plugin, your Lisk node will act as a unique IPFS node.

Installation

Install package

$ npm install --save @lemii/lisk-ipfs-plugin

Register plugin

app.registerPlugin(IpfsPlugin);

Register plugin with custom options

app.registerPlugin(IpfsPlugin, {
  limiterMax: 3,
  limiterWindow: 1000,
  port: 3200
});

When bootstrapping a sidechain with Lisk Commander, you can add it in /src/app/plugins.ts

Usage

Download data from from the IPFS network

http://localhost:3200/ipfs/QmU9QGUHCdeyuHxAyaVhzTLCQZcRx5xWDnzkUF6ZtTYXiH

http://localhost:3200/ipfs/Qmf412jQZiuVUtdgnB36FXFX7xg5V6KEbSJ4dpQuhkLyfD

Upload a file to IPFS:

Method: POST
Path: http://localhost:3200/ipfs/upload/file
Payload: File in file field of form-data

Result:

{
    "path": "QmU9QGUHCdeyuHxAyaVhzTLCQZcRx5xWDnzkUF6ZtTYXiH",
    "cid": {
        "codec": "dag-pb",
        "version": 0,
        "hash": {
            ...
        }
    },
    "size": 98908,
    "mode": 420
}

Upload text to IPFS:

Method: POST
Path: http://localhost:3200/ipfs/upload/text
Payload: Plain text in body of request

Result:

{
    "path": "Qmf412jQZiuVUtdgnB36FXFX7xg5V6KEbSJ4dpQuhkLyfD",
    "cid": {
        "codec": "dag-pb",
        "version": 0,
        "hash": {
            ...
        }
    },
    "size": 19,
    "mode": 420
}

About

A plugin that enables your Lisk node to upload and download files from the IPFS network

Resources

Stars

Watchers

Forks

Packages

No packages published