ethersjs运行时出现的问题


1.在运行部署在ganache1.1.0上的合约中的某个函数时,出现了这样的问题,之前部署在geth上时并没有这样的问题

userdeMacBook-Pro:test-ethers user$ node test-index.js 
CreateAndBuyToken error :Error: Transaction hash mismatch from Provider.sendTransaction. (expectedHash="0x211f260dbb90994afc634271d596bde5ddc17da85c24abca30691c1193f39f1b", returnedHash="0x8e0223f1a8627ed6b9677e0fb09bd02cda5f1cea0e19edebda44c771803bc697", version=4.0.13)

发现这好像是ganache版本的问题:

I experienced the same issue with ganache-cli@6.2.1 paired with ethers@4.0.12. Downgrading to ganache-cli@6.1.8 fixed the issue.

所以后面打算还是使用geth

 

2.

 Error: gas required exceeds allowance or always failing transaction

在运行合约函数时加上{gasLimit : 500000}即可,因为eth_estimateGas得出了infinite的结果

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM