DonghoChoi
DonghoChoi

Reputation: 11

(Etherscan API, web3 vs Etherscan Website) Why different token values?

transaction hash : 0x70a584e4a2eb38cf7d6d48e215f6ac105b17ecfd97cd7091c4079bb961c2aa4c


[Etherscan Website]

https://etherscan.io/tx/0x70a584e4a2eb38cf7d6d48e215f6ac105b17ecfd97cd7091c4079bb961c2aa4c

transferd value = 90000000000000000000000 (90,000 C3W)


[Etherscan API]

http://api.etherscan.io/api?apikey=BCNCEPNBI3ZDJX5ICTXW7IFEQASR2VUERK&module=account&action=tokentx&contractAddress=0x19055B944806fba2717dc694CF0173a1EB2D1604&address=0x0d7a0161f798166b2fcc996f03448892c2584193&sort=asc&startNumber=7417794&endNumber=7417804&page=1&offset=10000

transfered value = 9000000000000 (0.000009 C3W)


[Web3]

const tx = await web3.eth.getTransaction('0x70a584e4a2eb38cf7d6d48e215f6ac105b17ecfd97cd7091c4079bb961c2aa4c');
const input = tx.input; // '0xa9059cbb0000000000000000000000000d7a0161f798166b2fcc996f03448892c25841930000000000000000000000000000000000000000000000000000082f79cd9000'
/*** convert ***/

transfered value = 9000000000000 (0.000009 C3W)

Why different? Which data is correct? And how to get correct token value with Web3 or Etherscan API?

Upvotes: 0

Views: 635

Answers (1)

Kenterky
Kenterky

Reputation: 1

According to the decoded input data provided by the etherscan,

#   Name    Type    Data
0   _to     address 0d7a0161f798166b2fcc996f03448892c2584193
1   _value  uint256 9000000000000

I could not find any problems.

And, C3W token decimals is 8.
So, 9000000000000 is right.

Upvotes: 0

Related Questions