I'm using the JOTA : Library 0.9.11-SNAPSHOT API.

I have the example found at https://github.com/iotaledger/iota.lib.java/blob/master/jota/src/test/java/jota/SendMessageTest.java working from an Eclipse JUnit run. I know PoW is a fundamental requirement for the Tangle, but how is this done when running an example like this? How to verify that PoW is being done?

I have been using server http://node03.iotatoken.nl:15265 for testing - I've sent 4000+ tryte zero balance message transactions, and have verified the transactions days later. All is working. PoW must have been done - right?



1 Answer 1


Yes Pow must have been done... but not locally.

To perform the POW locally, you need to setup an iotaClient with a object able to perform the pow locally.

You do this in the @Setup for your test with this line of code :

iotaClient = new IotaAPI.Builder().localPoW(new PearlDiverLocalPoW()).build();

This will create a client able to perform the pow locally (the default client requires a node offering to do the pow remotely)

Then you must simply follow the calls :

[SendMessageTest.java (line 42)]    iotaClient.sendTransfer(...)
[IotaAPI.java (line 825)]           sendTrytes(...)
[IotaAPI.java (line 239)]           attachToTangle(...)
[IotaAPICore.java (line 370)]       localPoW.performPoW(txn.toTrytes(), minWeightMagnitude);
[PearlDiverLocalPoW.java (line 16)] pearlDiver.search(trits, minWeightMagnitude, 0)

You can put a break point at IotaAPICore.java (line 370)

resultTrytes[i] = localPoW.performPoW(txn.toTrytes(), minWeightMagnitude);

and compare the trytes before txn.toTrytes() and after invocation of the pearlDiver : resultTrytes[i]

(be aware that running with debugger is most of time terribly slow with this kind of code)

  • Thank you Ben, it worked just as you said. I'm going to post another question
    – BobC
    Jul 25, 2018 at 4:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.