TimSamshuijzen / iotaproxy

A simple proxy server for the IOTA tangle network, supporting the attachToTangle command (PoW).
GNU General Public License v3.0
43 stars 18 forks source link

Invalid transaction hash? #3

Open jbilcke opened 7 years ago

jbilcke commented 7 years ago

Hi,

I I tried to use the iotaproxy using iota.lib.js 0.4.0

After trying to issue a new transaction in the log of the proxy I have:

Relaying command getTrytes
Relaying command getBalances
Relaying command findTransactions
Relaying command findTransactions
Relaying command findTransactions
Relaying command findTransactions
Relaying command getBalances
Relaying command getTransactionsToApprove
Relaying command getNodeInfo
Processing command attachToTangle
Welcome to CCURL 0.2.1, home of the ccurl. can I take your vector?
Thread Hashing...
I: Starting search threads.
I: Found threads. Returning.
Pow Finished.
Welcome to CCURL 0.2.1, home of the ccurl. can I take your vector?
Thread Hashing...
I: Starting search threads.
I: Found threads. Returning.
Pow Finished.
Welcome to CCURL 0.2.1, home of the ccurl. can I take your vector?
Thread Hashing...
I: Starting search threads.
I: Found threads. Returning.
Pow Finished.
Welcome to CCURL 0.2.1, home of the ccurl. can I take your vector?
Thread Hashing...
I: Starting search threads.
I: Found threads. Returning.
Pow Finished.
Welcome to CCURL 0.2.1, home of the ccurl. can I take your vector?
Thread Hashing...
I: Starting search threads.
I: Found threads. Returning.
Pow Finished.
Relaying command storeTransactions

It does a lot of things, return a lot of JSONs back to the client and seems to work, but in the end there is an exception in iota.lib.js (actually in the iota.lib.js/lib/utils/makeRequest.js:prepareResult() function) when it tries to read the http request result returned by the proxy:

Request Error: Invalid transaction hash
    at Object.requestError (test/node_modules/iota.lib.js/lib/errors/requestErrors.js:11:12)
    at makeRequest.prepareResult (test/node_modules/iota.lib.js/lib/utils/makeRequest.js:172:24)
    at exports.XMLHttpRequest.request.onreadystatechange (test/node_modules/iota.lib.js/lib/utils/makeRequest.js:61:25)
    at exports.XMLHttpRequest.dispatchEvent (test/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:591:25)
    at setState (test/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:610:14)
    at IncomingMessage.<anonymous> (test/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:447:13)
    at emitNone (events.js:110:20)
    at IncomingMessage.emit (events.js:207:7)
    at endReadableNT (_stream_readable.js:1045:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

the JSON sent by the proxy to the client is:

{"exception":"Invalid transaction hash","duration":122}

(I don't have an extensive knowledge yet of how a full node / iota.lib.js / the proxy work, so maybe the problem is not caused by the proxy but something else?)

TimSamshuijzen commented 7 years ago

Hi jbilcke, thanks for the details. I cannot reproduce your problem on my machine (Windows). What environment are you using? Do you know if the proxy is connected to a node with the most recent IRI (1.3.2)?

jbilcke commented 7 years ago

@TimSamshuijzen

Good question! I will try again today,using the updated version of iotaproxy, and on multiple nodes (I will post the feedback here).

About my environment:

TimSamshuijzen commented 7 years ago

@jbilcke I haven't tested the CLI app. It could be that the CLI app is not up to date with the new IOTA protocol. Although you are using the latest iota.lib.js, there might be some logic in CLI that needs updating, but not sure.

cyclux commented 7 years ago

I also encountered invalid transaction hash a view times now. First I thought I might have recognized a pattern and it is related to the kinds of inputs I use and whether the address I send to has unconfirmed TX. But I think this is not the case and more related to the success of the POW. I also remember others who had this message in the GUI wallet and they were told to just resend the funds because the POW failed. I just did that and after retrying, it also worked with iotaproxy. Although if @jbilcke sees this error all the time there might be another issue as already mentioned. I'll test some more and if I gather new info about it, I'll let you know.

TimSamshuijzen commented 7 years ago

Great, thanks @cyclux

TimSamshuijzen commented 7 years ago

Hi @jbilcke and @cyclux, is this still an issue?

cyclux commented 7 years ago

@TimSamshuijzen Unfortunatelly I was not able to test further the last days. The low confirmation ratio renders all testing useless and a pain. After the snapshot I would test again. Although I think it's really failing POW and not an issue of your module.

TimSamshuijzen commented 7 years ago

Thanks @cyclux

TimSamshuijzen commented 7 years ago

@cyclux @jbilcke Thanks to Vishal Bhide of the Iota Slack community who has done some research into this, it appears that the problem lies with not all nodes being upgraded to the newer version and they are undergoing a transition. Things are expected to stabalize in the next week. A further advice is to upgrade iota.lib.js to version 0.4.0 with this patch so that withCredentials is false: https://github.com/iotaledger/iota.lib.js/blob/master/lib/utils/makeRequest.js#L36 Hopefully everything will work soon.

cyclux commented 7 years ago

@TimSamshuijzen Thanks for the update! I want to add, that invalid transaction hash can also occur if the bundle includes too many inputs. As POW has to be done for each TX item within the bundle it can take sometimes 30 minutes or so. If the milestone has proceeded too far in the meantime the bundle will get rejected.

TimSamshuijzen commented 7 years ago

Great, thanks @cyclux ! That is very useful to know. I will keep this issue open for the time being so that others can see all the useful information posted here.

cyclux commented 7 years ago

@TimSamshuijzen Well, now the error is actually very present again, but different context. POW fails now after the new IRI release on storeTransactions with invalid transaction hash. They must have changed something, just wanted to let you know.

TimSamshuijzen commented 7 years ago

@cyclux Thanks for letting me know. I will look into it.

cyclux commented 7 years ago

@TimSamshuijzen Cool thanks :)

TimSamshuijzen commented 7 years ago

@cyclux I also got the invalid transaction hash. There have been quite a few changes to the IOTA repository lately. I have now updated the logic in IOTA Proxy and it seems to work now. Can you update IOTA Proxy and test? Thanks!

cyclux commented 7 years ago

@TimSamshuijzen Awesome, it works again! I just get Getting platforms... Cannot get the number of OpenCL platforms available. E:-1 now, but POW works regardless after that. Maybe it's a permission issue. Will test it with root on another machine once I have set it up there. Do you get this aswell maybe?

TimSamshuijzen commented 7 years ago

@cyclux Great, thanks for testing, but unfortunately another problem. I don't get this message on my machine (Windows). Maybe your PC does not provide GPU support? I think the error message you get originates from this: https://github.com/iotaledger/ccurl/blob/master/src/lib/claccess/clcontext.c You can see the error message on line 55 (actually a debug message). It looks like it's trying to access GPU, and probably falls back to non-GPU method and continues anyway?

cyclux commented 7 years ago

@TimSamshuijzen Ahh, this makes very much sense then. I run it on a dedicated linux server with no decent GPU. But seems that it falls back correctly to "CPU POW". I think that's good enough :)