Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Tooling configuration

Set up Foundry, viem, wagmi, Hardhat, and ethers.js for Radius
View as Markdown

Radius uses a fixed gas price model, which requires specific configuration in some tools. This page covers setup for each major EVM development tool. For background on how Radius differs from Ethereum, see Ethereum compatibility.

At a glance

ToolConfiguration neededNotes
Foundryfoundry.toml with gas_price, evm_version, via_ir--broadcast required for forge create
viemdefineChain() — no overrides neededFee estimation works out of the box
wagmiUse custom Radius chain definition in createConfig
HardhatPin to v2, set gasPrice in network configv3 installs by default and is incompatible
ethers.jsNone — works out of the boxHandles gas pricing gracefully without overrides

Foundry

Recommended foundry.toml

Add these settings to your project's foundry.toml:

[profile.default]
gas_price = 1000000000
evm_version = "cancun"
via_ir = true
SettingPurpose
gas_priceMatches Radius's fixed gas price (~1 gwei). Query eth_gasPrice for the exact value. Eliminates the need for --gas-price on every CLI command.
evm_versionTargets the EVM version Radius supports.
via_irUses the IR-based code generator. Required for complex deploy scripts with many contracts to avoid "Stack too deep" errors.

CLI usage

Deploy a contract:

forge create src/MyContract.sol:MyContract \
  --rpc-url https://rpc.testnet.radiustech.xyz \
  --account radius-deployer \
  --broadcast

Send a transaction with cast:

cast send --gas-price 1000000000 \
  --rpc-url https://rpc.testnet.radiustech.xyz \
  --account radius-deployer \
  {{CONTRACT_ADDRESS}} "transfer(address,uint256)" {{WALLET_ADDRESS}} 1000000

viem

Chain definition

Radius uses fixed gas pricing. Standard defineChain() works out of the box — viem queries eth_maxPriorityFeePerGas and eth_gasPrice automatically:

import { defineChain } from 'viem';
 
export const radiusMainnet = defineChain({
  id: 723487,
  name: 'Radius Network',
  nativeCurrency: { decimals: 18, name: 'RUSD', symbol: 'RUSD' },
  rpcUrls: {
    default: { http: ['https://rpc.radiustech.xyz'] },
  },
  blockExplorers: {
    default: {
      name: 'Radius Explorer',
      url: 'https://network.radiustech.xyz',
    },
  },
});
 
export const radiusTestnet = defineChain({
  id: 72344,
  name: 'Radius Testnet',
  nativeCurrency: { decimals: 18, name: 'RUSD', symbol: 'RUSD' },
  rpcUrls: {
    default: { http: ['https://rpc.testnet.radiustech.xyz'] },
  },
  blockExplorers: {
    default: {
      name: 'Radius Testnet Explorer',
      url: 'https://testnet.radiustech.xyz',
    },
  },
});

Use this chain definition with createPublicClient and createWalletClient:

import { createPublicClient, createWalletClient, http } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { radiusTestnet } from './chain';
 
const publicClient = createPublicClient({
  chain: radiusTestnet,
  transport: http(),
});
 
const walletClient = createWalletClient({
  account: privateKeyToAccount('0x...'),
  chain: radiusTestnet,
  transport: http(),
});

wagmi integration

Use the custom chain definition with wagmi's createConfig:

import { http, createConfig } from 'wagmi';
import { radiusTestnet } from './chain';
 
export const config = createConfig({
  chains: [radiusTestnet],
  transports: {
    [radiusTestnet.id]: http(),
  },
});

Then use standard wagmi hooks in your React components:

import { useWriteContract, useWaitForTransactionReceipt } from 'wagmi';
 
function SendPayment() {
  const { writeContract, data: hash } = useWriteContract();
  const { isSuccess } = useWaitForTransactionReceipt({ hash });
 
  return (
    <button
      onClick={() =>
        writeContract({
          address: contractAddress,
          abi: contractAbi,
          functionName: 'transfer',
          args: [recipient, amount],
        })
      }
    >
      {isSuccess ? 'Sent' : 'Send'}
    </button>
  );
}

Hardhat

Version pinning

Hardhat v3 installs by default and uses ESM, which is incompatible with many existing plugins. Pin to v2:

pnpm add -D hardhat@^2.22.0 @nomicfoundation/hardhat-toolbox@hh2

Network configuration

Add Radius to your hardhat.config.ts:

import { HardhatUserConfig } from 'hardhat/config';
import '@nomicfoundation/hardhat-toolbox';
 
const config: HardhatUserConfig = {
  solidity: '0.8.24',
  networks: {
    radiusTestnet: {
      url: 'https://rpc.testnet.radiustech.xyz',
      chainId: 72344,
      gasPrice: 1000000000,
      accounts: [process.env.PRIVATE_KEY!],
    },
  },
};
 
export default config;

Deploy with:

pnpm hardhat run scripts/deploy.ts --network radiusTestnet

ethers.js

ethers.js handles Radius's gas pricing out of the box with no overrides. When baseFeePerGas is 0x0, ethers.js returns maxFeePerGas: null and falls back to legacy gasPrice automatically.

import { ethers } from 'ethers';
 
const provider = new ethers.JsonRpcProvider('https://rpc.testnet.radiustech.xyz');
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY!, provider);
 
// Standard transaction — no gas override needed
const tx = await wallet.sendTransaction({
  to: recipient,
  value: ethers.parseEther('1.0'),
});
await tx.wait();

Related pages