Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

Lesson 5 Deploy Error #85

Open
BurhanSiddiqui99 opened this issue Jun 13, 2023 · 9 comments
Open

Lesson 5 Deploy Error #85

BurhanSiddiqui99 opened this issue Jun 13, 2023 · 9 comments

Comments

@BurhanSiddiqui99
Copy link

const ethers = require("ethers");
const fs = require('fs-extra');
async function main() {
    const provider = new ethers.JsonRpcProvider("http://127.0.0.1:7545");
    const wallet = new ethers.Wallet("d6d40b7c0d84fe59ed43ef1eff8a1a51a1ea08198ff9779b9073a4a5f05b7f70", provider);
    const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8")
    const binary = fs.readFileSync(
        "./SimpleStorage_sol_SimpleStorage.bin",
        "utf8"
    );
    console.log(provider);
    const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
    console.log('Deploying...');
    const contract = await contractFactory.deploy();
    console.log(contract);
}
main()
    .then(() => process.exit(0))
    .catch((error) => {
        console.error(error)
        process.exit(1)
    })

Never run this line const contract = await contractFactory.deploy(); and prompt error
Error: missing revert data (action="estimateGas", data=null, reason=null, transaction

@PatrickAlphaC
Copy link
Owner

could you give me exactly the command your running and exact error?

@BurhanSiddiqui99
Copy link
Author

node filename.js

@Kingsobec
Copy link

hello
Please I followed the tutorial and I also did everything right ( I think) but I can't run node deploy.js. it keeps showing error.

below is my code

const ethers = require("ethers");

const fs = require("fs");

async function main() {
  //HTTP://127.0.0.1:7545
  //http://127.0.0.1:7545

  const provider = new ethers.provider.JsonRpcProvider("http://127.0.0.1:7545");
  const wallet = new ethers.Wallet(
    "0xc4e3e75fe7c27ae52be608f7e559f308eb931d721bf684c812cb81db3402000c",
    provider
  );
  const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
  const binary = fs.readFileSync(
    "./SimpleStorage_sol_SimpleStorage.bin",
    "utf8"
  );

  const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
  console.log("deploying, please wait");
  // console.log(bin, binary, wallet);

  const contract = await contractFactory.deploy();
  console.log(contract);
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error("error");
    process.exit(1);
  });

below is the error

root@ORACLE:~/folder/allSolidity/ethers-simple-storage# node deploy
/root/folder/allSolidity/ethers-simple-storage/deploy.js:9
  const provider = new ethers.provider.JsonRpcProvider("http://127.0.0.1:7545");
                                       ^

TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider')
    at main (/root/folder/allSolidity/ethers-simple-storage/deploy.js:9:40)
    at Object.<anonymous> (/root/folder/allSolidity/ethers-simple-storage/deploy.js:28:1)
    at Module._compile (node:internal/modules/cjs/loader:1119:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1173:10)
    at Module.load (node:internal/modules/cjs/loader:997:32)
    at Module._load (node:internal/modules/cjs/loader:838:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:18:47

@burningguy
Copy link

@Kingsobec

The correct way should be:

const provider = new ethers.JsonRpcProvider("RPC from ganache")

apparently the library has changed

@BurhanSiddiqui99
Copy link
Author

Thanks

@syf20020816
Copy link

@BurhanSiddiqui99
I got this error too .

How to solve

change this line:

  //deploy
  const contract = await contractFactory.deploy({ gasLimit: 3000000 });

after add gasLimit it works!
ethers ofter don't know how many gas the contract needed
I think my answer may help you

@faresdevweb
Copy link

Hey I have a similar issues here I have this code :

const ethers = require("ethers");
const fs = require("fs-extra");

async function main() {
  const provider = new ethers.JsonRpcProvider("HTTP://127.0.0.1:7545");
  const wallet = new ethers.Wallet(
    "0xa8ad19bcaa33e7bba6d7aa3085aece4e80e1b64a72a7336f077e56db3259d9a9",
    provider
  );
  const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
  const binary = fs.readFileSync(
    "./SimpleStorage_sol_SimpleStorage.bin",
    "utf8"
  );
  const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
  console.log("Deploying contract...");
  const contract = await contractFactory.deploy();
  console.log(contract);
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });

and here is the output of "node deploy.js" in my terminal ->

