Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Could not fetch bytecode for contract at 0xA48... on chain 11155111, double check that the address and chainId are correct. #83

Open
Luan4560 opened this issue Mar 28, 2024 · 22 comments

Comments

@Luan4560
Copy link

I'm usign sepolia as test net but im getting this error.

Here my main.tsx

import React from 'react'
import ReactDOM from 'react-dom/client'
import { BrowserRouter as Router } from 'react-router-dom'
import { ThirdwebProvider } from '@thirdweb-dev/react'
import { App } from './App'
import './index.css'
import { StateContextProvider } from './context'
import { Sepolia } from "@thirdweb-dev/chains";

ReactDOM.createRoot(document.getElementById('root')!).render(
  <ThirdwebProvider activeChain={Sepolia} clientId='my-client-id'
  >
    <Router>
      <StateContextProvider>
        <App />
      </StateContextProvider>
    </Router>
  </ThirdwebProvider>
)

Someone could help ?

@CTW2000
Copy link

CTW2000 commented Mar 30, 2024

Maybe you should check the console in the chrome and make sure there is no error ,then your project can run

@rahulsingh-99
Copy link

I've also facing this same issue for 4 days but no one helped me till now

@Luan4560
Copy link
Author

Maybe you should check the console in the chrome and make sure there is no error ,then your project can run

image

@ala-bchir
Copy link

can you show me your hardhat.config file ?

@Luan4560
Copy link
Author

Luan4560 commented Apr 4, 2024

can you show me your hardhat.config file ?

import { HardhatUserConfig } from "hardhat/config";

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
  solidity: "0.8.24",
};

const config: HardhatUserConfig = {
  solidity: {
    version: "0.8.9",
    defaultNetwork: "sepolia",
    networks: {
      polygon: {
        url: "https://rpc.ankr.com/eth_sepolia",
        accounts: [`0x${process.env.PRIVATE_KEY}`],
      },
    },

    settings: {
      optimizer: {
        enabled: true,
        runs: 200,
      },
    },
  },
};

export default config;

@ala-bchir
Copy link

ala-bchir commented Apr 4, 2024

Try this one instead :

require("@matterlabs/hardhat-zksync-solc");

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
solidity: {
version: "0.8.17",
defaultNetwork: "sepolia",
networks: {
hardhat: {},
sepolia: {
url: "https://11155111.rpc.thirdweb.com",
accounts: [0x${process.env.PRIVATE_KEY}]
}
},
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
};

@ala-bchir
Copy link

and just to make sure that you did replace your clientId by you actual clientId ?

@rahulsingh-99
Copy link

Still facing the same issue

@RathoreAbhiii
Copy link

can you show me your hardhat.config file ?

import { HardhatUserConfig } from "hardhat/config";

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
  solidity: "0.8.24",
};

const config: HardhatUserConfig = {
  solidity: {
    version: "0.8.9",
    defaultNetwork: "sepolia",
    networks: {
      polygon: {
        url: "https://rpc.ankr.com/eth_sepolia",
        accounts: [`0x${process.env.PRIVATE_KEY}`],
      },
    },

    settings: {
      optimizer: {
        enabled: true,
        runs: 200,
      },
    },
  },
};

export default config;

Hey, did you try the suggestion? Did it work? Please update this thread if anyone got it working. Thanks!

@Chetan51423
Copy link

Maybe you should check the console in the chrome and make sure there is no error ,then your project can run

image

I am facing the same issue and have not been able to configure it for the last 2 days!
I am using Polygonamoy testnet . Please help me regarding this 🙏.

@supremex04
Copy link

supremex04 commented May 10, 2024

import React from "react";
import ReactDOM from "react-dom/client";
import {BrowserRouter as Router} from "react-router-dom";
import {ThirdwebProvider} from "@thirdweb-dev/react"
import { Sepolia } from "@thirdweb-dev/chains";

import { StateContextProvider } from "./context";
import App from "./App";
import "./index.css";
import dotenv from "dotenv";
dotenv.config();

const root = ReactDOM.createRoot(document.getElementById("root"));

root.render(
    <ThirdwebProvider activeChain={Sepolia} clientId= {process.env.CLIENT_ID}>
        <Router>
        <StateContextProvider>
        <App/>

        </StateContextProvider>
        </Router>
    </ThirdwebProvider>

)

