# Working with javascript SDK for Atomic Transaction

**URL:** <https://forum.algorand.co/t/working-with-javascript-sdk-for-atomic-transaction/6415>\
**Category:** General\
**Created:** [April 6, 2022, 12:05pm UTC](https://forum.algorand.co/t/working-with-javascript-sdk-for-atomic-transaction/6415 "2022-04-06T12:05:05Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Mosuhli](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@Mosuhli](https://forum.algorand.co/u/Mosuhli)\
**Post date:** [April 6, 2022, 12:05pm UTC](https://forum.algorand.co/t/working-with-javascript-sdk-for-atomic-transaction/6415/1 "2022-04-06T12:05:05Z")

</div>

Hey! I am working on Atomic Transaction and i am facing this error:

```nohighlight
TypeError: Array elements must be byte arrays
    at new SendRawTransaction

```

My Code is as follows:

```auto
const atomicTransaction = (async () => {

    let params = await algodClient.getTransactionParams().do();

    let amount = Math.floor(Math.random() * 1000);
    var mnemonic = "bid address sibling timber either various stumble skin coral stock caught quarter proof brave tattoo useful ship glory limb load weapon parent pistol absent cattle"
    var recoveredAccount = algosdk.mnemonicToSecretKey(mnemonic);
    let names1 = '{"firstName":"Mo", "lastName":"TW"}';
    let names2 = '{"firstName":"Au", "lastName":"Liau"}';
    let names3 = '{"firstName":"Tau", "lastName":"TT"}';

    let txn1 = {
        "from": recoveredAccount.addr,
        "to": "KILVDKGGW4USADYMF67LWU47FZIZCKAQSJZTKLGWQW2NOSAWOPG5YGXQYE",
        "fee": 1,
        "amount": amount,
        "firstRound": params.firstRound,
        "lastRound": params.lastRound,
        "genesisID": params.genesisID,
        "genesisHash": params.genesisHash,
        "note": new Uint8Array(new TextEncoder().encode(names1)),
    };
    console.log(txn1)
    let txn2 = {
        "from": recoveredAccount.addr,
        "to": "GF3LRLD7XRHE5GLWIVMRX3ESFHEZNAFZJSXHB2TMNPMB5V3HKS6SPQ7VCU",
        "fee": 1,
        "amount": amount,
        "firstRound": params.firstRound,
        "lastRound": params.lastRound,
        "genesisID": params.genesisID,
        "genesisHash": params.genesisHash,
        "note": new Uint8Array(new TextEncoder().encode(names2)),
    };
    console.log(txn2)
    let txn3 = {
        "from": recoveredAccount.addr,
        "to": "KD3DOFNWGWBFVZUNCS5JYIUOSJMC6VECXKTY6WXMQQBPEPD4ZXQNH76GGY",
        "fee": 1,
        "amount": amount,
        "firstRound": params.firstRound,
        "lastRound": params.lastRound,
        "genesisID": params.genesisID,
        "genesisHash": params.genesisHash,
        "note": new Uint8Array(new TextEncoder().encode(names3)),
    };
    console.log(txn3)
    // assign group id to transactions
    algosdk.assignGroupID([txn1, txn2, txn3]);
    // sign transactions
    let signedTxn1 = algosdk.signTransaction(txn1, recoveredAccount.sk);
    let signedTxn2 = algosdk.signTransaction(txn2, recoveredAccount.sk);
    let signedTxn3 = algosdk.signTransaction(txn3, recoveredAccount.sk);
    // const signedTxn1 = txn1.signTxn(recoveredAccount.sk);
    // const signedTxn2 = txn2.signTxn(recoveredAccount.sk);
    // const signedTxn3 = txn3.signTxn(recoveredAccount.sk);
    // let sendTx = await algodClient.sendRawTransaction(signedTxn.blob).do();
     // send transactions (note that the accounts need to be funded for this to work)
    console.log('Sending transactions...');
    const sendTx = await algodClient
        .sendRawTransaction([signedTxn1, signedTxn2, signedTxn3])
        .do();

    console.log("Transaction : " + sendTx.txId);
})().catch(e => {
    console.log(e);
});

```

Can i get help where the error is.

---

_[View the full topic](https://forum.algorand.co/t/working-with-javascript-sdk-for-atomic-transaction/6415)._