Deploying contract...
Error: missing revert data (action="estimateGas", data=null, reason=null, transaction={ "data": "0x608060405234801561000f575f80fd5b506108f28061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610055575f3560e01c80632e64cec1146100595780636057361d146100775780636f760f41146100935780638bab8dd5146100af5780639e7a13ad146100df575b5f80fd5b610061610110565b60405161006e919061029f565b60405180910390f35b610091600480360381019061008c91906102f3565b610118565b005b6100ad60048036038101906100a8919061045a565b610121565b005b6100c960048036038101906100c491906104b4565b6101a5565b6040516100d6919061029f565b60405180910390f35b6100f960048036038101906100f491906102f3565b6101d2565b604051610107929190610575565b60405180910390f35b5f8054905090565b805f8190555050565b6001604051806040016040528083815260200184815250908060018154018082558091505060019003905f5260205f2090600202015f909190919091505f820151815f0155602082015181600101908161017b919061079d565b5050508060028360405161018f91906108a6565b9081526020016040518091039020819055505050565b6002818051602081018201805184825260208301602085012081835280955050505050505f915090505481565b600181815481106101e1575f80fd5b905f5260205f2090600202015f91509050805f015490806001018054610206906105d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610232906105d0565b801561027d5780601f106102545761010080835404028352916020019161027d565b820191905f5260205f20905b81548152906001019060200180831161026057829003601f168201915b5050505050905082565b5f819050919050565b61029981610287565b82525050565b5f6020820190506102b25f830184610290565b92915050565b5f604051905090565b5f80fd5b5f80fd5b6102d281610287565b81146102dc575f80fd5b50565b5f813590506102ed816102c9565b92915050565b5f60208284031215610308576103076102c1565b5b5f610315848285016102df565b91505092915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61036c82610326565b810181811067ffffffffffffffff8211171561038b5761038a610336565b5b80604052505050565b5f61039d6102b8565b90506103a98282610363565b919050565b5f67ffffffffffffffff8211156103c8576103c7610336565b5b6103d182610326565b9050602081019050919050565b828183375f83830152505050565b5f6103fe6103f9846103ae565b610394565b90508281526020810184848401111561041a57610419610322565b5b6104258482856103de565b509392505050565b5f82601f8301126104415761044061031e565b5b81356104518482602086016103ec565b91505092915050565b5f80604083850312156104705761046f6102c1565b5b5f83013567ffffffffffffffff81111561048d5761048c6102c5565b5b6104998582860161042d565b92505060206104aa858286016102df565b9150509250929050565b5f602082840312156104c9576104c86102c1565b5b5f82013567ffffffffffffffff8111156104e6576104e56102c5565b5b6104f28482850161042d565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610532578082015181840152602081019050610517565b5f8484015250505050565b5f610547826104fb565b6105518185610505565b9350610561818560208601610515565b61056a81610326565b840191505092915050565b5f6040820190506105885f830185610290565b818103602083015261059a818461053d565b90509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806105e757607f821691505b6020821081036105fa576105f96105a3565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261065c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610621565b6106668683610621565b95508019841693508086168417925050509392505050565b5f819050919050565b5f6106a161069c61069784610287565b61067e565b610287565b9050919050565b5f819050919050565b6106ba83610687565b6106ce6106c6826106a8565b84845461062d565b825550505050565b5f90565b6106e26106d6565b6106ed8184846106b1565b505050565b5b81811015610710576107055f826106da565b6001810190506106f3565b5050565b601f8211156107555761072681610600565b61072f84610612565b8101602085101561073e578190505b61075261074a85610612565b8301826106f2565b50505b505050565b5f82821c905092915050565b5f6107755f198460080261075a565b1980831691505092915050565b5f61078d8383610766565b9150826002028217905092915050565b6107a6826104fb565b67ffffffffffffffff8111156107bf576107be610336565b5b6107c982546105d0565b6107d4828285610714565b5f60209050601f831160018114610805575f84156107f3578287015190505b6107fd8582610782565b865550610864565b601f19841661081386610600565b5f5b8281101561083a57848901518255600182019150602085019450602081019050610815565b868310156108575784890151610853601f891682610766565b8355505b6001600288020188555050505b505050505050565b5f81905092915050565b5f610880826104fb565b61088a818561086c565b935061089a818560208601610515565b80840191505092915050565b5f6108b18284610876565b91508190509291505056fea2646970667358221220e9c107bc77b34c4aa9e24b19ae6898ff552f5c48fbeaae40156ef6b8cbd2706a64736f6c63430008150033", "from": "0x50393B61C6781E9ef48A7e87056af15B540D7Ef1", "to": null }, invocation=null, revert=null, code=CALL_EXCEPTION, version=6.7.1)
    at makeError (/home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/utils/errors.js:125:21)
    at getBuiltinCallException (/home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/abi/abi-coder.js:104:37)
    at AbiCoder.getBuiltinCallException (/home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/abi/abi-coder.js:201:16)
    at JsonRpcProvider.getRpcError (/home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js:599:43)
    at /home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js:268:45
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'CALL_EXCEPTION',
  action: 'estimateGas',
  data: null,
  reason: null,
  transaction: {
    to: null,
    data: '0x608060405234801561000f575f80fd5b506108f28061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610055575f3560e01c80632e64cec1146100595780636057361d146100775780636f760f41146100935780638bab8dd5146100af5780639e7a13ad146100df575b5f80fd5b610061610110565b60405161006e919061029f565b60405180910390f35b610091600480360381019061008c91906102f3565b610118565b005b6100ad60048036038101906100a8919061045a565b610121565b005b6100c960048036038101906100c491906104b4565b6101a5565b6040516100d6919061029f565b60405180910390f35b6100f960048036038101906100f491906102f3565b6101d2565b604051610107929190610575565b60405180910390f35b5f8054905090565b805f8190555050565b6001604051806040016040528083815260200184815250908060018154018082558091505060019003905f5260205f2090600202015f909190919091505f820151815f0155602082015181600101908161017b919061079d565b5050508060028360405161018f91906108a6565b9081526020016040518091039020819055505050565b6002818051602081018201805184825260208301602085012081835280955050505050505f915090505481565b600181815481106101e1575f80fd5b905f5260205f2090600202015f91509050805f015490806001018054610206906105d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610232906105d0565b801561027d5780601f106102545761010080835404028352916020019161027d565b820191905f5260205f20905b81548152906001019060200180831161026057829003601f168201915b5050505050905082565b5f819050919050565b61029981610287565b82525050565b5f6020820190506102b25f830184610290565b92915050565b5f604051905090565b5f80fd5b5f80fd5b6102d281610287565b81146102dc575f80fd5b50565b5f813590506102ed816102c9565b92915050565b5f60208284031215610308576103076102c1565b5b5f610315848285016102df565b91505092915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61036c82610326565b810181811067ffffffffffffffff8211171561038b5761038a610336565b5b80604052505050565b5f61039d6102b8565b90506103a98282610363565b919050565b5f67ffffffffffffffff8211156103c8576103c7610336565b5b6103d182610326565b9050602081019050919050565b828183375f83830152505050565b5f6103fe6103f9846103ae565b610394565b90508281526020810184848401111561041a57610419610322565b5b6104258482856103de565b509392505050565b5f82601f8301126104415761044061031e565b5b81356104518482602086016103ec565b91505092915050565b5f80604083850312156104705761046f6102c1565b5b5f83013567ffffffffffffffff81111561048d5761048c6102c5565b5b6104998582860161042d565b92505060206104aa858286016102df565b9150509250929050565b5f602082840312156104c9576104c86102c1565b5b5f82013567ffffffffffffffff8111156104e6576104e56102c5565b5b6104f28482850161042d565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610532578082015181840152602081019050610517565b5f8484015250505050565b5f610547826104fb565b6105518185610505565b9350610561818560208601610515565b61056a81610326565b840191505092915050565b5f6040820190506105885f830185610290565b818103602083015261059a818461053d565b90509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806105e757607f821691505b6020821081036105fa576105f96105a3565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261065c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610621565b6106668683610621565b95508019841693508086168417925050509392505050565b5f819050919050565b5f6106a161069c61069784610287565b61067e565b610287565b9050919050565b5f819050919050565b6106ba83610687565b6106ce6106c6826106a8565b84845461062d565b825550505050565b5f90565b6106e26106d6565b6106ed8184846106b1565b505050565b5b81811015610710576107055f826106da565b6001810190506106f3565b5050565b601f8211156107555761072681610600565b61072f84610612565b8101602085101561073e578190505b61075261074a85610612565b8301826106f2565b50505b505050565b5f82821c905092915050565b5f6107755f198460080261075a565b1980831691505092915050565b5f61078d8383610766565b9150826002028217905092915050565b6107a6826104fb565b67ffffffffffffffff8111156107bf576107be610336565b5b6107c982546105d0565b6107d4828285610714565b5f60209050601f831160018114610805575f84156107f3578287015190505b6107fd8582610782565b865550610864565b601f19841661081386610600565b5f5b8281101561083a57848901518255600182019150602085019450602081019050610815565b868310156108575784890151610853601f891682610766565b8355505b6001600288020188555050505b505050505050565b5f81905092915050565b5f610880826104fb565b61088a818561086c565b935061089a818560208601610515565b80840191505092915050565b5f6108b18284610876565b91508190509291505056fea2646970667358221220e9c107bc77b34c4aa9e24b19ae6898ff552f5c48fbeaae40156ef6b8cbd2706a64736f6c63430008150033',
    from: '0x50393B61C6781E9ef48A7e87056af15B540D7Ef1'
  },
  invocation: null,
  revert: null,
  info: {
    error: {
      message: 'VM Exception while processing transaction: invalid opcode',
      stack: 'RuntimeError: VM Exception while processing transaction: invalid opcode\n' +
        '    at exactimate (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:182136)',
      code: -32000,
      name: 'RuntimeError',
      data: [Object]
    },
    payload: {
      method: 'eth_estimateGas',
      params: [Array],
      id: 4,
      jsonrpc: '2.0'
    }
  }
}

the contract works very well on remix, when I deploy on the JavaScript virtual machine, but not here, and I see nothing on Ganache when I do this way

I followed exactly whats does Patrick on the course, I've tried many things : add this parameter to the deploy methods :

const contract = await contractFactory.deploy({
    gasLimit: 10000000000,
    gasPrice: 1000000,
  });

and the error is now different :