I had got similar error. This is my main.jsx file, it works. Make sure you choose correct activeChain field ie. the chain where you deployed the contract and get clientId field from thirdweb here: https://thirdweb.com/dashboard/settings.

@nithishp
Copy link

I too had the same issue but after trying so many solutions it somehow got fixed. I don't know how it got fixed and the current code is somewhat similar to the code it started with when facing the problem but now it got fixed. This is my current code hope this helps
Screenshot (35)

@Akash-Mondal2004
Copy link

How do you fix the issue with connect wallet as useMetamask is deprecated.
Screenshot 2024-06-29 102732

@nithishp
Copy link

How do you fix the issue with connect wallet as useMetamask is deprecated. Screenshot 2024-06-29 102732

you can use useConnect('metamask') or useMetamask(). Even though useMetamask() is deprecated it still functions. Hope this helps.

@Akash-Mondal2004
Copy link

Thanks its working
and tell me how i delete a particular campaign that i created

@nithishp
Copy link

nithishp commented Jul 1, 2024

Thanks its working

and tell me how i delete a particular campaign that i created

After deployment data added to the smart contract cannot be deleted. Instead you can mark it using a flag as deleted and don't consider the campaign during rendering time if the flag is set to false.

@nithishp
Copy link

nithishp commented Jul 1, 2024

Thanks its working

and tell me how i delete a particular campaign that i created

The easiest way would just redeploy the whole contract again and update the lastest contract address in your code. Hope that helps. Sorry for bad English.

@Akash-Mondal2004
Copy link

yea this is possible but i want to implement that user who create a campaign wants to change the goal of raised amount or want to change any other specific data in the existing campaign so is it possible to edit the information

@supremex04
Copy link

function editCampaign(
        uint256 _id,
        string memory _title,
        string memory _description,
        uint256 _target,
        string memory _image
    ) public {
        Campaign storage campaign = campaigns[_id];

        require(msg.sender == campaign.owner, "Only the campaign owner can edit the campaign.");
        require(_target >= campaign.amountCollected, "New target must be greater than or equal to the amount already collected.");

        campaign.title = _title;
        campaign.description = _description;
        campaign.target = _target;
        campaign.image = _image;
    }
    ```


something like this should work

@rzalete
Copy link

rzalete commented Aug 29, 2024

import React from "react";
import ReactDOM from "react-dom/client";
import {BrowserRouter as Router} from "react-router-dom";
import {ThirdwebProvider} from "@thirdweb-dev/react"
import { Sepolia } from "@thirdweb-dev/chains";

import { StateContextProvider } from "./context";
import App from "./App";
import "./index.css";
import dotenv from "dotenv";
dotenv.config();

const root = ReactDOM.createRoot(document.getElementById("root"));

root.render(
    <ThirdwebProvider activeChain={Sepolia} clientId= {process.env.CLIENT_ID}>
        <Router>
        <StateContextProvider>
        <App/>

        </StateContextProvider>
        </Router>
    </ThirdwebProvider>

)

I had got similar error. This is my main.jsx file, it works. Make sure you choose correct activeChain field ie. the chain where you deployed the contract and get clientId field from thirdweb here: https://thirdweb.com/dashboard/settings.

I've written exact code like yours on my main.jsx like this :

import React from "react";
import ReactDOM from "react-dom/client";
import { BrowserRouter as Router } from "react-router-dom";
import { ThirdwebProvider } from "@thirdweb-dev/react";
import { Sepolia } from "@thirdweb-dev/chains";

import { StateContextProvider } from "./context";
import App from "./App";
import "./index.css";


const root = ReactDOM.createRoot(document.getElementById("root"));

root.render(
  <ThirdwebProvider activeChain={Sepolia} clientId='75d6302d3e055fc75b8fb56e3d00a115'>
    <Router>
      <StateContextProvider>
        <App />
      </StateContextProvider>
    </Router>
  </ThirdwebProvider>
);

But I still got this error :
image

Does anyone have the solution for this issue?

@Akash-Mondal2004
Copy link

import { ChainId, ThirdwebProvider} from '@thirdweb-dev/react';
try this

@rzalete
Copy link

rzalete commented Aug 30, 2024

import { ChainId, ThirdwebProvider} from '@thirdweb-dev/react';
try this

I don't think that'll fix it

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

No branches or pull requests

10 participants