Quick Start

In this guide we will deploy a simple Flipper smart contract onto Reef chain.

The guide is broken into 3 parts:

  • setting up the Reef development node
  • setting up the smart contract development environment
  • deploying and running your first smart contract

Setting up a development node


Reef chain is written in Rust. A basic familiarity with Rust tooling is required.

Clone the repo

git clone --recursive https://github.com/reef-defi/reef-chain

Install Rust

If you don’t have Rust already, you can install it with:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

You can install the development compiler and the toolchain with:

make init

Start a development node

The make run command will launch a temporary node and its state will be discarded after you terminate the process.

To run the temporary (development) node run:

make run

You should see an output like this when the Reef chain starts producing blocks.

(Optional) Run a persistent single-node chain

Use the following command to build the node without launching it:

make build

This command will start the single-node development chain with persistent state:

./target/release/reef-node --dev

Purge the development chain’s state:

./target/release/reef-node purge-chain --dev

Smart Contracts

The Reef chain smart contracts are written in Solidity. Any existing Ethereum smart contracts written in Solidity 0.6 or greater will work on Reef chain without a need for modifications.

However some of the tooling from Ethereum will NOT work on Reef chain due to inherent differences in the blockchain architecture.

Fortunately we have drop in replacements for most commonly used tools.

EthereumReef Chain
Metamask–>Polkadot Extension
Truffle/Hardhat–>Reef Hardhat
Remix IDE–>Reef Remix

Deploy your first ERC-20 Token

We are going to pick a simple ERC-20 contract for our demo, but feel free to try out other examples as well.

In this guide we are using Reef Hardhat, which is suitable for more experienced developers. If you would like to deploy your contract via an easy to use web IDE, try Reef Remix.

Clone the examples repo

git clone https://github.com/reef-defi/hardhat-reef-examples

Install the dependencies


Run the deployment script

npx hardhat run scripts/erc20/deploy.js

Interact with the ERC-20 to send tokens

We can call functions on our smart contract through the Hardhat interface:

const hre = require("hardhat");

async function main() {
  // Bob is the owner of Token contract and he wants to send some token amount to dave
  const bob = await hre.reef.getSignerByName("bob");
  const dave = await hre.reef.getSignerByName("dave");

  // Extracting user addresses
  const bobAddress = await bob.getAddress();
  const daveAddress = await dave.getAddress();

  // Token contract address
  const tokenAddress = "0x4a4fA87b810A30BE84a3a30318D6D9feEae126e5";

  // Retrieving Token contract from chain
  const token = await hre.reef.getContractAt("Token", tokenAddress, bob);

  // Let's see Dave's balance
  let daveBalance = await token.balanceOf(daveAddress);
    "Balance of to address before transfer:",
    await daveBalance.toString()

  // Bob transfers 10000 tokens to Dave
  await token.transfer(daveAddress, 10000);

  // Let's once again check Dave's balance
  daveBalance = await token.balanceOf(daveAddress);
    "Balance of to address after transfer:",
    await daveBalance.toString()

  // Bob's amount after transactions
  const bobBalance = await token.balanceOf(bobAddress);
    "Balance of from address after transfer:",
    await bobBalance.toString()

  .then(() => process.exit(0))
  .catch((error) => {

Next steps

Congratulations. You now have a running development node with the first smart contract. You and now are ready to start building your first DeFi app.

Deploy on testnet

Deploying on testnet is similar to development, however there are 2 things we need.

1.) Run a testnet node or use the public testnet RPC.

2.) Create an account and obtain testnet REEF tokens from the faucet.

To get 1000 REEF testnet tokens simply type !drip <YOUR_ADDRESS> in Reef matrix chat.

Deploy on mainnet

Deploying on mainnet is similar to development, however there are 2 things we need.

1.) Run a mainnet node or use the public mainnet RPC.

2.) Create an account and obtain Reef chain native REEF tokens from the bridge or exchange.

Verify the contract on Reefscan

Once you have deployed your smart contract on Reef Chain mainnet (or testnet), you will want to verify it on Reefscan, so that other developers can access its source code and ABI.

Verify your deployed contract on: Mainnet or Testnet

Build a UI

One example of UI interacting with the Reef chain can be seen here.It is built on top of Polkadot.js apps and uses evm-provider.js library to deploy and interact with the contracts.