Deploying contract...
Error: could not coalesce error (error={ "code": -32000, "message": "exceeds block gas limit", "stack": "Error: exceeds block gas limit\n    at TransactionPool.<anonymous> (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:120454)\n    at TransactionPool.prepareTransaction (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:120796)\n    at TransactionManager.add (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:138284)\n    at Blockchain.queueTransaction (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:70776)\n    at EthereumApi.eth_sendRawTransaction (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:88213)\n    at EthereumApi.n.value (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:238968)\n    at Object.execute (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:165607)\n    at RequestCoordinator.<anonymous> (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:165421)\n    at /tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:165687\n    at new Promise (<anonymous>)" }, payload={ "id": 9, "jsonrpc": "2.0", "method": "eth_sendRawTransaction", "params": [ "0x02f9096a8205390d830f4240830f42408502540be4008080b9090f608060405234801561000f575f80fd5b506108f28061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610055575f3560e01c80632e64cec1146100595780636057361d146100775780636f760f41146100935780638bab8dd5146100af5780639e7a13ad146100df575b5f80fd5b610061610110565b60405161006e919061029f565b60405180910390f35b610091600480360381019061008c91906102f3565b610118565b005b6100ad60048036038101906100a8919061045a565b610121565b005b6100c960048036038101906100c491906104b4565b6101a5565b6040516100d6919061029f565b60405180910390f35b6100f960048036038101906100f491906102f3565b6101d2565b604051610107929190610575565b60405180910390f35b5f8054905090565b805f8190555050565b6001604051806040016040528083815260200184815250908060018154018082558091505060019003905f5260205f2090600202015f909190919091505f820151815f0155602082015181600101908161017b919061079d565b5050508060028360405161018f91906108a6565b9081526020016040518091039020819055505050565b6002818051602081018201805184825260208301602085012081835280955050505050505f915090505481565b600181815481106101e1575f80fd5b905f5260205f2090600202015f91509050805f015490806001018054610206906105d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610232906105d0565b801561027d5780601f106102545761010080835404028352916020019161027d565b820191905f5260205f20905b81548152906001019060200180831161026057829003601f168201915b5050505050905082565b5f819050919050565b61029981610287565b82525050565b5f6020820190506102b25f830184610290565b92915050565b5f604051905090565b5f80fd5b5f80fd5b6102d281610287565b81146102dc575f80fd5b50565b5f813590506102ed816102c9565b92915050565b5f60208284031215610308576103076102c1565b5b5f610315848285016102df565b91505092915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61036c82610326565b810181811067ffffffffffffffff8211171561038b5761038a610336565b5b80604052505050565b5f61039d6102b8565b90506103a98282610363565b919050565b5f67ffffffffffffffff8211156103c8576103c7610336565b5b6103d182610326565b9050602081019050919050565b828183375f83830152505050565b5f6103fe6103f9846103ae565b610394565b90508281526020810184848401111561041a57610419610322565b5b6104258482856103de565b509392505050565b5f82601f8301126104415761044061031e565b5b81356104518482602086016103ec565b91505092915050565b5f80604083850312156104705761046f6102c1565b5b5f83013567ffffffffffffffff81111561048d5761048c6102c5565b5b6104998582860161042d565b92505060206104aa858286016102df565b9150509250929050565b5f602082840312156104c9576104c86102c1565b5b5f82013567ffffffffffffffff8111156104e6576104e56102c5565b5b6104f28482850161042d565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610532578082015181840152602081019050610517565b5f8484015250505050565b5f610547826104fb565b6105518185610505565b9350610561818560208601610515565b61056a81610326565b840191505092915050565b5f6040820190506105885f830185610290565b818103602083015261059a818461053d565b90509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806105e757607f821691505b6020821081036105fa576105f96105a3565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261065c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610621565b6106668683610621565b95508019841693508086168417925050509392505050565b5f819050919050565b5f6106a161069c61069784610287565b61067e565b610287565b9050919050565b5f819050919050565b6106ba83610687565b6106ce6106c6826106a8565b84845461062d565b825550505050565b5f90565b6106e26106d6565b6106ed8184846106b1565b505050565b5b81811015610710576107055f826106da565b6001810190506106f3565b5050565b601f8211156107555761072681610600565b61072f84610612565b8101602085101561073e578190505b61075261074a85610612565b8301826106f2565b50505b505050565b5f82821c905092915050565b5f6107755f198460080261075a565b1980831691505092915050565b5f61078d8383610766565b9150826002028217905092915050565b6107a6826104fb565b67ffffffffffffffff8111156107bf576107be610336565b5b6107c982546105d0565b6107d4828285610714565b5f60209050601f831160018114610805575f84156107f3578287015190505b6107fd8582610782565b865550610864565b601f19841661081386610600565b5f5b8281101561083a57848901518255600182019150602085019450602081019050610815565b868310156108575784890151610853601f891682610766565b8355505b6001600288020188555050505b505050505050565b5f81905092915050565b5f610880826104fb565b61088a818561086c565b935061089a818560208601610515565b80840191505092915050565b5f6108b18284610876565b91508190509291505056fea2646970667358221220e9c107bc77b34c4aa9e24b19ae6898ff552f5c48fbeaae40156ef6b8cbd2706a64736f6c63430008150033c080a090638520088a8a16810653bf49e5561b62bafe61be4e06798a5354327c28856fa0401571b1d2adaadd92f6db7a61b6a786be1ef6938fcd2e4409c1b2a82420dc5d" ] }, code=UNKNOWN_ERROR, version=6.7.1)
    at makeError (/home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/utils/errors.js:125:21)
    at JsonRpcProvider.getRpcError (/home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js:653:41)
    at /home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js:268:45
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'UNKNOWN_ERROR',
  error: {
    message: 'exceeds block gas limit',
    stack: 'Error: exceeds block gas limit\n' +
      '    at TransactionPool.<anonymous> (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:120454)\n' +
      '    at TransactionPool.prepareTransaction (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:120796)\n' +
      '    at TransactionManager.add (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:138284)\n' +
      '    at Blockchain.queueTransaction (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:70776)\n' +
      '    at EthereumApi.eth_sendRawTransaction (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:88213)\n' +
      '    at EthereumApi.n.value (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:238968)\n' +
      '    at Object.execute (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:165607)\n' +
      '    at RequestCoordinator.<anonymous> (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:165421)\n' +
      '    at /tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:165687\n' +
      '    at new Promise (<anonymous>)',
    code: -32000
  },
  payload: {
    method: 'eth_sendRawTransaction',
    params: [
      '0x02f9096a8205390d830f4240830f42408502540be4008080b9090f608060405234801561000f575f80fd5b506108f28061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610055575f3560e01c80632e64cec1146100595780636057361d146100775780636f760f41146100935780638bab8dd5146100af5780639e7a13ad146100df575b5f80fd5b610061610110565b60405161006e919061029f565b60405180910390f35b610091600480360381019061008c91906102f3565b610118565b005b6100ad60048036038101906100a8919061045a565b610121565b005b6100c960048036038101906100c491906104b4565b6101a5565b6040516100d6919061029f565b60405180910390f35b6100f960048036038101906100f491906102f3565b6101d2565b604051610107929190610575565b60405180910390f35b5f8054905090565b805f8190555050565b6001604051806040016040528083815260200184815250908060018154018082558091505060019003905f5260205f2090600202015f909190919091505f820151815f0155602082015181600101908161017b919061079d565b5050508060028360405161018f91906108a6565b9081526020016040518091039020819055505050565b6002818051602081018201805184825260208301602085012081835280955050505050505f915090505481565b600181815481106101e1575f80fd5b905f5260205f2090600202015f91509050805f015490806001018054610206906105d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610232906105d0565b801561027d5780601f106102545761010080835404028352916020019161027d565b820191905f5260205f20905b81548152906001019060200180831161026057829003601f168201915b5050505050905082565b5f819050919050565b61029981610287565b82525050565b5f6020820190506102b25f830184610290565b92915050565b5f604051905090565b5f80fd5b5f80fd5b6102d281610287565b81146102dc575f80fd5b50565b5f813590506102ed816102c9565b92915050565b5f60208284031215610308576103076102c1565b5b5f610315848285016102df565b91505092915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61036c82610326565b810181811067ffffffffffffffff8211171561038b5761038a610336565b5b80604052505050565b5f61039d6102b8565b90506103a98282610363565b919050565b5f67ffffffffffffffff8211156103c8576103c7610336565b5b6103d182610326565b9050602081019050919050565b828183375f83830152505050565b5f6103fe6103f9846103ae565b610394565b90508281526020810184848401111561041a57610419610322565b5b6104258482856103de565b509392505050565b5f82601f8301126104415761044061031e565b5b81356104518482602086016103ec565b91505092915050565b5f80604083850312156104705761046f6102c1565b5b5f83013567ffffffffffffffff81111561048d5761048c6102c5565b5b6104998582860161042d565b92505060206104aa858286016102df565b9150509250929050565b5f602082840312156104c9576104c86102c1565b5b5f82013567ffffffffffffffff8111156104e6576104e56102c5565b5b6104f28482850161042d565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610532578082015181840152602081019050610517565b5f8484015250505050565b5f610547826104fb565b6105518185610505565b9350610561818560208601610515565b61056a81610326565b840191505092915050565b5f6040820190506105885f830185610290565b818103602083015261059a818461053d565b90509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806105e757607f821691505b6020821081036105fa576105f96105a3565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261065c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610621565b6106668683610621565b95508019841693508086168417925050509392505050565b5f819050919050565b5f6106a161069c61069784610287565b61067e565b610287565b9050919050565b5f819050919050565b6106ba83610687565b6106ce6106c6826106a8565b84845461062d565b825550505050565b5f90565b6106e26106d6565b6106ed8184846106b1565b505050565b5b81811015610710576107055f826106da565b6001810190506106f3565b5050565b601f8211156107555761072681610600565b61072f84610612565b8101602085101561073e578190505b61075261074a85610612565b8301826106f2565b50505b505050565b5f82821c905092915050565b5f6107755f198460080261075a565b1980831691505092915050565b5f61078d8383610766565b9150826002028217905092915050565b6107a6826104fb565b67ffffffffffffffff8111156107bf576107be610336565b5b6107c982546105d0565b6107d4828285610714565b5f60209050601f831160018114610805575f84156107f3578287015190505b6107fd8582610782565b865550610864565b601f19841661081386610600565b5f5b8281101561083a57848901518255600182019150602085019450602081019050610815565b868310156108575784890151610853601f891682610766565b8355505b6001600288020188555050505b505050505050565b5f81905092915050565b5f610880826104fb565b61088a818561086c565b935061089a818560208601610515565b80840191505092915050565b5f6108b18284610876565b91508190509291505056fea2646970667358221220e9c107bc77b34c4aa9e24b19ae6898ff552f5c48fbeaae40156ef6b8cbd2706a64736f6c63430008150033c080a090638520088a8a16810653bf49e5561b62bafe61be4e06798a5354327c28856fa0401571b1d2adaadd92f6db7a61b6a786be1ef6938fcd2e4409c1b2a82420dc5d'
    ],
    id: 9,
    jsonrpc: '2.0'
  }
}

and the I see the contracts deployed to Ganache but I have not the same object that Patrick get in the course

any help please ?

@Mauricio-17
Copy link

Mauricio-17 commented Sep 8, 2023

Hey I have a similar issues here I have this code :

const ethers = require("ethers");
const fs = require("fs-extra");

async function main() {
  const provider = new ethers.JsonRpcProvider("HTTP://127.0.0.1:7545");
  const wallet = new ethers.Wallet(
    "0xa8ad19bcaa33e7bba6d7aa3085aece4e80e1b64a72a7336f077e56db3259d9a9",
    provider
  );
  const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
  const binary = fs.readFileSync(
    "./SimpleStorage_sol_SimpleStorage.bin",
    "utf8"
  );
  const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
  console.log("Deploying contract...");
  const contract = await contractFactory.deploy();
  console.log(contract);
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });

and here is the output of "node deploy.js" in my terminal ->

