Transfer Tron Shielded Tokens

103 views Asked by At

I'm newby to Tron network

recently I tried to transfer USDT TRC20 using Shielded contract on Nile testnet

I did every step mentioned on the document : shielded-TRC20-contract.md

I did steps until: 8. Call api: wallet/getnewshieldedaddress to generate all the related keys

and after that, I have to mint my Token to the Shielded Address

now I pass these params to wallet/createshieldedcontractparameters endpoint :

    "ovk": "72493d42a87227481b90c7174006d388b263b64a8b94ea55dbb78d59f5e45fa3",
    // the ovk I get from `wallet/getexpandedspendingkey`
    
    "from_amount": "50000",
    // I don't know what should I pass here
    
    "shielded_receives": {
        "note": {
            "value": 500,
            // I wanna to transfer 500 USDT
            
            
            "payment_address": "ztron17lk8dsfjjmpr96j3dwlz0jkwe99ejmpulrldz498aeguma477r3u48w4prnthjs04utxk3a3a40",
            //Here I pass the payment address that I get from `wallet/getnewshieldedaddress`
            
            "rcm": "68ef5a158f06734984d8e1500da86988caa6798953281adc1984808a67192c02"
            // I pass rcm that I get from 'wallet/getrcm`
        }
    },
    "shielded_TRC20_contract_address": "TXLAQ63Xg1NAzckPwKHvzw7CSEmLMEqcdj",
    // I pass the smart Contract address of USDT nil test net that I already have in my wallet
    "visible" : "True"
}

now when I send my request I got this error :

{ "Error": "class java.lang.ArithmeticException : BigInteger: modulus not positive" }

I don't know what I done wrong and What exactly should I do :/

1

There are 1 answers

0
Taylor On

"BigInteger: modulus not positive", is a Java error that typically occurs when a BigInteger operation is attempted with a non-positive modulus. In the context of your issue, it seems like this error might be related to the "from_amount" parameter.

The "from_amount" parameter should represent the total amount of tokens you want to shield (i.e., transfer into the shielded contract). In your case, if you want to shield 500 USDT, you should set "from_amount" to 500. However, please note that the amount should be in the smallest unit of the token. For USDT, which has 6 decimal places, if you want to shield 500 USDT, you should set "from_amount" to 500000000 (500 * 10^6).

Please try adjusting the "from_amount" parameter and see if that resolves your issue.