2

So I did this simple greeter smart contact (tutorial here: https://www.ziggify.com/blog/blockchain-stack-1-installing-ethereum-geth-smart-contract/)

Very simple. Just a greeter.greet() and it returns hello world.

It works when I first did it. But then I logged in today and it no longer works saying greeter is not defined.

Why would my smart contract disappear? Why cant I use greeter anymore? I know its on the blockchain because it shows up on https://ropsten.etherscan.io

Any thoughts?

2 Answers 2

3

Nothing disapears, if you have mined your contract (deployed in the blockchain) as in the mentioned tutorial you need to have its address to call it anytime you want. in the tuto you have :

var _greeting = “hello world” ;
var greeterContract = web3.eth.contract(…..);
var greeter = greeterContract.new(

so you creates the contracts and you get back its address. in order to call it in the future you need to use :

var greeter = eth.contract(ABI).at(Address);

Edit to have a more complete answer: If you use http://ethereum.github.io/browser-solidity then ABI is 'Interface' and Address is the address when you mined the contract.

1
  • use at('0x....')
    – Badr Bellaj
    Commented Jul 12, 2017 at 22:27
1

Completely agree with Badr. From a troubleshooting standpoint some angles to consider :

Something about remembering about the contract has been lost on the client side.

Ropsten is the old mostly abandoned test net. Morden is the new one. Possibility of confusion over where it was deployed and where to check now? For example, the new Mist connects to a different testnet (id 3) than earlier versions (id 2) and that would look a lot like disappearance if you didn't know about the new chain.

Hope it helps.

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.