Deploying contract...
Error: missing revert data (action="estimateGas", data=null, reason=null, transaction={ "data": "0x608060405234801561000f575f80fd5b506108f28061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610055575f3560e01c80632e64cec1146100595780636057361d146100775780636f760f41146100935780638bab8dd5146100af5780639e7a13ad146100df575b5f80fd5b610061610110565b60405161006e919061029f565b60405180910390f35b610091600480360381019061008c91906102f3565b610118565b005b6100ad60048036038101906100a8919061045a565b610121565b005b6100c960048036038101906100c491906104b4565b6101a5565b6040516100d6919061029f565b60405180910390f35b6100f960048036038101906100f491906102f3565b6101d2565b604051610107929190610575565b60405180910390f35b5f8054905090565b805f8190555050565b6001604051806040016040528083815260200184815250908060018154018082558091505060019003905f5260205f2090600202015f909190919091505f820151815f0155602082015181600101908161017b919061079d565b5050508060028360405161018f91906108a6565b9081526020016040518091039020819055505050565b6002818051602081018201805184825260208301602085012081835280955050505050505f915090505481565b600181815481106101e1575f80fd5b905f5260205f2090600202015f91509050805f015490806001018054610206906105d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610232906105d0565b801561027d5780601f106102545761010080835404028352916020019161027d565b820191905f5260205f20905b81548152906001019060200180831161026057829003601f168201915b5050505050905082565b5f819050919050565b61029981610287565b82525050565b5f6020820190506102b25f830184610290565b92915050565b5f604051905090565b5f80fd5b5f80fd5b6102d281610287565b81146102dc575f80fd5b50565b5f813590506102ed816102c9565b92915050565b5f60208284031215610308576103076102c1565b5b5f610315848285016102df565b91505092915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61036c82610326565b810181811067ffffffffffffffff8211171561038b5761038a610336565b5b80604052505050565b5f61039d6102b8565b90506103a98282610363565b919050565b5f67ffffffffffffffff8211156103c8576103c7610336565b5b6103d182610326565b9050602081019050919050565b828183375f83830152505050565b5f6103fe6103f9846103ae565b610394565b90508281526020810184848401111561041a57610419610322565b5b6104258482856103de565b509392505050565b5f82601f8301126104415761044061031e565b5b81356104518482602086016103ec565b91505092915050565b5f80604083850312156104705761046f6102c1565b5b5f83013567ffffffffffffffff81111561048d5761048c6102c5565b5b6104998582860161042d565b92505060206104aa858286016102df565b9150509250929050565b5f602082840312156104c9576104c86102c1565b5b5f82013567ffffffffffffffff8111156104e6576104e56102c5565b5b6104f28482850161042d565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610532578082015181840152602081019050610517565b5f8484015250505050565b5f610547826104fb565b6105518185610505565b9350610561818560208601610515565b61056a81610326565b840191505092915050565b5f6040820190506105885f830185610290565b818103602083015261059a818461053d565b90509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806105e757607f821691505b6020821081036105fa576105f96105a3565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261065c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610621565b6106668683610621565b95508019841693508086168417925050509392505050565b5f819050919050565b5f6106a161069c61069784610287565b61067e565b610287565b9050919050565b5f819050919050565b6106ba83610687565b6106ce6106c6826106a8565b84845461062d565b825550505050565b5f90565b6106e26106d6565b6106ed8184846106b1565b505050565b5b81811015610710576107055f826106da565b6001810190506106f3565b5050565b601f8211156107555761072681610600565b61072f84610612565b8101602085101561073e578190505b61075261074a85610612565b8301826106f2565b50505b505050565b5f82821c905092915050565b5f6107755f198460080261075a565b1980831691505092915050565b5f61078d8383610766565b9150826002028217905092915050565b6107a6826104fb565b67ffffffffffffffff8111156107bf576107be610336565b5b6107c982546105d0565b6107d4828285610714565b5f60209050601f831160018114610805575f84156107f3578287015190505b6107fd8582610782565b865550610864565b601f19841661081386610600565b5f5b8281101561083a57848901518255600182019150602085019450602081019050610815565b868310156108575784890151610853601f891682610766565b8355505b6001600288020188555050505b505050505050565b5f81905092915050565b5f610880826104fb565b61088a818561086c565b935061089a818560208601610515565b80840191505092915050565b5f6108b18284610876565b91508190509291505056fea2646970667358221220e9c107bc77b34c4aa9e24b19ae6898ff552f5c48fbeaae40156ef6b8cbd2706a64736f6c63430008150033", "from": "0x50393B61C6781E9ef48A7e87056af15B540D7Ef1", "to": null }, invocation=null, revert=null, code=CALL_EXCEPTION, version=6.7.1)
    at makeError (/home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/utils/errors.js:125:21)
    at getBuiltinCallException (/home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/abi/abi-coder.js:104:37)
    at AbiCoder.getBuiltinCallException (/home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/abi/abi-coder.js:201:16)
    at JsonRpcProvider.getRpcError (/home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js:599:43)
    at /home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js:268:45
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'CALL_EXCEPTION',
  action: 'estimateGas',
  data: null,
  reason: null,
  transaction: {
    to: null,
    data: '0x608060405234801561000f575f80fd5b506108f28061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610055575f3560e01c80632e64cec1146100595780636057361d146100775780636f760f41146100935780638bab8dd5146100af5780639e7a13ad146100df575b5f80fd5b610061610110565b60405161006e919061029f565b60405180910390f35b610091600480360381019061008c91906102f3565b610118565b005b6100ad60048036038101906100a8919061045a565b610121565b005b6100c960048036038101906100c491906104b4565b6101a5565b6040516100d6919061029f565b60405180910390f35b6100f960048036038101906100f491906102f3565b6101d2565b604051610107929190610575565b60405180910390f35b5f8054905090565b805f8190555050565b6001604051806040016040528083815260200184815250908060018154018082558091505060019003905f5260205f2090600202015f909190919091505f820151815f0155602082015181600101908161017b919061079d565b5050508060028360405161018f91906108a6565b9081526020016040518091039020819055505050565b6002818051602081018201805184825260208301602085012081835280955050505050505f915090505481565b600181815481106101e1575f80fd5b905f5260205f2090600202015f91509050805f015490806001018054610206906105d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610232906105d0565b801561027d5780601f106102545761010080835404028352916020019161027d565b820191905f5260205f20905b81548152906001019060200180831161026057829003601f168201915b5050505050905082565b5f819050919050565b61029981610287565b82525050565b5f6020820190506102b25f830184610290565b92915050565b5f604051905090565b5f80fd5b5f80fd5b6102d281610287565b81146102dc575f80fd5b50565b5f813590506102ed816102c9565b92915050565b5f60208284031215610308576103076102c1565b5b5f610315848285016102df565b91505092915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61036c82610326565b810181811067ffffffffffffffff8211171561038b5761038a610336565b5b80604052505050565b5f61039d6102b8565b90506103a98282610363565b919050565b5f67ffffffffffffffff8211156103c8576103c7610336565b5b6103d182610326565b9050602081019050919050565b828183375f83830152505050565b5f6103fe6103f9846103ae565b610394565b90508281526020810184848401111561041a57610419610322565b5b6104258482856103de565b509392505050565b5f82601f8301126104415761044061031e565b5b81356104518482602086016103ec565b91505092915050565b5f80604083850312156104705761046f6102c1565b5b5f83013567ffffffffffffffff81111561048d5761048c6102c5565b5b6104998582860161042d565b92505060206104aa858286016102df565b9150509250929050565b5f602082840312156104c9576104c86102c1565b5b5f82013567ffffffffffffffff8111156104e6576104e56102c5565b5b6104f28482850161042d565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610532578082015181840152602081019050610517565b5f8484015250505050565b5f610547826104fb565b6105518185610505565b9350610561818560208601610515565b61056a81610326565b840191505092915050565b5f6040820190506105885f830185610290565b818103602083015261059a818461053d565b90509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806105e757607f821691505b6020821081036105fa576105f96105a3565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261065c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610621565b6106668683610621565b95508019841693508086168417925050509392505050565b5f819050919050565b5f6106a161069c61069784610287565b61067e565b610287565b9050919050565b5f819050919050565b6106ba83610687565b6106ce6106c6826106a8565b84845461062d565b825550505050565b5f90565b6106e26106d6565b6106ed8184846106b1565b505050565b5b81811015610710576107055f826106da565b6001810190506106f3565b5050565b601f8211156107555761072681610600565b61072f84610612565b8101602085101561073e578190505b61075261074a85610612565b8301826106f2565b50505b505050565b5f82821c905092915050565b5f6107755f198460080261075a565b1980831691505092915050565b5f61078d8383610766565b9150826002028217905092915050565b6107a6826104fb565b67ffffffffffffffff8111156107bf576107be610336565b5b6107c982546105d0565b6107d4828285610714565b5f60209050601f831160018114610805575f84156107f3578287015190505b6107fd8582610782565b865550610864565b601f19841661081386610600565b5f5b8281101561083a57848901518255600182019150602085019450602081019050610815565b868310156108575784890151610853601f891682610766565b8355505b6001600288020188555050505b505050505050565b5f81905092915050565b5f610880826104fb565b61088a818561086c565b935061089a818560208601610515565b80840191505092915050565b5f6108b18284610876565b91508190509291505056fea2646970667358221220e9c107bc77b34c4aa9e24b19ae6898ff552f5c48fbeaae40156ef6b8cbd2706a64736f6c63430008150033',
    from: '0x50393B61C6781E9ef48A7e87056af15B540D7Ef1'
  },
  invocation: null,
  revert: null,
  info: {
    error: {
      message: 'VM Exception while processing transaction: invalid opcode',
      stack: 'RuntimeError: VM Exception while processing transaction: invalid opcode\n' +
        '    at exactimate (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:182136)',
      code: -32000,
      name: 'RuntimeError',
      data: [Object]
    },
    payload: {
      method: 'eth_estimateGas',
      params: [Array],
      id: 4,
      jsonrpc: '2.0'
    }
  }
}

