Skip to content

Smart Contract Basics

This guide is designed to help developers understand how to write smart contracts efficiently and securely. Here, you will find detailed examples that demonstrate different functionalities and use-cases within the context of smart contracts starting from the very basics. To follow along, verify your work, or to get help if you get stuck, you can use the repo as a reference. Each section of the tutorial has an associated branch in the repo to act as a checkpoint.


We provide three core examples to illustrate how to implement various smart contract functionalities:

1. Hello World Contract

The Hello World Contract demonstrates how to create a simple contract that greets the caller. This example is perfect for understanding the basic structure and syntax of smart contracts. The relevant code is available in tut-01-hello branch.

2. State Contract

The State Contract shows how to maintain a state or a variable within a smart contract. This is useful for contracts that need to store data or state across transactions. The relevant code is available in tut-02-state branch.

3. Access-Control Contract

The Access-Control Contract provides an example of how to implement access control, ensuring that only authorized users can call certain functions within the smart contract. The relevant code is available in tut-03-access branch.

Let us get started!

See also: