ADAMANT ipfs-node. Designed for downloading and exchanging files in the ADAMANT Messenger.
Unlike the standard libraries (helia or kubo), this ipfs-node is equipped with a web server for performing REST requests for downloading and receiving files.
The plans also include the implementation of the Garbage Collector function, which will save disk space by removing unsent files.
- You will need Node.js v20.11.1 (You can install via nvm: https://github.com/nvm-sh/nvm):
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
nvm install 20.11.1
- Cloning and building node:
git clone https://github.com/Adamant-im/ipfs-node.git
cd ipfs-node
npm i
npm run build
- Running node with pm2:
npm i -g pm2
pm2 start dist/index.js --name="IPFS node"
Using config.default.json5
as a template, you can create various configuration files.
For example:
node dist/index.js test1
— this command will launch the server with the configuration from the file config.test1.json5
Request body type: form-data
It should contain a "files" field, which can accept an array of files up to 5 pieces at a time.
POST /api/file/upload
curl -i --location 'http://localhost:4000/api/file/upload' --form 'files=@"file.txt"'
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
...
{"filesNames":["file.txt"],"cids":["bafkreif7v2d2wdyh6pz5y2pwmrpegfpdgh5u7n5vomxnbofraqhuk2wapm"]}
GET /api/file/:cid
curl -i --location 'http://localhost:4000/api/file/bafkreif7v2d2wdyh6pz5y2pwmrpegfpdgh5u7n5vomxnbofraqhuk2wapm'
HTTP/1.1 200 OK
Content-Type: application/octet-stream
...
Hello ipfs-node!
GET /api/node/info
curl -i --location 'http://localhost:4000/api/node/info'
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
...
{
"version": "0.0.1",
"timestamp": 1720614998797,
"heliaStatus": "started",
"peerId": "12D3KooWJSiMDfyDLK3EMe2567sSM1VKQVnUn2getimGqVTWqKX9",
"multiAddresses": [
"/ip4/127.0.0.1/tcp/4001/p2p/12D3KooWJSiMDfyDLK3EMe2567sSM1VKQVnUn2getimGqVTWqKX9",
"/ip4/62.72.43.99/tcp/4001/p2p/12D3KooWJSiMDfyDLK3EMe2567sSM1VKQVnUn2getimGqVTWqKX9"
],
"blockstoreSizeMb": 0.0009489059448242188,
"datastoreSizeMb": 0.006007194519042969,
"availableSizeInMb": 2257731
}