RISE Logo-Light

Deploy Your First Contract

Learn how to create and deploy a simple Counter contract to RISE

A hands-on guide to deploying your first smart contract on RISE. You'll create a simple Counter contract that stores and increments a number.

What You'll Build

A basic Counter contract with two functions:

  • count - A public variable to read the current count
  • increment() - Increments the count by 1

The Contract

This is the contract you'll deploy:

Counter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;

contract Counter {
    uint256 public count;

    function increment() external {
        count++;
    }
}

Simple, right? Now let's deploy it using your preferred tool.

Choose Your Tool

Deploy with Remix

The easiest way to get started - no installation required!

Prerequisites

  • A crypto wallet (MetaMask or Rabby) with RISE Testnet configured
  • Testnet ETH from the RISE Faucet

Open Remix IDE

Go to remix.ethereum.org in your browser.

Create the Contract

  1. In the File Explorer (left sidebar), create a new file called Counter.sol
  2. Copy and paste the Counter contract code shown above
  3. Save the file (Ctrl+S or Cmd+S)

Compile

  1. Click the Solidity Compiler tab in the left sidebar
  2. Select compiler version 0.8.0 or higher
  3. Click Compile Counter.sol

You should see a green checkmark when compilation succeeds.

Enable Auto compile to automatically compile as you make changes.

Deploy to RISE

  1. Click the Deploy & Run Transactions tab
  2. In Environment, select Injected Provider - MetaMask
  3. Your wallet will prompt you to connect - click Connect
  4. Important: Verify your wallet is on RISE Testnet (Chain ID: 11155931)
  5. Select Counter in the Contract dropdown
  6. Click Deploy
  7. Confirm the transaction in your wallet

Interact with Your Contract

After deployment, expand your contract under Deployed Contracts:

  • Click the blue count button to read the current value (starts at 0)
  • Click the orange increment button to increase the count
  • Click count again to see the updated value

Each increment call requires a transaction confirmation.

View on Explorer

Copy the contract address from Remix and view it on the RISE Testnet Explorer.

Deploy with Foundry

Fast, Rust-based toolkit for smart contract development.

Prerequisites

Create Project

Initialize a new Foundry project:

forge init counter-project
cd counter-project

Add the Contract

Replace src/Counter.sol with our Counter contract:

src/Counter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract Counter {
    uint256 public count;

    function increment() external {
        count++;
    }
}

Configure RISE Network

Update foundry.toml:

foundry.toml
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
solc = "0.8.30"

[rpc_endpoints]
rise_testnet = "https://testnet.riselabs.xyz"

Compile

Build your contract:

forge build

Deploy

Deploy to RISE Testnet using your private key:

forge create \
  --rpc-url rise_testnet \
  --private-key 0xYOUR_PRIVATE_KEY_HERE \
  src/Counter.sol:Counter

Alternatively, use a keystore for better security:

forge create \
  --rpc-url rise_testnet \
  --account <keystore-name> \
  src/Counter.sol:Counter

Learn how to create a keystore: Foundry Keystore Guide

Save the contract address from the output!

Interact with Your Contract

Read the count:

cast call <CONTRACT_ADDRESS> "count()" --rpc-url rise_testnet

Increment the count:

cast send <CONTRACT_ADDRESS> \
  "increment()" \
  --rpc-url rise_testnet \
  --private-key 0xYOUR_PRIVATE_KEY_HERE

Read again to see the updated value.

View on Explorer

Visit RISE Testnet Explorer and search for your contract address.

Deploy with Hardhat

Flexible development environment with great tooling support.

Prerequisites

  • Node.js v22 or later
  • Testnet ETH from the RISE Faucet

Create Project

Initialize a new Hardhat project:

mkdir counter-project
cd counter-project
npx hardhat --init

When prompted:

  • Select "Hardhat 3 Beta"
  • Choose current directory
  • Select "A minimal Hardhat project"
  • Install dependencies: yes

Add the Contract

Create contracts/Counter.sol:

mkdir contracts
contracts/Counter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract Counter {
    uint256 public count;

    function increment() external {
        count++;
    }
}

Configure RISE Network

Update hardhat.config.ts:

hardhat.config.ts
import hardhatToolboxViemPlugin from "@nomicfoundation/hardhat-toolbox-viem";
import { configVariable, defineConfig } from "hardhat/config";

export default defineConfig({
  plugins: [hardhatToolboxViemPlugin],
  solidity: {
    version: "0.8.30",
  },
  networks: {
    riseTestnet: {
      type: "http",
      url: "https://testnet.riselabs.xyz",
      accounts: [configVariable("RISE_PRIVATE_KEY")],
      chainId: 11155931
    }
  }
});

Set Your Private Key

Store your private key securely:

npx hardhat keystore set RISE_PRIVATE_KEY

Enter your private key when prompted.

Compile

Compile your contract:

npx hardhat compile

Create Deployment Module

Create the deployment script:

mkdir -p ignition/modules
ignition/modules/Counter.ts
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";

export default buildModule("CounterModule", (m) => {
  const counter = m.contract("Counter");

  return { counter };
});

Deploy

Deploy to RISE Testnet:

npx hardhat ignition deploy ignition/modules/Counter.ts --network riseTestnet

Save the contract address from the output!

Interact with Your Contract

You can interact with your contract using Hardhat console:

npx hardhat console --network riseTestnet

Then in the console:

const Counter = await ethers.getContractFactory("Counter");
const counter = await Counter.attach("YOUR_CONTRACT_ADDRESS");

// Read count
await counter.count();

// Increment
await counter.increment();

// Read again
await counter.count();

View on Explorer

Visit RISE Testnet Explorer and search for your contract address.

Next Steps

Congratulations! You've deployed your first contract on RISE. Here's what you can explore next: