When truffle compiles a contract, it creates a json file instead of a pair of abi and bin files.

These json files are called artifacts, and they should reside in a known location.

It is briefly explained here and here.

In the past, I used to see them after running truffle compile or truffle test.

Now, I am no longer able to see them anywhere.

Here is my truffle-config.js file:

// See <http://truffleframework.com/docs/advanced/configuration>
module.exports = {
    contracts_build_directory: "./build/contracts",
    networks: {
        development: {
            host: "",
            port: 8545,
            network_id: "*", // Match any network id
            gas: 4712388, // Gas limit used for deploys
            gasPrice: 100000000000, // Gas price used for deploys
    solc: {
        optimizer: {
            enabled: true,
            runs: 5000000,

Does anybody know where to find these artifacts?

Thank you!


In the folder {project root}/build/contracts/{contract name}.json

  • Yes. I don't see that folder created when I do truffle test. Initially, I thought it wasn't there after truffle compile, but now I see that this folder is indeed created using the latter. Does truffle test just create these files "internally"? You might read between the lines and understand that my aim is to avoid compilation on every truffle test. Jan 24 '18 at 16:07
  • From what i now json ABIs ( the artifacts ) are just created when compiling. My guess is that in test mode, the artifacts are directly loaded in memory to be used and instanciated.
    – Asone
    Jan 24 '18 at 16:10
  • Yeah artifacts are generated and loaded in memory when running tests. Especially because there are some deployments data (address, etc) and a test is by definition ephemeral. Jan 24 '18 at 16:19

OK, here are my findings:

truffle compile generates the artifacts under the folder specified by contracts_build_directory in the configuration file (or under build/contracts if not specified).

truffle test runs a compilation, but does not generate these files anywhere (or maybe generates them and then deletes them when the test is complete).

In order to prevent truffle test to run a compilation every time it is invoked, one can simply invoke truffle compile once.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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