# Batch transfer function not transferring token

**URL:** <https://forum.openzeppelin.com/t/batch-transfer-function-not-transferring-token/18586>\
**Category:** Contracts\
**Tags:** etherscan-verify\
**Created:** [November 10, 2021, 2:57am UTC](https://forum.openzeppelin.com/t/batch-transfer-function-not-transferring-token/18586 "2021-11-10T02:57:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![LookyLooky](https://avatars.discourse-cdn.com/v4/letter/l/ba9def/32.png) [@LookyLooky](https://forum.openzeppelin.com/u/LookyLooky)\
**Post date:** [November 10, 2021, 2:57am UTC](https://forum.openzeppelin.com/t/batch-transfer-function-not-transferring-token/18586/1 "2021-11-10T02:57:13Z")

</div>

Hello, I have been struggling for days now trying to figure this out so any tips would be highly appreciable.

I am attempting to batch transfer tokens to an array of addresses with a function like this:

```auto
    function batchTransferToken(address[] memory holders, uint256 amount) public payable {
        for (uint i=0; i<holders.length; i++) {
            emit Transfer(address(this), holders[i], amount);
        }
    }

```

The transaction is successful but the token simply does not move to target wallet addresses. I have made sure contract has required tokens for transfer.

Here is example transaction:

> **[Binance Transaction Hash (Txhash) Details | BscScan](https://testnet.bscscan.com/tx/0x029b9bc31daa502a4a44182c4953a03ef738adb5d3b61f892de9ff66d7636073)**
>
> Binance (BNB) detailed transaction info for txhash 0x029b9bc31daa502a4a44182c4953a03ef738adb5d3b61f892de9ff66d7636073. The transaction status, block confirmation, gas fee, BNB, and token transfer are shown.

I have seen other people use this exact function successfully but it does not work for me.

If I replace:

`emit Transfer(address(this), holders[i], amount);`

with :

`_transfer(_msgSender(), holders[i], amount);`

It works if I use \_transfer but then the batch transfer is prohibitively expensive.

I understand that emit Transfer is an **event** and the \_transfer is a function but I have seen others use emit Transfer to move tokens without calling \_transfer.

I have seen other people batch transfer tokens with this method as cheap as 4000 tokens at $36 so this is the goal.

Thanks in advance for any suggestions.

---

<div class="post-metadata">

**Author:** ![TtheBC01](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/tthebc01/32/14174_2.png) [@TtheBC01](https://forum.openzeppelin.com/u/TtheBC01)\
**Post date:** [November 10, 2021, 3:15am UTC](https://forum.openzeppelin.com/t/batch-transfer-function-not-transferring-token/18586/2 "2021-11-10T03:15:20Z")

</div>

Hey @LookyLooky, event emissions won't change the state of the blockchain, they only emit information to the chain logs. You definitely need to be calling the `_transfer` function (or external `transfer` or `transferFrom` functions) in order actually send a balance to your desired recipients and the gas cost will be much greater than a simple event emission.

Also note that within `_transfer` there is [already a `Transfer` event emitted](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol#L238).

---

<div class="post-metadata">

**Author:** ![jimmy-zak20](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/jimmy-zak20/32/12319_2.png) [@jimmy-zak20](https://forum.openzeppelin.com/u/jimmy-zak20)\
**Post date:** [January 16, 2022, 8:15pm UTC](https://forum.openzeppelin.com/t/batch-transfer-function-not-transferring-token/18586/8 "2022-01-16T20:15:45Z")

</div>

BRO DID FIND THE SOLUTION actually i just add the batch transfert to my contract but nothing happend .. can u help me with that

---

<div class="post-metadata">

**Author:** ![frangio](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/frangio/32/15251_2.png) [@frangio](https://forum.openzeppelin.com/u/frangio)\
**Post date:** [January 19, 2022, 12:17am UTC](https://forum.openzeppelin.com/t/batch-transfer-function-not-transferring-token/18586/9 "2022-01-19T00:17:04Z")

</div>

@jimmy-zak20 Please pay attention to the previous comment as it explains why your function and the one in this post do not work.
