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 countincrement()- Increments the count by 1
The Contract
This is the contract you'll deploy:
// 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
- In the File Explorer (left sidebar), create a new file called
Counter.sol - Copy and paste the Counter contract code shown above
- Save the file (Ctrl+S or Cmd+S)
Compile
- Click the Solidity Compiler tab in the left sidebar
- Select compiler version
0.8.0or higher - 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
- Click the Deploy & Run Transactions tab
- In Environment, select Injected Provider - MetaMask
- Your wallet will prompt you to connect - click Connect
- Important: Verify your wallet is on RISE Testnet (Chain ID: 11155931)
- Select
Counterin the Contract dropdown - Click Deploy
- Confirm the transaction in your wallet
Interact with Your Contract
After deployment, expand your contract under Deployed Contracts:
- Click the blue
countbutton to read the current value (starts at 0) - Click the orange
incrementbutton to increase the count - Click
countagain 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
- Foundry installed (installation guide)
- Testnet ETH from the RISE Faucet
Add the Contract
Replace src/Counter.sol with our Counter contract:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Counter {
uint256 public count;
function increment() external {
count++;
}
}Configure RISE Network
Update foundry.toml:
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
solc = "0.8.30"
[rpc_endpoints]
rise_testnet = "https://testnet.riselabs.xyz"Deploy
Deploy to RISE Testnet using your private key:
forge create \
--rpc-url rise_testnet \
--private-key 0xYOUR_PRIVATE_KEY_HERE \
src/Counter.sol:CounterAlternatively, use a keystore for better security:
forge create \
--rpc-url rise_testnet \
--account <keystore-name> \
src/Counter.sol:CounterLearn 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_testnetIncrement the count:
cast send <CONTRACT_ADDRESS> \
"increment()" \
--rpc-url rise_testnet \
--private-key 0xYOUR_PRIVATE_KEY_HERERead 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 --initWhen 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// 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:
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_KEYEnter your private key when prompted.
Create Deployment Module
Create the deployment script:
mkdir -p ignition/modulesimport { 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 riseTestnetSave the contract address from the output!
Interact with Your Contract
You can interact with your contract using Hardhat console:
npx hardhat console --network riseTestnetThen 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: