100 知道账户地址,怎么查找创建的合约

bsc、polygon、tron三个链,知道一个账户地址0x123456,怎么查找它创建的合约?除了写代码扫块之外有成熟的方法吗?因为交易太多了,几万个,不好翻。

请先 登录 后评论

最佳答案 2022-12-09 15:58

去了解下create计算合约地址的方式。 通过 sender+nonce 可以计算出合约地址。再通过web3.eth.getcode(contractAddress),看是否有code, 有的话,再人工去浏览器搜索下确认下; 至于,如果别人是通过create2的方式创建的合约,就只能按照你说的扫块。

function calc(sender,nonce) {

    var input_arr = [ sender, nonce ];
    var rlp_encoded = rlp.encode(input_arr);

    var contract_address_long = keccak('keccak256').update(rlp_encoded).digest('hex');

    var contract_address = contract_address_long.substring(24); //Trim the first 24 characters.
    return contract_address;
}
请先 登录 后评论

其它 5 个回答

李其宪 - 开发工程师
请先 登录 后评论
FC2022
请先 登录 后评论
用户_11146
请先 登录 后评论
ezio
请先 登录 后评论
FILAgiao - 法律顾问、冥想专家
请先 登录 后评论
  • 4 关注
  • 0 收藏,2007 浏览
  • 秋以 提出于 2022-11-20 15:21

相似问题