Skip to content

Instantly share code, notes, and snippets.

@jkeesh
Created June 28, 2017 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkeesh/6b65ba291619197567d5bd5626be37ad to your computer and use it in GitHub Desktop.
Save jkeesh/6b65ba291619197567d5bd5626be37ad to your computer and use it in GitHub Desktop.
Hello World Solidity Contract for Ethereum
pragma solidity ^0.4.0;
contract mortal {
/* Define variable owner of the type address*/
address owner;
/* this function is executed at initialization and sets the owner of the contract */
function mortal() { owner = msg.sender; }
/* Function to recover the funds on the contract */
function kill() { if (msg.sender == owner) selfdestruct(owner); }
}
contract greeter is mortal {
/* define variable greeting of the type string */
string greeting;
/* this runs when the contract is executed */
function greeter(string _greeting) public {
greeting = _greeting;
}
/* main function */
function greet() constant returns (string) {
return greeting;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment