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:
C1.deployed().then(fucntion(ins){c1=ins})
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:
Uncaught:
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: "127.0.0.1",
port: 7545,
network_id: "*",
},
develop:{
port:8545
},
PrivEth:{
provider:function(){
return new Web3.providers.WebsocketProvider("ws://<ip>:8551");
},
network_id:"1111"
}
},
compilers: {
solc: {
version: "0.8.0",
}
}