In Truffle's documentation, it says DeployedAddresses.sol is how Truffle identifies and stores the addresses of contracts published to the blockchain via truffle migrate.

How does this file work, and what does it look like? If I publish an Adoption contract, how does Truffle know that the word Adoption in truffle console refers to that contract?

2 Answers 2


Good qus. As far as I know. Truffle will store your contract address in build/contacts/[CONTRACT.json] file

Truffle will map contract address under network json object with index.

 "networks": {
    "1": {
      "events": {},
      "links": {},
      "address": "0x77685437e762aaa90d4b6924aa9445c1198013f1"
  "schemaVersion": "1.0.1",
  "updatedAt": "2018-02-16T10:49:18.298Z"

If you delete json file, It will create new json file with new contract id.

When you run migrate/console, truffle will refer your [CONTRACT.json] file with corresponding network and address.

  • 1
    How is the network number generated? e.g. You've shown "1" above. But on my local machine network number is "1532795656486" - which seems random. Commented Jul 28, 2018 at 17:22
  • The network number is read from the connected rpc client / blockchain. If you look into your ganache UI you see the network number which is set in the JSON in the top bar of the UI.
    – kiecodes
    Commented Jul 4, 2021 at 10:02

Truffle requires you to define Migrations by creating a deployer for the Adoptions contract.

For example migrations/2_deploy_contracts.js

var Adoption = artifacts.require("Adoption");

module.exports = function(deployer) {

Building the contract with truffle build also creates an JSON file build/contracts/Adoption.json which contains all required metadata.

DeployedAddresses.sol is created on runtime by truffle when you run tests.

See also: https://github.com/trufflesuite/truffle/issues/471#issuecomment-315166855

  • I knew all this going into asking this question. None of this answered my question unfortunately. Commented Feb 17, 2018 at 16:56
  • Maybe you need be more specific. ^^ You may also ask truffle support. E.g via Gitter truffleframework.com/support Commented Feb 20, 2018 at 14:50

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.