tronprotocol / tronweb

Javascript API Library for interacting with the TRON Network
MIT License
431 stars 272 forks source link

Invalid address in TRC20 Token #507

Closed arkavinod closed 5 months ago

arkavinod commented 5 months ago

const inputs = [ { type: "address", value: receiverAddress, }, { type: "uint256", value: 5, }, ]; const tx = await tronWeb.transactionBuilder.triggerSmartContract( trc20ContractAddress, "transfer(address,uint256)", options, inputs, tronWeb.address.toHex(sourceAddress) ); const results = await tronWeb.trx.sign(tx?.transaction, privateKey); console.log("results", results)

if we give receiver address which is not a valid tron address but its able to transfer amount to some other random address, instead of that it should give invalid tron address if its a not a valid tron address
start940315 commented 5 months ago

What address did you pass? The legality verification of parameter addresses relies on the broadcast interface on the chain.

zachariahevans174 commented 5 months ago

Any&All

Zachariah M Evans

On Tue, May 7, 2024 at 2:10 AM start940315 @.***> wrote:

What address did you pass? The legality verification of parameter addresses relies on the broadcast interface on the chain.

— Reply to this email directly, view it on GitHub https://github.com/tronprotocol/tronweb/issues/507#issuecomment-2097602120, or unsubscribe https://github.com/notifications/unsubscribe-auth/BDV43C6GYZN2RISIZI644ZTZBB45ZAVCNFSM6AAAAABG53PBVSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJXGYYDEMJSGA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

ferdinand026 commented 5 months ago

@arkavinod Tron node will verify the correctness of the address. There are two forms of tron addresses, if the address is not a valid address, the API will return the error message: "Invalid address provided".

arkavinod commented 5 months ago

@ferdinand026 I have passed this address in the above code "0x3d877bd550376f266c16d1b8da648a39f888eb38", which is not a valid tron address

arkavinod commented 5 months ago

What address did you pass? The legality verification of parameter addresses relies on the broadcast interface on the chain.

Hi I have given this address 0x3d877bd550376f266c16d1b8da648a39f888eb38 and its not a valid tron address but still it got proceed to some random address

arkavinod commented 5 months ago

@start940315 Hi I have given this address 0x3d877bd550376f266c16d1b8da648a39f888eb38 and its not a valid tron address but still it got proceed to some random address

ferdinand026 commented 5 months ago

@ferdinand026 I have passed this address in the above code "0x3d877bd550376f266c16d1b8da648a39f888eb38", which is not a valid tron address

It is an evm addrass. And adding 41 into the front of it will be the TRON hex format address. and for solidity and contract parameter encoding, the address of TRON address will not include the prefix 41. so it is a valid address for contract parameter.

arkavinod commented 5 months ago

So it is not valid tron for the above evm address it is creating new tron address and sending USDT token to that address?, Here is my case using above code with that address it got transferred to some account, I lost my funds, i checked that adress in tronweb it showing only USDT token, no TRX and it's not activated as it's showing in tronweb, means it not created and don't have any transactions for that, so I assuming it is created a address for tron and it got transferred if there no valid tron with that evm address am I correct?,

I just given some ETH adress by mistakely

ferdinand026 commented 5 months ago

TRON’s account generation algorithm is exactly the same as that of Ethereum, and TVM and EVM are basically fully compatible. so it is allowed to input a 20 bytes of hex format address in the above api.

arkavinod commented 5 months ago

Okay, thank you