Mingling94 / Nodejs-Sia

Nodejs bindings for the siad API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sia Logo Nodejs Wrapper

Build Status js-standard-style devDependency Status dependencies Status license:mit

A Highly Efficient Decentralized Storage Network

This is a Nodejs wrapper for Sia. Use it in your apps to easily interact with the Sia storage network via function calls instead of manual http requests.

Prerequisites

Installation

Run the following to save sia.js in your project's node_modules folder

npm install -S sia.js

Usage

var Siad = require('sia.js')
Siad.call('/daemon/version', function(err, result) {
  console.log(err, result)
})

Should log something like:

null { version:
  '0.4.8' }

The call object passed as the first argument into call() are funneled directly into the request library, so checkout their options to see how to access the full functionality of Sia's API

Siad.call({
  url: '/consensus/block',
  method: 'GET',
  qs: {
    height: 0
  }
}, function(err,result) {
  console.log(err,result)
});

Should log something like:

null { block:
 { parentid: '0000000000000000000000000000000000000000000000000000000000000000',
   nonce: [ 0, 0, 0, 0, 0, 0, 0, 0 ],
   timestamp: 1433600000,
   minerpayouts: null,
   transactions: [ [Object] ] } }

About

Nodejs bindings for the siad API

License:MIT License


Languages

Language:JavaScript 100.0%