I have deployed a contract on the ganache blockchain successfully using truffle.

In the truffle console, I can call the contract fine

truffle(development)> MyCoin
[Function: TruffleContract] {
  _constructorMethods: {
    configureNetwork: [Function: configureNetwork],

And even get the address like this:

truffle(development)> MyCoin.address

However, if I try and get an instance of the contract it returns undefined

truffle(development)> myToken = await MyCoin.deployed()
truffle(development)> myToken = await MyCoin.new()
truffle(development)> myToken = await MyCoin

My goal is to mint the contract, which doesn't work:

truffle(development)> MyCoin.mint(“0x63103644D45820EFb3cEBe188C7dA26F087797b4",100000);

Uncaught SyntaxError: Invalid or unexpected token

What could be the problem?


  • Is myToken undefined? The result printed on the console is sometimes unrelated to the value being assigned. Also you should execute myToken.mint(...) instead of MyCoin.mint(...).
    – Ismael
    Jun 17, 2020 at 15:40
  • Thanks for the clarification. Indeed it creates the new instance despite returning undefined, made it work now
    – vfurci200
    Jun 17, 2020 at 15:46

1 Answer 1


Still not sure why it returns undefined but this works and creates a new instance on the contract on ganache: truffle(development)> myToken = await MyCoin.new()

The error while minting was just a matter of changing the brackets:

truffle(development)> myToken.mint('0x63103644D45820EFb3cEBe188C7dA26F087797b4',100000)

It works now

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.