the contract works very well on remix, when I deploy on the JavaScript virtual machine, but not here, and I see nothing on Ganache when I do this way

I followed exactly whats does Patrick on the course, I've tried many things : add this parameter to the deploy methods :

const contract = await contractFactory.deploy({
    gasLimit: 10000000000,
    gasPrice: 1000000,
  });

and the error is now different :

Deploying contract...
Error: could not coalesce error (error={ "code": -32000, "message": "exceeds block gas limit", "stack": "Error: exceeds block gas limit\n    at TransactionPool.<anonymous> (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:120454)\n    at TransactionPool.prepareTransaction (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:120796)\n    at TransactionManager.add (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:138284)\n    at Blockchain.queueTransaction (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:70776)\n    at EthereumApi.eth_sendRawTransaction (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:88213)\n    at EthereumApi.n.value (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:238968)\n    at Object.execute (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:165607)\n    at RequestCoordinator.<anonymous> (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:165421)\n    at /tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:165687\n    at new Promise (<anonymous>)" }, payload={ "id": 9, "jsonrpc": "2.0", "method": "eth_sendRawTransaction", "params": [ "0x02f9096a8205390d830f4240830f42408502540be4008080b9090f608060405234801561000f575f80fd5b506108f28061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610055575f3560e01c80632e64cec1146100595780636057361d146100775780636f760f41146100935780638bab8dd5146100af5780639e7a13ad146100df575b5f80fd5b610061610110565b60405161006e919061029f565b60405180910390f35b610091600480360381019061008c91906102f3565b610118565b005b6100ad60048036038101906100a8919061045a565b610121565b005b6100c960048036038101906100c491906104b4565b6101a5565b6040516100d6919061029f565b60405180910390f35b6100f960048036038101906100f491906102f3565b6101d2565b604051610107929190610575565b60405180910390f35b5f8054905090565b805f8190555050565b6001604051806040016040528083815260200184815250908060018154018082558091505060019003905f5260205f2090600202015f909190919091505f820151815f0155602082015181600101908161017b919061079d565b5050508060028360405161018f91906108a6565b9081526020016040518091039020819055505050565b6002818051602081018201805184825260208301602085012081835280955050505050505f915090505481565b600181815481106101e1575f80fd5b905f5260205f2090600202015f91509050805f015490806001018054610206906105d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610232906105d0565b801561027d5780601f106102545761010080835404028352916020019161027d565b820191905f5260205f20905b81548152906001019060200180831161026057829003601f168201915b5050505050905082565b5f819050919050565b61029981610287565b82525050565b5f6020820190506102b25f830184610290565b92915050565b5f604051905090565b5f80fd5b5f80fd5b6102d281610287565b81146102dc575f80fd5b50565b5f813590506102ed816102c9565b92915050565b5f60208284031215610308576103076102c1565b5b5f610315848285016102df565b91505092915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61036c82610326565b810181811067ffffffffffffffff8211171561038b5761038a610336565b5b80604052505050565b5f61039d6102b8565b90506103a98282610363565b919050565b5f67ffffffffffffffff8211156103c8576103c7610336565b5b6103d182610326565b9050602081019050919050565b828183375f83830152505050565b5f6103fe6103f9846103ae565b610394565b90508281526020810184848401111561041a57610419610322565b5b6104258482856103de565b509392505050565b5f82601f8301126104415761044061031e565b5b81356104518482602086016103ec565b91505092915050565b5f80604083850312156104705761046f6102c1565b5b5f83013567ffffffffffffffff81111561048d5761048c6102c5565b5b6104998582860161042d565b92505060206104aa858286016102df565b9150509250929050565b5f602082840312156104c9576104c86102c1565b5b5f82013567ffffffffffffffff8111156104e6576104e56102c5565b5b6104f28482850161042d565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610532578082015181840152602081019050610517565b5f8484015250505050565b5f610547826104fb565b6105518185610505565b9350610561818560208601610515565b61056a81610326565b840191505092915050565b5f6040820190506105885f830185610290565b818103602083015261059a818461053d565b90509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806105e757607f821691505b6020821081036105fa576105f96105a3565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261065c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610621565b6106668683610621565b95508019841693508086168417925050509392505050565b5f819050919050565b5f6106a161069c61069784610287565b61067e565b610287565b9050919050565b5f819050919050565b6106ba83610687565b6106ce6106c6826106a8565b84845461062d565b825550505050565b5f90565b6106e26106d6565b6106ed8184846106b1565b505050565b5b81811015610710576107055f826106da565b6001810190506106f3565b5050565b601f8211156107555761072681610600565b61072f84610612565b8101602085101561073e578190505b61075261074a85610612565b8301826106f2565b50505b505050565b5f82821c905092915050565b5f6107755f198460080261075a565b1980831691505092915050565b5f61078d8383610766565b9150826002028217905092915050565b6107a6826104fb565b67ffffffffffffffff8111156107bf576107be610336565b5b6107c982546105d0565b6107d4828285610714565b5f60209050601f831160018114610805575f84156107f3578287015190505b6107fd8582610782565b865550610864565b601f19841661081386610600565b5f5b8281101561083a57848901518255600182019150602085019450602081019050610815565b868310156108575784890151610853601f891682610766565b8355505b6001600288020188555050505b505050505050565b5f81905092915050565b5f610880826104fb565b61088a818561086c565b935061089a818560208601610515565b80840191505092915050565b5f6108b18284610876565b91508190509291505056fea2646970667358221220e9c107bc77b34c4aa9e24b19ae6898ff552f5c48fbeaae40156ef6b8cbd2706a64736f6c63430008150033c080a090638520088a8a16810653bf49e5561b62bafe61be4e06798a5354327c28856fa0401571b1d2adaadd92f6db7a61b6a786be1ef6938fcd2e4409c1b2a82420dc5d" ] }, code=UNKNOWN_ERROR, version=6.7.1)
    at makeError (/home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/utils/errors.js:125:21)
    at JsonRpcProvider.getRpcError (/home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js:653:41)
    at /home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js:268:45
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'UNKNOWN_ERROR',
  error: {
    message: 'exceeds block gas limit',
    stack: 'Error: exceeds block gas limit\n' +
      '    at TransactionPool.<anonymous> (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:120454)\n' +
      '    at TransactionPool.prepareTransaction (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:120796)\n' +
      '    at TransactionManager.add (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:138284)\n' +
      '    at Blockchain.queueTransaction (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:70776)\n' +
      '    at EthereumApi.eth_sendRawTransaction (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:88213)\n' +
      '    at EthereumApi.n.value (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:238968)\n' +
      '    at Object.execute (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:165607)\n' +
      '    at RequestCoordinator.<anonymous> (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:165421)\n' +
      '    at /tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:165687\n' +
      '    at new Promise (<anonymous>)',
    code: -32000
  },
  payload: {
    method: 'eth_sendRawTransaction',
    params: [
      '0x02f9096a8205390d830f4240830f42408502540be4008080b9090f608060405234801561000f575f80fd5b506108f28061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610055575f3560e01c80632e64cec1146100595780636057361d146100775780636f760f41146100935780638bab8dd5146100af5780639e7a13ad146100df575b5f80fd5b610061610110565b60405161006e919061029f565b60405180910390f35b610091600480360381019061008c91906102f3565b610118565b005b6100ad60048036038101906100a8919061045a565b610121565b005b6100c960048036038101906100c491906104b4565b6101a5565b6040516100d6919061029f565b60405180910390f35b6100f960048036038101906100f491906102f3565b6101d2565b604051610107929190610575565b60405180910390f35b5f8054905090565b805f8190555050565b6001604051806040016040528083815260200184815250908060018154018082558091505060019003905f5260205f2090600202015f909190919091505f820151815f0155602082015181600101908161017b919061079d565b5050508060028360405161018f91906108a6565b9081526020016040518091039020819055505050565b6002818051602081018201805184825260208301602085012081835280955050505050505f915090505481565b600181815481106101e1575f80fd5b905f5260205f2090600202015f91509050805f015490806001018054610206906105d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610232906105d0565b801561027d5780601f106102545761010080835404028352916020019161027d565b820191905f5260205f20905b81548152906001019060200180831161026057829003601f168201915b5050505050905082565b5f819050919050565b61029981610287565b82525050565b5f6020820190506102b25f830184610290565b92915050565b5f604051905090565b5f80fd5b5f80fd5b6102d281610287565b81146102dc575f80fd5b50565b5f813590506102ed816102c9565b92915050565b5f60208284031215610308576103076102c1565b5b5f610315848285016102df565b91505092915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61036c82610326565b810181811067ffffffffffffffff8211171561038b5761038a610336565b5b80604052505050565b5f61039d6102b8565b90506103a98282610363565b919050565b5f67ffffffffffffffff8211156103c8576103c7610336565b5b6103d182610326565b9050602081019050919050565b828183375f83830152505050565b5f6103fe6103f9846103ae565b610394565b90508281526020810184848401111561041a57610419610322565b5b6104258482856103de565b509392505050565b5f82601f8301126104415761044061031e565b5b81356104518482602086016103ec565b91505092915050565b5f80604083850312156104705761046f6102c1565b5b5f83013567ffffffffffffffff81111561048d5761048c6102c5565b5b6104998582860161042d565b92505060206104aa858286016102df565b9150509250929050565b5f602082840312156104c9576104c86102c1565b5b5f82013567ffffffffffffffff8111156104e6576104e56102c5565b5b6104f28482850161042d565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610532578082015181840152602081019050610517565b5f8484015250505050565b5f610547826104fb565b6105518185610505565b9350610561818560208601610515565b61056a81610326565b840191505092915050565b5f6040820190506105885f830185610290565b818103602083015261059a818461053d565b90509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806105e757607f821691505b6020821081036105fa576105f96105a3565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261065c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610621565b6106668683610621565b95508019841693508086168417925050509392505050565b5f819050919050565b5f6106a161069c61069784610287565b61067e565b610287565b9050919050565b5f819050919050565b6106ba83610687565b6106ce6106c6826106a8565b84845461062d565b825550505050565b5f90565b6106e26106d6565b6106ed8184846106b1565b505050565b5b81811015610710576107055f826106da565b6001810190506106f3565b5050565b601f8211156107555761072681610600565b61072f84610612565b8101602085101561073e578190505b61075261074a85610612565b8301826106f2565b50505b505050565b5f82821c905092915050565b5f6107755f198460080261075a565b1980831691505092915050565b5f61078d8383610766565b9150826002028217905092915050565b6107a6826104fb565b67ffffffffffffffff8111156107bf576107be610336565b5b6107c982546105d0565b6107d4828285610714565b5f60209050601f831160018114610805575f84156107f3578287015190505b6107fd8582610782565b865550610864565b601f19841661081386610600565b5f5b8281101561083a57848901518255600182019150602085019450602081019050610815565b868310156108575784890151610853601f891682610766565b8355505b6001600288020188555050505b505050505050565b5f81905092915050565b5f610880826104fb565b61088a818561086c565b935061089a818560208601610515565b80840191505092915050565b5f6108b18284610876565b91508190509291505056fea2646970667358221220e9c107bc77b34c4aa9e24b19ae6898ff552f5c48fbeaae40156ef6b8cbd2706a64736f6c63430008150033c080a090638520088a8a16810653bf49e5561b62bafe61be4e06798a5354327c28856fa0401571b1d2adaadd92f6db7a61b6a786be1ef6938fcd2e4409c1b2a82420dc5d'
    ],
    id: 9,
    jsonrpc: '2.0'
  }
}

