I am using this code to send transaction to IOTA Tangle (Mainnet). I am sending 10 transactions using a loop. I am also monitoring the time that is taken to prepare transfer and send trytes.

Here is my code:

for (let i = 1; i <= 10; i++)

    console.time('Prepare Transfer');   
    iota.prepareTransfers(seed, transfers)
    .then(trytes => {
        console.time('Send Trytes');
        var trytest = iota.sendTrytes(trytes, depth, minimumWeightMagnitude);
        console.timeEnd('Send Trytes');
        return trytest;
    .then(bundle => {
        console.log("Transaction Number: ", i);
    .catch(err => {

    console.timeEnd('Prepare Transfer');

Now I have to check whether the transaction has been confirmed and how much time it has taken. Is it possible to do that? Any code snippet that I can add in the above code? Thanks in advance.

  • No full snippet, but you should use getLatestInclusion API: iota.getLatestInclusion(hashes) .then(states => { // ... }) .catch(err => { // handle error }) – mihi Apr 16 '20 at 19:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.