I'm having trouble testing a contract using truffle. I have the latest version of truffle installed as well a TestRPC.

It's to my understanding that the latest version of truffle comes with a client for testing SmartContracts so TestRPC isn't needed any more.

I have a simple contract my Migrations looks like so:

var Migrations = artifacts.require("./Migrations.sol");
var OrdersFacilitator = artifacts.require("./OrdersFacilitator.sol")

module.exports = function(deployer) {

When I run truffle develop I see that 10 test accounts are created.


(0) 0x627306090abab3a6e1400e9345bc60c78a8bef57

(1) 0xf17f52151ebef6c7334fad080c5704d77216b732 //...

My Truffle js is configured like so:

networks: {
  development: {
    host: "localhost",
    port: 9545,
    network_id: "*"

When I run the name of my contracts I can see its deployed with the information:

{ from: '0x627306090abab3a6e1400e9345bc60c78a8bef57',
 gas: 6721975,
 gasPrice: 100000000000 },
 HttpProvider {
   host: '',
   timeout: 0,
   user: undefined,
   password: undefined,
   headers: undefined,
   send: [Function],
   sendAsync: [Function],
   _alreadyWrapped: true },
network_id: '4447' }

the Network Id and the port seem to match the configuration fine, and I can see the information when I type the contract name, However when I try to gain access to it though

var facilitator;
OrdersFacilitator.deployed().then(x => facilitator = x);

I Get an Error:

OrdersFacilitator has not been deployed to detected network (network/artifact mismatch)

I've tried deleting the build folder and migrating all with the --reset flag but that doesn't seem to work. How can I Tested my deployed contract

  • Does it work if you use OrdersFacilitator.new().then(x => facilitator = x); Oct 21, 2018 at 22:46

1 Answer 1


I've seen similar issues withe Truffle projects attempting the same thing. The solution may be to reset the project to a non-cached state.

You can try running truffle compile (and/or truffle migrate) with the --reset flag. This will remove the build dir and recompile everything.

Alternatively you can try running your network explicitly:

Explicitly set the network options and network id.

//Start Test RPC with an Explicit Network
testrpc --network-id 1337

Create an explicit network for TestRPC:

networks: {
    host: "localhost",
    port: 8545,
    network_id: "1337"

Then Migrate Explicitly to the new network:

truffle migrate --network testrpc --reset
truffle console --network testrpc
  • Thanks I’ve tried deleting the build and using the Reset flag, no luck I’ll try using new
    – johnny 5
    Oct 21, 2018 at 23:45

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.