iexbase / tron-api

A PHP API for interacting with Tron (TRX)
https://iexbase.github.io/tron-api/
MIT License
405 stars 287 forks source link

Error "ContractValidateException: Validate TransferContract error, balance is not sufficient" on mainet, testnet -- fine #167

Closed osumico closed 6 months ago

osumico commented 1 year ago

[TL;DR] class org.tron.core.exception.ContractValidateException: Validate TransferContract error, balance is not sufficient at the moment of conducting TRX transfer from temporary to main address. After token transfer, there's almost always ~20 TRX left, energy is available, as well as bandwidth. The temporary address is always new.

[LONG] Hello, please advise on the problem. The error in the issue title occurs specifically after creating a new TRC20 contract (USDT). At the moment of transferring the remaining TRX from the temporary address. After I sent USDT from the temporary address, which I generate for the user. I can read and understand that the error is related to the fact that I don't have enough TRX on the address, but I assure you that there is enough TRX at the time of the TRX transaction.

The logic is as follows:

First, I create a temporary address, then callsetAddress() and setPrivateKey() to create a TRC-20 contract with the address TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t and check if the tokens have arrived. If the tokens have arrived, I send TRX from the main address to complete the USDT payment to the main address. In the case of TronGrid, I send 40 TRX. Tokens are sent perfectly. But at the moment when I want to send the remaining TRX (since the commission can be different, I send it with a reserve), I encounter the error described above.

In my case, the transfer logic is as follows: I send money from the main address to the temporary address, and then send it back again. It is possible that this could cause the error I experiencing?

ofshellohicy commented 5 months ago

I meet same issue, did you solve this issue.

HazNet commented 1 month ago

did you solve this issue ?