After loads of research, it seems the Ethereum.org Greeter example code no longer works. Here's the GitHub issues thread: https://github.com/ethereum/go-ethereum/issues/3793. There are some suggestions, one I will mention below, though, as a noob, it's still unclear.

This is a likely first place to land when starting to develop Ethereum, so I (and many others out there) are looking for a clear workaround.

Greeter example: https://www.ethereum.org/greeter

Running in geth console, here's the broken code with errors:


Error: The method eth_getCompilers does not exist/is not available
    at web3.js:3104:20
    at web3.js:6191:15
    at web3.js:5004:36
    at <anonymous>:1:1

var greeterSource = 'contract mortal { address owner; function mortal() { owner = msg.sender; } function kill() { if (msg.sender == owner) selfdestruct(owner); } } contract greeter is mortal { string greeting; function greeter(string _greeting) public { greeting = _greeting; } function greet() constant returns (string) { return greeting; } }' <-- obviously no error here

var greeterCompiled = web3.eth.compile.solidity(greeterSource)*

Error: The method eth_compileSolidity does not exist/is not available
    at web3.js:3104:20
    at web3.js:6191:15
    at web3.js:5004:36
    at <anonymous>:1:23

I HAVE been able to compile greeterSource with 'solc', and I tried this suggestion on the GitHub thread above, though I'm not sure this will work within geth console:

var fs = require('fs');
var exec = require('child_process').execSync;

exec('solc --bin --abi --optimize -o bin greeterSource.sol');

var abi = fs.readFileSync('bin/Greeter.abi');
var compiled = '0x' + fs.readFileSync('bin/Greeter.bin');

Even after npm install fs, I still get this:

Error: Cannot find module 'fs'
    at s (web3.js:1:160)
    at s (web3.js:1:122)
    at <anonymous>:1:10

This should handle the next step in the Greeter example:

var greeterContract = web3.eth.contract(greeterCompiled.greeter.info.abiDefinition);

Again, new to Ethereum development, Im sure after a bit I will have a better grasp on the fundamentals, though considering this example is coming from Ethereum.org, this should be easier! Thanks!

P.S.> Also open for advice on an overall better dev path. I do like starting with command line to learn, though once I get it, what tools would you recommend?

3 Answers 3


Geth and web3 lib has no compiling abilities (like web3.eth.compile.solidity()) since version 1.6.0

So the way you can try out to deploy Greeter contract is compiling it with solc and then importing results to geth console. Here's full example of such approach:

How to compile Solidity contracts with Geth v1.6?

In example


used instead of

var abi = fs.readFileSync('bin/Greeter.abi');

Look into Mist. It's a super convenient GUI tool that has a built-in Solidity compiler.

Start by syncing on one of the testnets. Once you have test ether you can deploy contracts via the menu. Then just copy and paste your basic greeter contract code into the window to compile and deploy it.


If you want to stick to command line more and go through step by step then here is a more up to date version to get your first piece of code working: https://alanbuxton.wordpress.com/2017/07/19/first-steps-with-ethereum-private-networks-and-smart-contracts-on-ubuntu-16-04/

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.