So I've followed the greeter contract tutorial from here to deploy a contract to my private cloud. It works fine and all, but it is rather difficult that I need to create a string from my contract and then deploy that. It would be easier if I could create a contract.sol file and compile that.

So I put the greeter code into a file:

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;

and ran the following command:

solc --optimize --bin contract.sol

This creates two new files:


But from here I'm kinda lost. Does anybody know how I can deploy this greeter contract using geth and these two bin files? All tips are welcome!


2 Answers 2


The geth Javascript console is more adapted to interactive use, when compiling directly with solc, RPC is usually a better choice. To deploy contracts see:


You can write a simple bash script to compose the json parameter and pass the right data in.

  • Thanks for the link. I had a read through it. I now understand how I can send ether using the RPC interface, but I'm unfamiliar with the command to deploy a contract. Would you possibly have an example of how to do that using the RPC interface?
    – kramer65
    Aug 26, 2016 at 8:58
  • May be this can help : github.com/ethereum/wiki/wiki/…
    – Aniket
    Sep 14, 2016 at 7:04

Try the web3 CLI tool, you can just run:

web3 contract deploy greeter.bin

That will deploy and return the contract address.

Can also build with: web3 contract build greeter.sol

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.