Writing Smart Contracts FAQ (outdated)

StephanTualStephanTual London, EnglandPosts: 886Member, Administrator, Moderator admin
edited September 18 in Education
Note

Note this information is now outdated. Please instead see:
http://forum.ethereum.org/discussion/1402/how-to-get-started-your-first-dapp-under-one-hour


The basics

As of Proof of Concept 4 (POC4), smart contracts are written in higher-level languages such as Serpent (Python inspired), Mutan (Go inspired) or LLL (LISP inspired).

Whichever high-level language you opted to write your contracts in, this code is compiled down to EVM-code, the machine-readable code that runs on a virtual machine built in the Ethereum clients.

Tutorials are few and far between, and mostly written by the community: this is by design as we are rapidly iterating over each Proof of Concept and their feature set is changing quickly. We will of course issue extensive documentation for all reference clients, our APIs, etc, as development continues.

EVM-code

EVM-code, previously refered to as "EtherScript", will continue to improve as we develop the language. Right now we are at version 1, but Vitalik has released information about the upcoming version 2. This does not impact your Serpent, Mutan or LLL code: compilers will take care of converting to the 'current' version of EVM-code.

Our alpha python Serpent->EVM-code v1, compiler is now available at https://github.com/ethereum/compiler
We have a web version at http://multisig.info:3000/

Regarding LLL, the C++ reference client (AlethZero) has a built-in LLL -> EVM-code v1, compiler, so you won't need a separate app if you've chosen to write in this language.

Same for Mutan, where the latest Go client (ethereal) has a built-in Mutan to EVM compiler.


Tutorials and sample contracts

Mutan information can be found at:
Video tutorials playlist: https://www.youtube.com/playlist?list=PLJqWcTqh_zKFQy2LlvkzHR2cEEMTvUWj8
Language definition: http://obscuren.github.io/mutan/
Wiki: https://github.com/ethereum/go-ethereum/wiki
Maran Hidske wrote this comprehensive tutorial on building a Dapp in Mutan and HTML: http://hidskes.com/blog/2014/05/21/ethereum-dapp-development-for-web-developers/

Gav Wood has written a tutorial on LLL smart contracts on the C++ wiki:
https://github.com/ethereum/cpp-ethereum/wiki/LLL-PoC-5
https://github.com/ethereum/cpp-ethereum/wiki

Vitalik Buterin wrote the Serpent programming guide:
http://blog.ethereum.org/2014/04/10/pyethereum-and-serpent-programming-guide-2/
https://github.com/ethereum/wiki/wiki/[English]-Serpent-programming-language-operations


k1n0k0 has written a really fun smart contract simulator, 'EthSim', that you can access at:
http://k1n0k0.github.io/ethereum-simulator/

Here's another contract simulator, alongside many functioning contract samples:
https://github.com/jorisbontje/cll-sim

And a third, Mintchalk:
http://www.mintchalk.com/

More contract samples by Jam10o
https://github.com/Jam10o/contracts


Videos

Check the videos in the Forums' "Education" category, here are a few selected samples:


Jeffrey Wilcke takes us through a basic meta coin example:


Joel Dietz had Joris Bontje take us through a Namecoin implementation demo.

First the code:


Then running inside EthSim:


Another contract, this time a sub-currency explainer video:


An escrow service implementation in Ethereum:


Amusing marriage contract:


Dennis McKinnon wrote a Lotto app, explained here:


Here's the tutorial for an 'egalitarian DAO':
Post edited by StephanTual on
This discussion has been closed.