# Add custom data when using transfer(to,amount) function for USDT

**URL:** <https://forum.openzeppelin.com/t/add-custom-data-when-using-transfer-to-amount-function-for-usdt/3935>\
**Category:** Support\
**Created:** [September 25, 2020, 1:05pm UTC](https://forum.openzeppelin.com/t/add-custom-data-when-using-transfer-to-amount-function-for-usdt/3935 "2020-09-25T13:05:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vie](https://avatars.discourse-cdn.com/v4/letter/v/73ab20/32.png) [@Vie](https://forum.openzeppelin.com/u/Vie)\
**Post date:** [September 25, 2020, 1:05pm UTC](https://forum.openzeppelin.com/t/add-custom-data-when-using-transfer-to-amount-function-for-usdt/3935/1 "2020-09-25T13:05:10Z")

</div>

hi, I want to send USDT with custom data, how can I do that?

I deploy en erc20 token ‘HelloWorldToken’ and I send a token to mysql with custom data ‘HelloWorld’,  
the url is [https://rinkeby.etherscan.io/tx/0xc1b54de98d2b8df5baf343d721ef8e245ff3ef6cfffa50bc848f28392a40347c](https://rinkeby.etherscan.io/tx/0xc1b54de98d2b8df5baf343d721ef8e245ff3ef6cfffa50bc848f28392a40347c)

the data of this tx is as follow:

`0xa9059cbb000000000000000000000000ad61cc6653b62b7c05bd2f593bc49d22fb901a9c000000000000000000000000000000000000000000000000000000000000040048656c6c6f576f726c64`

just as we all know, `a9059cbb` is the function id of `transfer(address,uint256)` and `000000000000000000000000ad61cc6653b62b7c05bd2f593bc49d22fb901a9c` is the address, the `0000000000000000000000000000000000000000000000000000000000000400` is the amount,

and I add my custom data of `48656c6c6f576f726c64` (HelloWorld) to the end.

and the tx is ok, the token transfer from A to B.

Is there a EIP abount this on how to add custom data to the end of a token?

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [September 28, 2020, 3:30am UTC](https://forum.openzeppelin.com/t/add-custom-data-when-using-transfer-to-amount-function-for-usdt/3935/2 "2020-09-28T03:30:29Z")

</div>

Hi @vie,

I assume that you should be able to do the same with `transfer` on the USDT contract.

It has a check for data size but this is to prevent short addresses…

> **[Contract Address 0xdac17f958d2ee523a2206206994597c13d831ec7 | Etherscan](https://etherscan.io/address/0xdac17f958d2ee523a2206206994597c13d831ec7#code)**
>
> The Contract Address 0xdac17f958d2ee523a2206206994597c13d831ec7 page allows users to view the source code, transactions, balances, and analytics for the contract address. Users can also interact and make transactions to the contract directly on...

```auto
    /**
    * @dev Fix for the ERC20 short address attack.
    */
    modifier onlyPayloadSize(uint size) {
        require(!(msg.data.length < size + 4));
        _;
    }

    /**
    * @dev transfer token for a specified address
    * @param _to The address to transfer to.
    * @param _value The amount to be transferred.
    */
    function transfer(address _to, uint _value) public onlyPayloadSize(2 * 32) {
        uint fee = (_value.mul(basisPointsRate)).div(10000);
        if (fee > maximumFee) {
            fee = maximumFee;
        }
        uint sendAmount = _value.sub(fee);
        balances[msg.sender] = balances[msg.sender].sub(_value);
        balances[_to] = balances[_to].add(sendAmount);
        if (fee > 0) {
            balances[owner] = balances[owner].add(fee);
            Transfer(msg.sender, owner, fee);
        }
        Transfer(msg.sender, _to, sendAmount);
    }

```

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [October 5, 2020, 2:05am UTC](https://forum.openzeppelin.com/t/add-custom-data-when-using-transfer-to-amount-function-for-usdt/3935/3 "2020-10-05T02:05:20Z")

</div>

Hi @Vie,

Were you able to send custom data?

---

<div class="post-metadata">

**Author:** ![Vie](https://avatars.discourse-cdn.com/v4/letter/v/73ab20/32.png) [@Vie](https://forum.openzeppelin.com/u/Vie)\
**Post date:** [October 5, 2020, 12:37pm UTC](https://forum.openzeppelin.com/t/add-custom-data-when-using-transfer-to-amount-function-for-usdt/3935/4 "2020-10-05T12:37:33Z")

</div>

yes, I send custom data this url [https://rinkeby.etherscan.io/tx/0xc1b54de98d2b8df5baf343d721ef8e245ff3ef6cfffa50bc848f28392a40347c](https://rinkeby.etherscan.io/tx/0xc1b54de98d2b8df5baf343d721ef8e245ff3ef6cfffa50bc848f28392a40347c)

It’s fixed now, thank you.
