【问题标题】:(Etherscan API, web3 vs Etherscan Website) Why different token values?(Etherscan API,web3 vs Etherscan 网站)为什么不同的令牌值?
【发布时间】:2019-08-13 10:14:52
【问题描述】:

交易哈希:0x70a584e4a2eb38cf7d6d48e215f6ac105b17ecfd97cd7091c4079bb961c2aa4c


[Etherscan 网站]

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

转移值 = 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

传输值 = 9000000000000 (0.000009 C3W)


[Web3]

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

传输值 = 9000000000000 (0.000009 C3W)

为什么不一样?哪些数据是正确的?以及如何使用 Web3 或 Etherscan API 获得正确的令牌值?

【问题讨论】:

    标签: token web3 erc20 etherscan


    【解决方案1】:

    根据etherscan提供的解码输入数据,

    # 名称类型数据 0 _到地址 0d7a0161f798166b2fcc996f03448892c2584193 1 _value uint256 9000000000000

    我找不到任何问题。

    而且,C3W 令牌小数位数是 8。
    所以,9000000000000 是对的。

    【讨论】:

      猜你喜欢
      • 2021-12-13
      • 2021-12-03
      • 2022-11-11
      • 2021-11-17
      • 2021-06-25
      • 2019-04-12
      • 2021-10-14
      • 2021-08-10
      • 2020-09-09
      相关资源
      最近更新 更多