TransactionPool.Remember: transactionGroup: [0] had zero Group but was submitted in a group of 2

Hi, I am trying to post a group transaction but receive this error. I am using WalletConnect to connect the wallet and to sign the transactions.

 txObj = new algosdk.Transaction(txs[0].getTx(TX_FORMAT.SDK));

This creates a transaction using algosdk for WallectConnect.

GroupId turns to be undefined in the transaction creation.

 txObj['group'] = txs[0].params.group.buffer;

I assign group of type ArrayBuffer to the transaction.

 const result = await this.walletConnect.sendCustomRequest(request);

This result is sent back to where the function is called.
Here we have another transaction with the same group Id but the type of this transaction is different.

const combinedTxs = combineSignedTxs([signedFeeTx[0], signedAppTx]);

signedFeeTx is the result mentioned above in code. After combining the transactions when I send request

const tx = await algoExplorer.post('/v2/transactions', base64ToUint8Array(params.tx), {
        'Content-Type': 'application/x-binary'
      });

I receive this error.

base.js?26b3:4 Uncaught (in promise) Error: TransactionPool.Remember: transactionGroup: [0] had zero Group but was submitted in a group of 2
    at new InvalidResponse (base.js?26b3:4)
    at AlgoExplorer._callee2$ (algoExplorer.js?0370:27)
    at tryCatch (runtime.js?96cf:63)
    at Generator.invoke [as _invoke] (runtime.js?96cf:293)
    at Generator.eval [as next] (runtime.js?96cf:118)
    at asyncGeneratorStep (asyncToGenerator.js?1da1:3)
    at _next (asyncToGenerator.js?1da1:25)

Sorry , could you find something on this? I’m currently running into the same error.

:grinning: UPDATE : I could solve the problem. It seems that the problem is the order of the code. I just copy this boilerplate for atomic transfers but I had to do some changes.

Summary:
1- build transaction with makePaymentTxnWithSuggestedParams
2- next call algosdk.assignGroupID([transaction1,transaction2]) no necessary to save it into a variable as repo does.
3- sign both txns
4- push signed txns into array groupedSignedTxns =
5- call => await algodClient.sendRawTransaction(groupedSignedTxns).do()

I’ll put my code here just to make it even more explicit:

const algosdk = require('algosdk');

var client = null;
async function setupClient() {
    if (client == null) {
        const token = { 'X-API-key': 'EMgRQXIAN67gCYG9lGQB5aQJmokDqZqc2JM7zsgO' };
        const server = "https://testnet-algorand.api.purestake.io/ps2";
        const port = "";
        let algodClient = new algosdk.Algodv2(token, server, port);
        client = algodClient;
    } else {
        return client;
    }
    return client;
}


function recoverAccount1() {
    var account1_mnemonic = "PUT HERE YOUR MNEMONIC";
    const passphrase = account1_mnemonic;
    let myAccount = algosdk.mnemonicToSecretKey(passphrase);
    return myAccount;
}

function recoverAccount2() {
    var account2_mnemonic = "PUT HERE YOUR MNEMONIC";
    const passphrase = account2_mnemonic;
    let myAccount = algosdk.mnemonicToSecretKey(passphrase);
    return myAccount;
}

// function used to wait for a tx confirmation
const waitForConfirmation = async function (algodclient, txId) {
    let response = await algodclient.status().do();
    let lastround = response["last-round"];
    console.log(`Waiting for transaction confirmation for txn ${txId}`);
    while (true) {
        const pendingInfo = await algodclient.pendingTransactionInformation(txId).do();
        if (pendingInfo["confirmed-round"] !== null && pendingInfo["confirmed-round"] > 0) {
            //Got the completed Transaction
            console.log("Transaction " + txId + " confirmed in round " + pendingInfo["confirmed-round"]);
            break;
        }
        lastround++;
        await algodclient.statusAfterBlock(lastround).do();
    }
    console.log('Transaction confirmed');
};


async function submitGroupTransactions() {

    try {
        const receiver = "GD64YIY3TWGDMCNPP553DZPPR6LDUSFQOIJVFDPPXWEG3FVOJCCDBBHU5A";
        let algodClient = await setupClient();
        let myAccountA = await recoverAccount1();
        let myAccountB = await recoverAccount2();
        console.log("My account B address: %s", myAccountB.addr)
        console.log("My account A address: %s", myAccountA.addr)

        let suggestedParams = await algodClient.getTransactionParams().do();
        
        let transactionAccA = algosdk.makeAssetTransferTxnWithSuggestedParam(myAccountA.addr, receiver, myAccountB.addr, undefined,1000000,  undefined, 13300122, suggestedParams)
        let transactionAccB = algosdk.makeAssetTransferTxnWithSuggestedParam(myAccountB.addr, receiver, myAccountA.addr, undefined,1000000,  undefined, 13300122, suggestedParams)

        algosdk.assignGroupID([transactionAccA,transactionAccB]);

        let signedTxA = transactionAccA.signTxn(myAccountA.sk)
        let signedTxB = transactionAccB.signTxn(myAccountB.sk)

        let groupedSignedTxns = []
        groupedSignedTxns.push(signedTxA)
        groupedSignedTxns.push(signedTxB)

        let tx = (await algodClient.sendRawTransaction(groupedSignedTxns).do());
        console.log("Transaction : " + tx.txId);

        await waitForConfirmation(algodClient, tx.txId);

    } catch (err) {
        console.log("err", err);
    }
}
submitGroupTransactions();

Few last things to take into account:

  • remember your addresses need balance to send the txn : here you can faucet them
  • boilerplate has a different connection to algoCliento from what’s in the code above

Hope this help you or someone in future!

1 Like

Yeah, I had the same issue in which I was not assigning the group IDs correct;y