Closed iccicci closed 5 years ago
I can confirm that ganache doesn't work for version 48,49,50. A single operation like this crashes:
await web3.eth.sendTransaction({from: ACCOUNTS[0], to: ACCOUNTS[1], value: 1})
This code was working until beta 37. Versions 37-46 were incompatible with ganache.
@iccicci Thanks for opening this issue! I've checked it and ganache is returning an invalid value in the status property. As documented in the JSON-RPC API of geth and parity should the status field contain a hex string and not a boolean.
@fireblockdev Web3.js is using the eth_chainId
JSON-RPC method to determine the chain id of the actual connected chain and ganache doesn't have it implemented until now (I've informed them). The eth_chainId
implementation got merged on the 08.18.2017 in geth and parity merged it on the 09.26.2017.
Because of this do I close this issue and ask you to open a new one in the ganache repository.
Thank you very much for your extremely fast reaction, guys!
It seems there already is a issue tracking that: https://github.com/trufflesuite/ganache-core/issues/339 @nivida can you please confirm it's actually what's missed in ganache to solve my case?
Thank you again, iCC
So how to solve it, wait ganache fix?
@nivida Hi nivida, why I deploy contract to infura got the same error, is infura use ganache too?
deploy.js:
const path = require('path');
const Web3 = require('web3');
const HdWalletProvider = require('truffle-hdwallet-provider');
const Imooc = require(path.resolve(__dirname, '../src/compiled/Imooc.json'));
const mnemonic = 'xxxxxx';
const url = 'https://ropsten.infura.io/v3/xxxxxx';
const provider = new HdWalletProvider(mnemonic, url);
const web3 = new Web3(provider);
(async () => {
const accounts = await web3.eth.getAccounts();
console.log('合约部署的账号: ', accounts[0]);
const courseList = await new web3.eth.Contract(Imooc.CourseList.abi, accounts[0]);
const result = await courseList.deploy({
data: Imooc.CourseList.evm.bytecode.object
})
.send({
from: accounts[0],
gas: 5000000
});
console.log('合约部署到的地址:', result.options.address);
})();
@iccicci There are two specific issues here, one is an internal posting error and the other is Ganache failing to deal with eth_chainId correctly. The two references (issue/PR) above this post have more information about the "reverted by EVM" problem.
Description
Even if following the doc, I get the error in subject if I try to use a Web3 version higher than 1.0.0-beta.46
Expected behavior
Simply "42" as output.
Actual behavior
With version "1.0.0-beta.46": simply "42" as output. With version higher that "1.0.0-beta.46" (beta[47, 50] when I write) following error:
Steps to reproduce the behavior
In an empty directory create following two files:
package.json
report.js
Then issue following two commands:
Please note the the reason I'm reporting the problem here is that only changing Web3 version to "1.0.0-beta.46" everything works as expected.
Versions
Thank you all, iCC