Skip to main content
1 of 2
eth
  • 86.5k
  • 53
  • 287
  • 411

No. A deployed contract on a blockchain does not get deleted when Geth's console is closed.

Restarting the Geth Javascript console requires variables, like greeter, to be re-initialized because the Javascript variables are in memory only and not persisted.

One thing that can help:

Geth has support to load custom JavaScript files into the console through the --preload argument. This can be used to load often used functions, setup web3 contract objects, or ...

geth --preload "/my/scripts/folder/utils.js,/my/scripts/folder/contracts.js" console

For more information, including other ways to use Geth's console, see: https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console

Tools such as Truffle make ongoing contract development easier, for example Truffle saves contract addresses and ABIs, so that as @Rob mentions, re-initializing in Truffle, when needed, would be a simple greeter = Greeter.deployed().

eth
  • 86.5k
  • 53
  • 287
  • 411