Whitepaper - Ethereum Classic With Cover
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Ethereum</strong> <strong>Classic</strong> Documentation, Release 0.1<br />
Mutan (deprecated)<br />
Mutan is a statically typed, C-like language designed and developed by Jeffrey Wilcke. It is no longer maintained.<br />
Writing a contract<br />
No language would be complete without a Hello World program. Operating within the <strong>Ethereum</strong> environment,<br />
Solidity has no obvious way of “outputting” a string. The closest we can do is to use a log event to place a string<br />
into the blockchain:<br />
contract HelloWorld {<br />
event Print(string out);<br />
function() { Print("Hello, World!"); }<br />
}<br />
This contract will create a log entry on the blockchain of type Print with a parameter “Hello, World!” each time it<br />
is executed.<br />
See also:<br />
Solidity docs has more examples and guidelines to writing Solidity code.<br />
Compiling a contract<br />
Compilation of solidity contracts can be accomplished via a number of mechanisms.<br />
• Using the solc compiler via the command line.<br />
• Using web3.eth.compile.solidity in the javascript console provided by geth or eth (This still<br />
requires the solc compiler to be installed).<br />
• The online Solidity realtime compiler.<br />
• The Meteor dapp Cosmo for building solidity contracts.<br />
• The Mix IDE.<br />
• The <strong>Ethereum</strong> Wallet.<br />
Note: More information on solc and compiling Solidity contract code can be found here.<br />
Setting up the solidity compiler in geth<br />
If you start up your geth node, you can check which compilers are available.<br />
> web3.eth.getCompilers();<br />
["lll", "solidity", "serpent"]<br />
This command returns an array of strings indicating which compilers are currently available.<br />
Note: The solc compiler is installed with cpp-ethereum. Alternatively, you can build it yourself.<br />
If your solc executable is in a non-standard location you can specify a custom path to the solc executable using<br />
th --solc flag.<br />
$ geth --solc /usr/local/bin/solc<br />
Alternatively, you can set this option at runtime via the console:<br />
80 Chapter 1. Contents