1

I followed this tutorial(read point 2 and 3)1: https://blog.zeppelin.solutions/the-hitchhikers-guide-to-smart-contracts-in-ethereum-848f08001f05 to create and deploy a simple smart contract, but at this point:

$ truffle console

// get the deployed version of our contract

truffle(default)> var poe = ProofOfExistence1.deployed()

// and print its address

truffle(default)> console.log(poe.address) 0x3d3bce79cccc331e9e095e8985def13651a86004

I can't print the address.. [enter image description here]

1 Answer 1

3

As of recent versions of truffle deployed() now returns a promise, so try something like:

var poe;
ProofOfExistence1
  .deployed()
  .then(function(result){ 
    poe = result; 
    console.log(poe.address);
  });
4
  • Perfect! It works now..thank you! Just another (dumb) question: If I want to execute a file,instead of writing the code, line by line, in the truffle console,how do I do it?
    – Nick9214
    Aug 25, 2017 at 12:58
  • And also can you suggest me an updated truffle tutorial??
    – Nick9214
    Aug 25, 2017 at 12:59
  • Beyond the Truffle docs I don't have a good suggestion for an up-to-date tutorial but on a quick glance at the one you linked I don't think much has changed since apart from things that used to return values now returning promises. Aug 25, 2017 at 23:20
  • the tutorial at truffleframework.com/tutorials/… is pretty decent and more recent Sep 14, 2017 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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