and the I see the contracts deployed to Ganache but I have not the same object that Patrick get in the course

any help please ?

I had the same issue, so I changed the SOLC version to 0.8.19 and repeated the process from the beginning. I found the solution here: https://ethereum.stackexchange.com/questions/150281/invalid-opcode-opcode-0x5f-not-defined

@SAMURAii-7
Copy link

SAMURAii-7 commented Nov 4, 2023

Hey I have a similar issues here I have this code :

const ethers = require("ethers");
const fs = require("fs-extra");

async function main() {
  const provider = new ethers.JsonRpcProvider("HTTP://127.0.0.1:7545");
  const wallet = new ethers.Wallet(
    "0xa8ad19bcaa33e7bba6d7aa3085aece4e80e1b64a72a7336f077e56db3259d9a9",
    provider
  );
  const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
  const binary = fs.readFileSync(
    "./SimpleStorage_sol_SimpleStorage.bin",
    "utf8"
  );
  const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
  console.log("Deploying contract...");
  const contract = await contractFactory.deploy();
  console.log(contract);
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });

and here is the output of "node deploy.js" in my terminal ->

Deploying contract...
Error: missing revert data (action="estimateGas", data=null, reason=null, transaction={ "data": "0x608060405234801561000f575f80fd5b506108f28061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610055575f3560e01c80632e64cec1146100595780636057361d146100775780636f760f41146100935780638bab8dd5146100af5780639e7a13ad146100df575b5f80fd5b610061610110565b60405161006e919061029f565b60405180910390f35b610091600480360381019061008c91906102f3565b610118565b005b6100ad60048036038101906100a8919061045a565b610121565b005b6100c960048036038101906100c491906104b4565b6101a5565b6040516100d6919061029f565b60405180910390f35b6100f960048036038101906100f491906102f3565b6101d2565b604051610107929190610575565b60405180910390f35b5f8054905090565b805f8190555050565b6001604051806040016040528083815260200184815250908060018154018082558091505060019003905f5260205f2090600202015f909190919091505f820151815f0155602082015181600101908161017b919061079d565b5050508060028360405161018f91906108a6565b9081526020016040518091039020819055505050565b6002818051602081018201805184825260208301602085012081835280955050505050505f915090505481565b600181815481106101e1575f80fd5b905f5260205f2090600202015f91509050805f015490806001018054610206906105d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610232906105d0565b801561027d5780601f106102545761010080835404028352916020019161027d565b820191905f5260205f20905b81548152906001019060200180831161026057829003601f168201915b5050505050905082565b5f819050919050565b61029981610287565b82525050565b5f6020820190506102b25f830184610290565b92915050565b5f604051905090565b5f80fd5b5f80fd5b6102d281610287565b81146102dc575f80fd5b50565b5f813590506102ed816102c9565b92915050565b5f60208284031215610308576103076102c1565b5b5f610315848285016102df565b91505092915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61036c82610326565b810181811067ffffffffffffffff8211171561038b5761038a610336565b5b80604052505050565b5f61039d6102b8565b90506103a98282610363565b919050565b5f67ffffffffffffffff8211156103c8576103c7610336565b5b6103d182610326565b9050602081019050919050565b828183375f83830152505050565b5f6103fe6103f9846103ae565b610394565b90508281526020810184848401111561041a57610419610322565b5b6104258482856103de565b509392505050565b5f82601f8301126104415761044061031e565b5b81356104518482602086016103ec565b91505092915050565b5f80604083850312156104705761046f6102c1565b5b5f83013567ffffffffffffffff81111561048d5761048c6102c5565b5b6104998582860161042d565b92505060206104aa858286016102df565b9150509250929050565b5f602082840312156104c9576104c86102c1565b5b5f82013567ffffffffffffffff8111156104e6576104e56102c5565b5b6104f28482850161042d565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610532578082015181840152602081019050610517565b5f8484015250505050565b5f610547826104fb565b6105518185610505565b9350610561818560208601610515565b61056a81610326565b840191505092915050565b5f6040820190506105885f830185610290565b818103602083015261059a818461053d565b90509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806105e757607f821691505b6020821081036105fa576105f96105a3565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261065c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610621565b6106668683610621565b95508019841693508086168417925050509392505050565b5f819050919050565b5f6106a161069c61069784610287565b61067e565b610287565b9050919050565b5f819050919050565b6106ba83610687565b6106ce6106c6826106a8565b84845461062d565b825550505050565b5f90565b6106e26106d6565b6106ed8184846106b1565b505050565b5b81811015610710576107055f826106da565b6001810190506106f3565b5050565b601f8211156107555761072681610600565b61072f84610612565b8101602085101561073e578190505b61075261074a85610612565b8301826106f2565b50505b505050565b5f82821c905092915050565b5f6107755f198460080261075a565b1980831691505092915050565b5f61078d8383610766565b9150826002028217905092915050565b6107a6826104fb565b67ffffffffffffffff8111156107bf576107be610336565b5b6107c982546105d0565b6107d4828285610714565b5f60209050601f831160018114610805575f84156107f3578287015190505b6107fd8582610782565b865550610864565b601f19841661081386610600565b5f5b8281101561083a57848901518255600182019150602085019450602081019050610815565b868310156108575784890151610853601f891682610766565b8355505b6001600288020188555050505b505050505050565b5f81905092915050565b5f610880826104fb565b61088a818561086c565b935061089a818560208601610515565b80840191505092915050565b5f6108b18284610876565b91508190509291505056fea2646970667358221220e9c107bc77b34c4aa9e24b19ae6898ff552f5c48fbeaae40156ef6b8cbd2706a64736f6c63430008150033", "from": "0x50393B61C6781E9ef48A7e87056af15B540D7Ef1", "to": null }, invocation=null, revert=null, code=CALL_EXCEPTION, version=6.7.1)
    at makeError (/home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/utils/errors.js:125:21)
    at getBuiltinCallException (/home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/abi/abi-coder.js:104:37)
    at AbiCoder.getBuiltinCallException (/home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/abi/abi-coder.js:201:16)
    at JsonRpcProvider.getRpcError (/home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js:599:43)
    at /home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js:268:45
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'CALL_EXCEPTION',
  action: 'estimateGas',
  data: null,
  reason: null,
  transaction: {
    to: null,
    data: '0x608060405234801561000f575f80fd5b506108f28061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610055575f3560e01c80632e64cec1146100595780636057361d146100775780636f760f41146100935780638bab8dd5146100af5780639e7a13ad146100df575b5f80fd5b610061610110565b60405161006e919061029f565b60405180910390f35b610091600480360381019061008c91906102f3565b610118565b005b6100ad60048036038101906100a8919061045a565b610121565b005b6100c960048036038101906100c491906104b4565b6101a5565b6040516100d6919061029f565b60405180910390f35b6100f960048036038101906100f491906102f3565b6101d2565b604051610107929190610575565b60405180910390f35b5f8054905090565b805f8190555050565b6001604051806040016040528083815260200184815250908060018154018082558091505060019003905f5260205f2090600202015f909190919091505f820151815f0155602082015181600101908161017b919061079d565b5050508060028360405161018f91906108a6565b9081526020016040518091039020819055505050565b6002818051602081018201805184825260208301602085012081835280955050505050505f915090505481565b600181815481106101e1575f80fd5b905f5260205f2090600202015f91509050805f015490806001018054610206906105d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610232906105d0565b801561027d5780601f106102545761010080835404028352916020019161027d565b820191905f5260205f20905b81548152906001019060200180831161026057829003601f168201915b5050505050905082565b5f819050919050565b61029981610287565b82525050565b5f6020820190506102b25f830184610290565b92915050565b5f604051905090565b5f80fd5b5f80fd5b6102d281610287565b81146102dc575f80fd5b50565b5f813590506102ed816102c9565b92915050565b5f60208284031215610308576103076102c1565b5b5f610315848285016102df565b91505092915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61036c82610326565b810181811067ffffffffffffffff8211171561038b5761038a610336565b5b80604052505050565b5f61039d6102b8565b90506103a98282610363565b919050565b5f67ffffffffffffffff8211156103c8576103c7610336565b5b6103d182610326565b9050602081019050919050565b828183375f83830152505050565b5f6103fe6103f9846103ae565b610394565b90508281526020810184848401111561041a57610419610322565b5b6104258482856103de565b509392505050565b5f82601f8301126104415761044061031e565b5b81356104518482602086016103ec565b91505092915050565b5f80604083850312156104705761046f6102c1565b5b5f83013567ffffffffffffffff81111561048d5761048c6102c5565b5b6104998582860161042d565b92505060206104aa858286016102df565b9150509250929050565b5f602082840312156104c9576104c86102c1565b5b5f82013567ffffffffffffffff8111156104e6576104e56102c5565b5b6104f28482850161042d565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610532578082015181840152602081019050610517565b5f8484015250505050565b5f610547826104fb565b6105518185610505565b9350610561818560208601610515565b61056a81610326565b840191505092915050565b5f6040820190506105885f830185610290565b818103602083015261059a818461053d565b90509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806105e757607f821691505b6020821081036105fa576105f96105a3565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261065c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610621565b6106668683610621565b95508019841693508086168417925050509392505050565b5f819050919050565b5f6106a161069c61069784610287565b61067e565b610287565b9050919050565b5f819050919050565b6106ba83610687565b6106ce6106c6826106a8565b84845461062d565b825550505050565b5f90565b6106e26106d6565b6106ed8184846106b1565b505050565b5b81811015610710576107055f826106da565b6001810190506106f3565b5050565b601f8211156107555761072681610600565b61072f84610612565b8101602085101561073e578190505b61075261074a85610612565b8301826106f2565b50505b505050565b5f82821c905092915050565b5f6107755f198460080261075a565b1980831691505092915050565b5f61078d8383610766565b9150826002028217905092915050565b6107a6826104fb565b67ffffffffffffffff8111156107bf576107be610336565b5b6107c982546105d0565b6107d4828285610714565b5f60209050601f831160018114610805575f84156107f3578287015190505b6107fd8582610782565b865550610864565b601f19841661081386610600565b5f5b8281101561083a57848901518255600182019150602085019450602081019050610815565b868310156108575784890151610853601f891682610766565b8355505b6001600288020188555050505b505050505050565b5f81905092915050565b5f610880826104fb565b61088a818561086c565b935061089a818560208601610515565b80840191505092915050565b5f6108b18284610876565b91508190509291505056fea2646970667358221220e9c107bc77b34c4aa9e24b19ae6898ff552f5c48fbeaae40156ef6b8cbd2706a64736f6c63430008150033',
    from: '0x50393B61C6781E9ef48A7e87056af15B540D7Ef1'
  },
  invocation: null,
  revert: null,
  info: {
    error: {
      message: 'VM Exception while processing transaction: invalid opcode',
      stack: 'RuntimeError: VM Exception while processing transaction: invalid opcode\n' +
        '    at exactimate (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:182136)',
      code: -32000,
      name: 'RuntimeError',
      data: [Object]
    },
    payload: {
      method: 'eth_estimateGas',
      params: [Array],
      id: 4,
      jsonrpc: '2.0'
    }
  }
}

