Hi Felipe, I am trying to make an atomic transfer, with two basic transactions.
but when I try to broadcast the transactions I get this error:
[code] => 400
[message] => {"message":"TransactionPool.Remember: transactionGroup: incomplete group: 2CR4DHPI6ACSKI6T7P3VWEX5ZLEJUGXKOP2KKF2OUYN5YGLPVQLA != 2TW3AQRJYQDPBAVXGGDIQMX27FD4YCDOBANADXQAQJRSIUVBEVPQ ({{} [4LZE3BP4P66DPONNX2AENAU7JFTBWWOJ4OH7WBVX236JCF3JGQHA P6RZAYJSYKDLXWMOZZ6NAVJFNYY3FCWMGZSRQT4VMHXLGHEQ2XCQ]})"}
My code is the following:
//Transaction 1
$transactions=array();
$transactions=array(
“txn” => array(
“type” => “pay”, //Tx Type
“fee” => 1000, //Fee
“fv” => $lastRound, //First Valid
“gen” => $genesisID, // GenesisID
“gh” => $genesis, //Genesis Hash
“lv” => $lastRound+300, //Last Valid
“note” => “tx Group Test”, //You note
“snd” => $mainAccountAddress, //Sender
“rcv” => $receiver1, //Receiver
“amt” => 1000, //Amount
),
);
//Transaction 2
$transactions=array(
“txn” => array(
“type” => “pay”, //Tx Type
“fee” => 1000, //Fee
“fv” => $lastRound, //First Valid
“gen” => $genesisID, // GenesisID
“gh” => $genesis, //Genesis Hash
“lv” => ($lastRound+300), //Last Valid
“note” => “tx Group Test”, //You note
“snd” => $mainAccountAddress, //Sender
“rcv” => $receiver2, //Receiver
“amt” => 1000, //Amount
),
);
//2) Group TRansactions
$groupid=$algorand_kmd->groupid($transactions);
#Assigns Group ID
$transactions[0]['txn']['grp']=$groupid;
$transactions[1]['txn']['grp']=$groupid;
// echo "Transactions\n";
// print_r($transactions);
//3) Sign Transactions
#Sign Transaction 1
$txn="";
$params['params']=array(
//"public_key" => $algorand_kmd->pk_encode($mainAccountAddress),
"transaction" => $algorand_kmd->txn_encode($transactions[0]),
"wallet_handle_token" => $wallet_handle_token,
"wallet_password" => $mainWalletPw,
);
$return=$algorand_kmd->post("v1","transaction","sign",$params);
$r=json_decode($return['response']);
$txn.=base64_decode($r->signed_transaction);
echo "sign t1\n";
print_r($return);
#Sign Transaction 2
$params['params']=array(
//"public_key" => $algorand_kmd->pk_encode($mainAccountAddress),
"transaction" => $algorand_kmd->txn_encode($transactions[1]),
"wallet_handle_token" => $wallet_handle_token,
"wallet_password" => $mainWalletPw,
);
$return=$algorand_kmd->post("v1","transaction","sign",$params);
$r=json_decode($return['response']);
$txn.=base64_decode($r->signed_transaction);
// echo $txn;
//4) Send Transaction Group
#Broadcasts a raw atomic transaction to the network.
$params['transaction']=$txn;
$return=$algorand->post("v2","transactions",$params);
$txId=$return['response']->txId;
//echo "txId: $txId";
print_r($return);
I can’t figure out the reason of this error