wzhndd2
V2EX  ›  区块链

以太坊的 web3.js 的相关问题

  •  
  •   wzhndd2 · Aug 14, 2018 · 3134 views
    This topic created in 2832 days ago, the information mentioned may be changed or developed.

    最近玩了下以太坊相关的开发技术,有几个问题一直没找到解决方案
    1.通过 web3.js 的 web3.eth.getTransaction 拿到一个交易对象以后,我如何判断它是一个 ERC-20 代币的交易呢,如果是 ERC-20 的交易的话,我又该如何知道它是何种代币呢
    2.看了下,有很多 ERC-20 的代币是没有公布 ABI 的,如果没有 ABI,是否可以调用智能合约的相关 API

    3 replies    2018-08-17 17:21:44 +08:00
    simonliu2018
        1
    simonliu2018  
       Aug 16, 2018   ❤️ 1
    1 )你看看这个交易:
    https://etherscan.io/tx/0xba26054a61262fbcc06147050f17e6260d9b20d9bb905204b99ea7166d6a1b83
    你想要的信息在交易的 input data 里,web3.js 应该有解析 input data 的方法
    你可以从 etherscan.io 上把所有的代币的合约地址都整理一份,这样就好判断交易是不是代币交易

    2 )我理解没有 ABI 就不能调用合约接口
    wzhndd2
        2
    wzhndd2  
    OP
       Aug 16, 2018
    @simonliu2018 知道了,感谢老哥
    malakashi
        3
    malakashi  
       Aug 17, 2018
    用 rpc-json、geth 查
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2926 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 12:58 · PVG 20:58 · LAX 05:58 · JFK 08:58
    ♥ Do have faith in what you're doing.