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]

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);
  });
  • 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 '17 at 12:58
  • And also can you suggest me an updated truffle tutorial?? – Nick9214 Aug 25 '17 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. – Edmund Edgar Aug 25 '17 at 23:20
  • the tutorial at truffleframework.com/tutorials/… is pretty decent and more recent – Tom Carchrae Sep 14 '17 at 18:29

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.