Before you go, check out these stories!

Hackernoon logoHow To Use Remix and Metamask To Deploy Smart Contracts On The RSK Testnet by@RSKsmart

How To Use Remix and Metamask To Deploy Smart Contracts On The RSK Testnet

Author profile picture


Smart Contract Platform On Top of Bitcoin

In this tutorial I will show you step by step how to use Remix and Metamask, which are tools that were originally built for Ethereum, to create and deploy a simple smart contract on RSK’s Testnet.

RSK is an open-source platform for Ethereum compatible smart contracts based on the Bitcoin network. RSK’s virtual machine implementation is compatible with the Ethereum EVM, so we can also use many of Ethereum’s developer tools.


We will do these steps:

  1. Configure Metamask to connect to RSK testnet;
  2. Get some testnet R-BTCs at faucet;
  3. Connect Remix with RSK Testnet;
  4. Create a smart contract at Remix;
  5. Compile it;
  6. Using Remix, deploy the smart contract at RSK Testnet;
  7. Know the RSK explorer;
  8. Interact with the smart contract;
  9. Check the transactions in Metamask.


  • Metamask
  • Remix


Metamask is a kind of web wallet which facilitates transactions using yours accounts. It can be used with RSK networks too. It has versions for several browsers, like Chrome, Firefox, Opera and Brave.

Go to and install it.

Create an account.

Write down your seed phrase, or mnemonic, or backup phrase (all these terms mean the same), with 12 words. This is used to recover your account, in case you lose your password.

The seed phrase is the most important thing in a wallet / account!


Remix is an online web tool. It is an IDE (Integrated Development Environment) used to write, compile, deploy and debug Solidity code. Can be connected with Metamask and used to deploy smart contracts to both the RSK Testnet and Mainnet.

Can be accessed at

Connect Metamask to RSK testnet

  • Go to networks 
  • Custom RPC
  • Network Name
  • RSK Testnet

  • ChainID (optional)
  • 31

  • Symbol (optional)
  • tR-BTC

Take a look in all fields:

After configuring it, select the RSK Tesnet.

TestNet Faucet

You can get some Testnet R-BTC in the faucet

Copy your address from Metamask.

Enter your wallet address and pass the CAPTCHA.

Wait a few seconds...

You can see the transaction hash, for example:


Now I have 0.05 RBTC!

You can use the faucet only once a day!


Go to Remix

In the home / welcome page, choose environment Solidity.

Remix connect RSK Testnet

With the RSK network selected at Metamask...

At Remix, on the left side, locate the button Deploy and run transactions.
For now, it is the 4th button.

At Environment, choose Injected Web3

Injected Web3 connects Remix with the active account in Metamask.

ChainID 31 was defined at RSK Testnet custom network in Metamask.

Create a Smart Contract

Create a new file

Click on the second button on the left side - file explorers 

Click on + create a new file

File name: SimpleStorage.sol

Copy this example:

pragma solidity >=0.4.0 <0.7.0;
contract SimpleStorage {
    uint storedData;
    function set(uint x) public {
        storedData = x;
    function get() public view returns (uint) {
        return storedData;

And paste it here:


This smart contract has:

  • A variable
    to store a number
  • A function
    to return the number stored at variable
  • A function
    to change the number stored at variable

Compile a smart contract 

In the 3rd button at left side click on Solidity compiler

It is useful to enable auto-compile:

For now, click in the button Compile SimpleStorage.sol

Check the green sign at 3th button with the message compilation successful

Deploy a smart contract at RSK testnet

In the left side panel, go to the button Deploy and run transactions. Actually, it is the 4th button.

For now we have only one smart contract, so it is automatically select at dropdown.

Click in the button Deploy

It will open a Metamask popup window, to confirm the transaction to create the smart contract SimpleStorage.sol

Click on confirm

At bottom right, we can check the message: 

creation of SimpleStorage pending...

Once it is confirmed, we can check it:

Click on transaction line or debug button (at right side) to see more details of the transaction:

Copy the transaction hash to verify at blockchain explorer:

Is this example, the transaction hash is:


RSK Explorer

The RSK explorer is the blockchain explorer to RSK transactions.

We will use the testnet explorer:

Past the transaction hash at search field, in the top of the screen:

You can verify my example at: 


Interact with the smart contract 

When a smart contract is deployed with Remix, we can see it in the left panel under deploy and run transactions:

Click on > to expand SimpleStorage:

These are the same functions we created in our smart contract!

The orange buttons are functions which will change some information stored on the blockchain, we call them state changes. This kind of function expends gas when used.

The blue buttons are functions that are read-only and it does not change anything stored on the blockchain. We do not need to expend gas when using them.


First of all, we will check the value stored at deploy.

Click in the button get:

We do not have any value stored, because we do not define anything at the moment when we deployed.

At bottom right, we can check that it was a call to `SimpleStorage.get()` function:


Put a value in the field at the right side of the set button, and click on the button:

It will open a Metamask popup window, to confirm the transaction to store a value.

Click in confirm

At bottom right, we can verify that the transaction is pending, waiting confirmation at blockchain:

After a few seconds, Metamask will show when the transaction has been confirmed!

At bottom right, we have the transaction’s details:

You can copy the transaction hash and verify at RSK explorer too:


Get (again)

Now we have the value 2020 saved, and we can check it.

Click in the button get

And the value is correct!

Transactions in Metamask

It is possible to verify all transactions in Metamask:

Next steps

Wait for the next article where we will teach you how to create a frontend for our smart contract. 

Find more documentation

Check out the RSK developers portal.


We have run a webinar in which we run through this tutorial, in different languages:

English | Spanish | Portuguese

Do you have any questions?

Ask in RSK chat.

Final considerations

Did you think that it would be so easy to use Remix and Metamask to create a smart contract that can be used on both Ethereum or RSK networks?

I showed you how we can use some Ethereum developer tools, and it is great to realize that they can be used on the RSK network as well.

Our goal is to join forces and give options to people who believe in smart contracts based on Ethereum, and also believe in the power of Bitcoin, through RSK.

I hope this tutorial has been helpful and I’d appreciate your feedback. Share it if you like it :)

Author: Solange Gueiros | Reviewer: Brendan Graetz


Join Hacker Noon

Create your free account to unlock your custom reading experience.