Skip to content

Starting with RSK Smart

ajlopez edited this page May 19, 2017 · 20 revisions

This introduction is intented to guide you through the process needed to create, publish and verify your first contract in RSK Smart network. We will start with the basics on how to install tools and the different options you have to develop your contracts, if you already know that you can just jump directly to the Smart Contracts part.

Writing contracts

Smart contracts for RSK are written using Solidity (a Javascript like programming language) and are full compatible with Ethereum Smart Contracts, so you can migrate your existing Ethereum Smart Contract to RSK Smart without changes. If you are new to Solidity you can find a good introduction here, we will play a little around with some code examples but it is not the intent of this document to teach Solidity in deep.

Editor and compiler

You can create your contracts using any text editor but it is a good idea to use some more advanced tool, here's a list of some of them

  • Atom
  • IntelliJ IDEA
  • Visual Studio Code
  • Vim

You can find a more complete list here

Online in-browser compiler

There is an online editor/compiler for Solidity that can be very useful for beginners or if you don't want to install any additional tool, this can be found here

img

With the online editor you can write and verify the syntax, compile and see the resulting code, it's a very good tool for learning Solidity.

Installing RSK node locally

In order to publish contracts you need a RSK Smart node running locally. You can create a local network (with 3 local nodes without any external connection) or connect to the RSK Ginger Testnet. You can find the details on how to do that here.

After the node is running in your local machine (as a local network or connected to the Ginger Testnet) you are ready to create and publish your first contract.

Truffle framework

There is an open source tool called Truffle that that faciliates development a lot since it allows you to connect to your local RSK Smart node and call the compiler, run unit tests and publish your contracts in a very easy way. We have a detailed reference on how to develop your contracts using Truffle here.

Publishing your contracts using RSK Console

If you don't want to use Truffle you can create your contracts with any text editor (or the online editor) compile and publish directly to the RSK Smart network using the RSK Console.

Using RPC calls

The last option to develop your contracts is using the standard RPC protocol (full compatible with Ethereum) with any tool you want like cURL, Postman or Fiddler (windows only). For a detailed introduction on how to deploy contracts using RPC calls go here.

Clone this wiki locally