The Solidity Dev

Some commented code examples to get you started on Solidity development

View the Project on GitHub

Bet contract


As you can see in the source, this one is a very straightforward contract designed to keep simplicity in mind. We are not going to deal with complex contract autosolving based on results, we will have just an oracle that feeds the result into the contract and we mark the winners. The contract has to be created using a precise term to resolve like ‘Real Madrid - FCBarcelona’, something that everyone reading the contract terms can understand.


We find again a contract using a list of states to keep track of contract behaviour. This is very useful to control how the contract is allowed to interact with its users.

In this contract we start using a very powerful feture, events. An event is what makes possible for a user frontend interface (web3.js based) to react to actions. The syntax is pretty basic, you can read more about Events in the official documentation.