简体   繁体   English

我称之为SmartContract令牌ERC20,为什么显示哈希输出?

[英]I Call SmartContract Token ERC20, Why Show Hashing Output?

I do not know why with this, even though in the previous version (web3 + Metamask) can issue real data. 我不知道为什么这样做,即使在以前的版本(web3 + Metamask)中也可以发布真实数据。 But now used as hashing (output). 但是现在用作哈希(输出)。 I took the example in the code and output below (to get the TotalSupply on the ERC20 Token): 我在下面的代码和输出中得到了示例(以获取ERC20令牌上的TotalSupply):

Output : 0x18160ddd 输出:0x18160ddd

const contractInstance = web3.eth.contract(contractAbi).at(contractAddress);
const total_supply = contractInstance.totalSupply.getData();
console.log(total_supply);

How to showing real data? 如何显示真实数据? In a sense it doesn't come out hashing. 从某种意义上讲,它不会散列。 Thanks 谢谢

.getData() returns the ABI-encoded input you would have to send to the smart contract to invoke that method. .getData()返回您必须发送到智能合约以调用该方法的ABI编码输入。

If you want to actually call the smart contract, use .call() instead. 如果要实际调用智能合约,请改用.call()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM