Skip to content

Getting started with RSK – step by step

herrerameri edited this page Nov 17, 2017 · 42 revisions

Hello everyone! It’s a really easy-to-follow tutorial to start with RSK Smart Contracts. It’s divided into small modules which duration are between 10 and 30 minutes, so you can organize your time and learn! First of all, We propose you to mount your own development environment. So, you should get/install:

Tool Details
TESTRPC on memory blockchain
EDITOR/COMPILER select and download one of the list from the link
TRUFFLE a framework to deploy and interact with deployed smart contracts
REMIX an online Solidity compiler, open the link in browser

It’s a good idea to start with TestRPC because on a real blockchain we should wait miners to include our transactions on a block and then we could query over our data. With TestRPC (and because it’s a local and on memory blockchain) we would see our changes on blockchain as an instantly operation.

Module 0 - Learning about DApps and Smart Contract

Module 1 – Saying hello to the smart world (10 minutes)

  1. Open Remix.
  2. You can see a default contract written in Solidity, the HelloWorld smart contract. Easy to understand!
HelloWorld

Note the word pragma. Source files can (and should) be annotated with a so-called version pragma to reject being compiled with future compiler versions that might introduce incompatible changes. And a tip to learn: the constructor runs only when the contract is created.

So, we have our first smart contract!

Module 2 – Deploying a smart contract on development environment (30 minutes)

We need TestRPC running. So, open a terminal and write:

testrpc

Ok, now you have an on memory blockchain running on your PC. TestRPC

Module 3 – Deploying a smart contract on RSK (30 minutes)

Module 4 – Adding functions (20 minutes)

Module 5 - Interacting with contracts