Skip to content

Instantly share code, notes, and snippets.

@naterush
Created July 25, 2017 16:59
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save naterush/79b585a5cdd9537fc0af95b75458b87d to your computer and use it in GitHub Desktop.
Save naterush/79b585a5cdd9537fc0af95b75458b87d to your computer and use it in GitHub Desktop.
A simple storage contract as an introduction to Solidity.
//Tell the Solidity compiler what version to use
pragma solidity ^0.4.8;
//Declares a new contract
contract SimpleStorage {
//Storage. Persists in between transactions
uint x;
//Allows the unsigned integer stored to be changed
function set(uint newValue) {
x = newValue;
}
//Returns the currently stored unsigned integer
function get() returns (uint) {
return x;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment