powsrv.js
v1.0.4
Published
Fast and efficient PoWaaS (PoW-as-a-service) for IOTA
Downloads
5
Maintainers
Readme
iota.lib.js.powsrvio - Use powsrv.io PoW with IOTA.js Library
This library is used to add an alternative attachToTangle function to the iota.js library to delegate Proof-of-work to powsrv.io. This enables for users to offload PoW from low-power IoT devices, mobile and desktop devices without capabilities.
Getting Started
Add the package to your project:
npm install powsrv.js
Basic Usage
const remoteATT = require('powsrv.js')
const attachToTangle = remoteATT(5000, "your9api9key")
// Set attachToTangle to your IOTA client
const { composeAPI } = require('@iota/core')
const iota = composeAPI({
provider: 'http://localhost:14265',
attachToTangle
})
- delay:
Integer
Milliseconds to wait before PoW server timeout. Null value defaults to 5000 - key:
String
API key used to get access to powsrv.io.
API Key
Register on my.powsrv.io to get an API key
My first transaction with PoW done by powsrv.io
- Change to a directory of your choice.
- Clone or download iota.lib.js.powsrvio
- Change to the iota.lib.js.powsrvio/examples directory.
- Install the iota.js core lib with
npm install @iota/core
. - Change the
provider
intest_transaction_powsrv.js
to your node's address. - Change
your9api9key
to your API key - Run
node test_transaction_powsrv.js
(if there is no node.js on your system install it first) - The output shuold be like this:
Published transaction with tail hash: XNQY...
- Great, now you are able to send IOTA transactions with super fast PoW.
My first public MAM stream with PoW done by powsrv.io
- Change to a directory of your choice.
- Clone or download iota.lib.js.powsrvio
- Change to the iota.lib.js.powsrvio/examples directory.
- Install the mam.client.js lib with
npm install @iota/mam
. - Install the iota.js core lib with
npm install @iota/core
. - Change the
provider
inpublishAndFetchPublic.js
to your node's address. - Change
your9api9key
to your API key - Run
node publishAndFetchPublic.js
(if there is no node.js on your system install it first) - The output shuold be like this:
Published { message: 'Message from Alice',timestamp: '2019-2-10 10:54:47' } ...
- Great, now you are able to publish MAM streams with super fast PoW