I set Truffle to my private network. Now, I need to interact to a contract (C1) that deployed by another node of this network and I need to do that by Truffle. As I understood, I should define C1 to Truffle so that Truffle knows C1 deployed before. Because when I try this command on Truffle console:


This error throwed:

Error: C1 has not been deployed to detected network (network/artifact mismatch)

After some search, I tried these commands on Truffle console:

truffle(PrivEth)> const c1=await artifacts.require("C1")

truffle(PrivEth)> const C1=await c1.at('0x42C564EF81c9DF9338a62c13056FFEc84285a3DC')

But this error throwed:

Error: Cannot create instance of C1; no code at address 0x42C564EF81c9DF9338a62c13056FFEc84285a3DC

This error throwed while C1 deployed on that address by another Ethereum node from the network. I don't know why Truffle cannot see C1 code at the address. Do I miss anything on console? I don't know am I trying the commands by a correct way or not? Please provide the correct way, Thanks.

This is the Truffle config:

const Web3=require("web3");
module.exports = {
      networks: {
          development: {
      host: "",
      port: 7545,
      network_id: "*",
        return new Web3.providers.WebsocketProvider("ws://<ip>:8551");
compilers: {
    solc: {
      version: "0.8.0",

1 Answer 1


I found out what the problem is. When I wanted to connect Truffle console to PrivEth network I tried this:

truffle develop --network PrivEth

This caused C1 not be deployed into PrivEth. BTW, the C1's address was unknown for all other Ethereum nodes.

I changed the above command to:

truffle console --network PrivEth

And the issue resolved!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.