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.
Run the following to save sia.js in your project's node_modules
folder
npm install -S sia.js
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] ] } }