A simple proxy server for the IOTA tangle network, supporting the attachToTangle command (PoW). This light weight server will proxy/relay all incoming requests to a public node in the tangle network, but intercepts the attachToTangle command and performs the PoW locally.
Developers getting to know iota.lib.js in Node.js may have experienced the "COMMAND attachToTangle is not available on this node" response after calling iota.api.sendTransfer(). Some others may have experienced the same error message when calling the REST API attachToTangle command. The attachToTangle command is a request to perform the PoW that is necessary when doing a transaction.
Most public full nodes in the IOTA network do not support the attachToTangle command.
By design it is expected that you do the PoW locally on your device, the network is not required to do this for you.
If you're looking an easy way to do PoW, then this proxy server might help.
Use this proxy server when you want to offload PoW.
Feel free to edit or fork!
If this does proxy server is not what you are looking for, then you can look at some of the methods provided by the IOTA foundation in their repository.
Some examples of solutions provided by the IOTA foundation:
- Do PoW in WebGL2-enabled browsers.
- To do PoW in Node.js, combine solutions from ccurl.interface.js and ccurl, and override the iota.api.attachToTangle method in iota.lib.js.
- Install and run your own full IOTA node, configured to grant you access to the attachToTangle command.
This repository contains code and precompiled libraries from iotaledger/wallet.
Licence: GNU General Public License v3.0
Download and install Node.js
- Clone this repository:
git clone https://github.com/TimSamshuijzen/iotaproxy
- Enter the "iotaproxy" directory:
cd iotaproxy
- Install dependencies:
npm install
- Edit index.js to set preferred connection settings. For example:
var iotaProxy = require('./lib/iotaproxy.js');
iotaProxy.start(
{
host: 'http://iota.bitfinex.com',
port: 80,
localPort: 14265,
overrideAttachToTangle: true
}
);
- Run the proxy server:
node --harmony index.js
- Proxy server is now ready to use. It will start off displaying this in the console:
IOTA proxy server started
POW timeout is set to 15 min
Listening on port 14265
Relaying requests to iota.bitfinex.com:80
- Now, in your iota.lib.js project you can simply connect to this local proxy server, which in turn connects with the tangle:
var IOTA = require('iota.lib.js');
var iota = new IOTA({
'host': 'http://localhost',
'port': 14265
});