the contract works very well on remix, when I deploy on the JavaScript virtual machine, but not here, and I see nothing on Ganache when I do this way
I followed exactly whats does Patrick on the course, I've tried many things : add this parameter to the deploy methods :

const contract = await contractFactory.deploy({
    gasLimit: 10000000000,
    gasPrice: 1000000,
  });

and the error is now different :

Deploying contract...
Error: could not coalesce error (error={ "code": -32000, "message": "exceeds block gas limit", "stack": "Error: exceeds block gas limit\n    at TransactionPool.<anonymous> (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:120454)\n    at TransactionPool.prepareTransaction (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:120796)\n    at TransactionManager.add (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:138284)\n    at Blockchain.queueTransaction (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:70776)\n    at EthereumApi.eth_sendRawTransaction (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:88213)\n    at EthereumApi.n.value (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:238968)\n    at Object.execute (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:165607)\n    at RequestCoordinator.<anonymous> (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:165421)\n    at /tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:165687\n    at new Promise (<anonymous>)" }, payload={ "id": 9, "jsonrpc": "2.0", "method": "eth_sendRawTransaction", "params": [ "0x02f9096a8205390d830f4240830f42408502540be4008080b9090f608060405234801561000f575f80fd5b506108f28061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610055575f3560e01c80632e64cec1146100595780636057361d146100775780636f760f41146100935780638bab8dd5146100af5780639e7a13ad146100df575b5f80fd5b610061610110565b60405161006e919061029f565b60405180910390f35b610091600480360381019061008c91906102f3565b610118565b005b6100ad60048036038101906100a8919061045a565b610121565b005b6100c960048036038101906100c491906104b4565b6101a5565b6040516100d6919061029f565b60405180910390f35b6100f960048036038101906100f491906102f3565b6101d2565b604051610107929190610575565b60405180910390f35b5f8054905090565b805f8190555050565b6001604051806040016040528083815260200184815250908060018154018082558091505060019003905f5260205f2090600202015f909190919091505f820151815f0155602082015181600101908161017b919061079d565b5050508060028360405161018f91906108a6565b9081526020016040518091039020819055505050565b6002818051602081018201805184825260208301602085012081835280955050505050505f915090505481565b600181815481106101e1575f80fd5b905f5260205f2090600202015f91509050805f015490806001018054610206906105d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610232906105d0565b801561027d5780601f106102545761010080835404028352916020019161027d565b820191905f5260205f20905b81548152906001019060200180831161026057829003601f168201915b5050505050905082565b5f819050919050565b61029981610287565b82525050565b5f6020820190506102b25f830184610290565b92915050565b5f604051905090565b5f80fd5b5f80fd5b6102d281610287565b81146102dc575f80fd5b50565b5f813590506102ed816102c9565b92915050565b5f60208284031215610308576103076102c1565b5b5f610315848285016102df565b91505092915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61036c82610326565b810181811067ffffffffffffffff8211171561038b5761038a610336565b5b80604052505050565b5f61039d6102b8565b90506103a98282610363565b919050565b5f67ffffffffffffffff8211156103c8576103c7610336565b5b6103d182610326565b9050602081019050919050565b828183375f83830152505050565b5f6103fe6103f9846103ae565b610394565b90508281526020810184848401111561041a57610419610322565b5b6104258482856103de565b509392505050565b5f82601f8301126104415761044061031e565b5b81356104518482602086016103ec565b91505092915050565b5f80604083850312156104705761046f6102c1565b5b5f83013567ffffffffffffffff81111561048d5761048c6102c5565b5b6104998582860161042d565b92505060206104aa858286016102df565b9150509250929050565b5f602082840312156104c9576104c86102c1565b5b5f82013567ffffffffffffffff8111156104e6576104e56102c5565b5b6104f28482850161042d565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610532578082015181840152602081019050610517565b5f8484015250505050565b5f610547826104fb565b6105518185610505565b9350610561818560208601610515565b61056a81610326565b840191505092915050565b5f6040820190506105885f830185610290565b818103602083015261059a818461053d565b90509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806105e757607f821691505b6020821081036105fa576105f96105a3565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261065c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610621565b6106668683610621565b95508019841693508086168417925050509392505050565b5f819050919050565b5f6106a161069c61069784610287565b61067e565b610287565b9050919050565b5f819050919050565b6106ba83610687565b6106ce6106c6826106a8565b84845461062d565b825550505050565b5f90565b6106e26106d6565b6106ed8184846106b1565b505050565b5b81811015610710576107055f826106da565b6001810190506106f3565b5050565b601f8211156107555761072681610600565b61072f84610612565b8101602085101561073e578190505b61075261074a85610612565b8301826106f2565b50505b505050565b5f82821c905092915050565b5f6107755f198460080261075a565b1980831691505092915050565b5f61078d8383610766565b9150826002028217905092915050565b6107a6826104fb565b67ffffffffffffffff8111156107bf576107be610336565b5b6107c982546105d0565b6107d4828285610714565b5f60209050601f831160018114610805575f84156107f3578287015190505b6107fd8582610782565b865550610864565b601f19841661081386610600565b5f5b8281101561083a57848901518255600182019150602085019450602081019050610815565b868310156108575784890151610853601f891682610766565b8355505b6001600288020188555050505b505050505050565b5f81905092915050565b5f610880826104fb565b61088a818561086c565b935061089a818560208601610515565b80840191505092915050565b5f6108b18284610876565b91508190509291505056fea2646970667358221220e9c107bc77b34c4aa9e24b19ae6898ff552f5c48fbeaae40156ef6b8cbd2706a64736f6c63430008150033c080a090638520088a8a16810653bf49e5561b62bafe61be4e06798a5354327c28856fa0401571b1d2adaadd92f6db7a61b6a786be1ef6938fcd2e4409c1b2a82420dc5d" ] }, code=UNKNOWN_ERROR, version=6.7.1)
    at makeError (/home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/utils/errors.js:125:21)
    at JsonRpcProvider.getRpcError (/home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js:653:41)
    at /home/fares/Bureau/webdevelopment/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js:268:45
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'UNKNOWN_ERROR',
  error: {
    message: 'exceeds block gas limit',
    stack: 'Error: exceeds block gas limit\n' +
      '    at TransactionPool.<anonymous> (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:120454)\n' +
      '    at TransactionPool.prepareTransaction (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:120796)\n' +
      '    at TransactionManager.add (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:138284)\n' +
      '    at Blockchain.queueTransaction (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:70776)\n' +
      '    at EthereumApi.eth_sendRawTransaction (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:88213)\n' +
      '    at EthereumApi.n.value (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:238968)\n' +
      '    at Object.execute (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:165607)\n' +
      '    at RequestCoordinator.<anonymous> (/tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:165421)\n' +
      '    at /tmp/.mount_ganachJ9uY2t/resources/static/node/node_modules/ganache/dist/node/1.js:2:165687\n' +
      '    at new Promise (<anonymous>)',
    code: -32000
  },
  payload: {
    method: 'eth_sendRawTransaction',
    params: [
      '0x02f9096a8205390d830f4240830f42408502540be4008080b9090f608060405234801561000f575f80fd5b506108f28061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610055575f3560e01c80632e64cec1146100595780636057361d146100775780636f760f41146100935780638bab8dd5146100af5780639e7a13ad146100df575b5f80fd5b610061610110565b60405161006e919061029f565b60405180910390f35b610091600480360381019061008c91906102f3565b610118565b005b6100ad60048036038101906100a8919061045a565b610121565b005b6100c960048036038101906100c491906104b4565b6101a5565b6040516100d6919061029f565b60405180910390f35b6100f960048036038101906100f491906102f3565b6101d2565b604051610107929190610575565b60405180910390f35b5f8054905090565b805f8190555050565b6001604051806040016040528083815260200184815250908060018154018082558091505060019003905f5260205f2090600202015f909190919091505f820151815f0155602082015181600101908161017b919061079d565b5050508060028360405161018f91906108a6565b9081526020016040518091039020819055505050565b6002818051602081018201805184825260208301602085012081835280955050505050505f915090505481565b600181815481106101e1575f80fd5b905f5260205f2090600202015f91509050805f015490806001018054610206906105d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610232906105d0565b801561027d5780601f106102545761010080835404028352916020019161027d565b820191905f5260205f20905b81548152906001019060200180831161026057829003601f168201915b5050505050905082565b5f819050919050565b61029981610287565b82525050565b5f6020820190506102b25f830184610290565b92915050565b5f604051905090565b5f80fd5b5f80fd5b6102d281610287565b81146102dc575f80fd5b50565b5f813590506102ed816102c9565b92915050565b5f60208284031215610308576103076102c1565b5b5f610315848285016102df565b91505092915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61036c82610326565b810181811067ffffffffffffffff8211171561038b5761038a610336565b5b80604052505050565b5f61039d6102b8565b90506103a98282610363565b919050565b5f67ffffffffffffffff8211156103c8576103c7610336565b5b6103d182610326565b9050602081019050919050565b828183375f83830152505050565b5f6103fe6103f9846103ae565b610394565b90508281526020810184848401111561041a57610419610322565b5b6104258482856103de565b509392505050565b5f82601f8301126104415761044061031e565b5b81356104518482602086016103ec565b91505092915050565b5f80604083850312156104705761046f6102c1565b5b5f83013567ffffffffffffffff81111561048d5761048c6102c5565b5b6104998582860161042d565b92505060206104aa858286016102df565b9150509250929050565b5f602082840312156104c9576104c86102c1565b5b5f82013567ffffffffffffffff8111156104e6576104e56102c5565b5b6104f28482850161042d565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610532578082015181840152602081019050610517565b5f8484015250505050565b5f610547826104fb565b6105518185610505565b9350610561818560208601610515565b61056a81610326565b840191505092915050565b5f6040820190506105885f830185610290565b818103602083015261059a818461053d565b90509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806105e757607f821691505b6020821081036105fa576105f96105a3565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261065c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610621565b6106668683610621565b95508019841693508086168417925050509392505050565b5f819050919050565b5f6106a161069c61069784610287565b61067e565b610287565b9050919050565b5f819050919050565b6106ba83610687565b6106ce6106c6826106a8565b84845461062d565b825550505050565b5f90565b6106e26106d6565b6106ed8184846106b1565b505050565b5b81811015610710576107055f826106da565b6001810190506106f3565b5050565b601f8211156107555761072681610600565b61072f84610612565b8101602085101561073e578190505b61075261074a85610612565b8301826106f2565b50505b505050565b5f82821c905092915050565b5f6107755f198460080261075a565b1980831691505092915050565b5f61078d8383610766565b9150826002028217905092915050565b6107a6826104fb565b67ffffffffffffffff8111156107bf576107be610336565b5b6107c982546105d0565b6107d4828285610714565b5f60209050601f831160018114610805575f84156107f3578287015190505b6107fd8582610782565b865550610864565b601f19841661081386610600565b5f5b8281101561083a57848901518255600182019150602085019450602081019050610815565b868310156108575784890151610853601f891682610766565b8355505b6001600288020188555050505b505050505050565b5f81905092915050565b5f610880826104fb565b61088a818561086c565b935061089a818560208601610515565b80840191505092915050565b5f6108b18284610876565b91508190509291505056fea2646970667358221220e9c107bc77b34c4aa9e24b19ae6898ff552f5c48fbeaae40156ef6b8cbd2706a64736f6c63430008150033c080a090638520088a8a16810653bf49e5561b62bafe61be4e06798a5354327c28856fa0401571b1d2adaadd92f6db7a61b6a786be1ef6938fcd2e4409c1b2a82420dc5d'
    ],
    id: 9,
    jsonrpc: '2.0'
  }
}

and the I see the contracts deployed to Ganache but I have not the same object that Patrick get in the course
any help please ?

I had the same issue, so I changed the SOLC version to 0.8.19 and repeated the process from the beginning. I found the solution here: https://ethereum.stackexchange.com/questions/150281/invalid-opcode-opcode-0x5f-not-defined

This worked for me.
If you guys have installed solc using yarn add solc then type yarn add [email protected] to change solc version to 0.8.19. Also change the solidity version in SimpleStorage.sol to 0.8.19. Then compile again and run the deploy.js file.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants