I've been teaching myself ethereum via the stack solidity/truffle/truffle-contract/testrpc/metamask. I built a small dApp that runs on testrpc with proper unit tests which work great. I've written a function that I truffle serve that loads my contract named VEX from the local the file f_deployed_contract

$.getJSON(f_deployed_contract, function(data) {
    App.contracts.VEX = TruffleContract(data);

Everything works! I was excited, so I deployed the contract of the working solidity code using a combination of Remix and Ether Wallet to the mainnet. It was mined and now lives here:


Now, how do I adjust my TruffleContract so I can use my dApp with metamask on the mainnet?

1 Answer 1


Using TruffleContract, you can just specify the address of your contract when trying to interact with it. From the documenation:

var MetaCoin = require("./path/to/MetaCoin.sol.js");
MetaCoin.at(contract_address).then(function(instance) {
   //do promise things

So, Instead of using Metacoin.deployed() , which you're probably using, , you could use .at(address).

Also, your contract lives at 0x4f5a4501f96cb95eeda376f4caa0b24f4dbbd796, not 0xe5e6c5d463815e339a2aac2e92594de595e2029e6448997799871d8cb2a5728b. The second one is the transaction which created your contract, the first one is the address of your contract.

  • That makes sense. So if I deploy multiple copies of the same contract (same bytecode but in different places), I can just call the different contracts by using .at(address) for each one?
    – Hooked
    Sep 12, 2017 at 14:49
  • that would be correct
    – Qkyrie
    Sep 12, 2017 at 19:39

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.