I want to decode Tron TRC20 transfer without using getEventByTransactionID, i tried the method found here: but i am getting this:

[ '41lue exceeds width (20 bits) (operation="tobehex", fault="overflow", value=95342449491495438414145500878006688003189807677987, code=numeric_fault, version=6.6.4)', 63n ]


    const raw_data= 'a9059cbb0000000000000000000000413c674c3f07c94b53f1cd2bd5d88d0e1655ea8223000000000000000000000000000000000000000000000000000000000000003f'

1 Answer 1


Managed to decode it, should always work?

function decode(data: string) {
const transferMethodId = "a9059cbb";
const methodId = data.slice(0, 8);
if (transferMethodId == methodId) {
  const toInHex = "0x" + data.slice(32, 72);
  const to = provider.address.fromHex(toInHex);
  const amountHex = "0x" + data.slice(72);
  const amount = ethers.toBigInt(amountHex).toString();
  return {


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.