Time to read: 1 min
Launching a Custom RRC-20 Token
The RRC-20 standard is Rootstock's implementation of the ERC-20 standard. Because Rootstock is fully EVM-compatible, you can use the same Solidity code and tools (Hardhat, Foundry, Remix) to launch tokens that benefit from Bitcoin's security and Rootstock's low transaction costs.
Prerequisites
- Development Framework: Hardhat or Foundry installed locally.
- Testnet Funds: Obtain t-rBTC from the Rootstock Faucet.
- OpenZeppelin Contracts: We use these industry-standard libraries for security.
Getting Started
1. Project Initialization
Set up your workspace and install the OpenZeppelin dependency.
mkdir rrc20-token && cd rrc20-token
npm init -y
npm install --save-dev hardhat @openzeppelin/contracts
npx hardhat init # Choose "Create a TypeScript project"
2. Write the Token Contract
Create contracts/MyToken.sol. This example features a fixed-supply token that is minted entirely to the deployer's address.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract MyToken is ERC20 {
constructor(uint256 initialSupply) ERC20("Rootstock Asset", "RSA") {
_mint(msg.sender, initialSupply * (10 ** decimals()));
}
}