Skip to main content

Development Environment Setup

Configure your environment for Selendra blockchain development

Set up your development environment for building on Selendra.

Prerequisites

Required:

  • Node.js 18.0+ and npm
  • Git
  • MetaMask

For WASM:

  • Rust 1.79.0
  • cargo-contract
node --version   # v18.0.0+
git --version    # 2.20.0+

MetaMask Setup

Mainnet

FieldValue
Network NameSelendra Mainnet
RPC URLhttps://rpc.selendra.org
Chain ID1961
SymbolSEL
Explorerhttps://explorer.selendra.org

Programmatic:

await window.ethereum.request({
  method: "wallet_addEthereumChain",
  params: [
    {
      chainId: "0x7a9",
      chainName: "Selendra Mainnet",
      rpcUrls: ["https://rpc.selendra.org"],
      nativeCurrency: { name: "Selendra", symbol: "SEL", decimals: 18 },
      blockExplorerUrls: ["https://explorer.selendra.org"],
    },
  ],
});

EVM Setup (Hardhat)

mkdir my-project && cd my-project
npm init -y
npm install --save-dev hardhat @nomicfoundation/hardhat-toolbox dotenv
npx hardhat init

hardhat.config.js:

require("dotenv").config();
require("@nomicfoundation/hardhat-toolbox");

module.exports = {
  solidity: "0.8.19",
  networks: {
    selendra: {
      url: "https://rpc.selendra.org",
      chainId: 1961,
      accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : [],
    },
  },
};

.env:

PRIVATE_KEY=your_private_key_here

Test:

npx hardhat compile
npx hardhat test
npx hardhat run scripts/deploy.js --network selendra

WASM Setup (ink!)

# Install Rust 1.79.0
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup default 1.79.0
rustup target add wasm32-unknown-unknown
rustup component add rustfmt clippy rust-src

# Install cargo-contract
cargo install cargo-contract --version 3.2.0
cargo contract --version

# Create project
cargo contract new my-contract
cd my-contract
cargo contract build
cargo test

Run a Local Node

Prebuilt node binaries are not published per release. Build from source.

git clone https://github.com/selendra/selendra.git
cd selendra
git submodule update --init --recursive
cargo build --release
./target/release/selendra-node --dev --tmp

rust-toolchain.toml in the repo pins the toolchain, so rustup installs the right one on first build.

Endpoints:

  • RPC: http://localhost:9944
  • Ethereum RPC: http://localhost:9933
  • Chain ID: 1961

MetaMask Config:

{
  "chainId": "0x7a9",
  "chainName": "Selendra Local",
  "rpcUrls": ["http://localhost:9944"],
  "nativeCurrency": { "name": "Selendra", "symbol": "SEL", "decimals": 18 }
}

Hardhat Config:

module.exports = {
  networks: {
    local: {
      url: "http://localhost:9944",
      chainId: 1961,
      accounts: {
        mnemonic:
          "bottom drive obey lake curtain smoke basket hold race lonely fit walk",
      },
    },
  },
};

VS Code Extensions

EVM:

  • JuanBlanco.solidity - Solidity syntax
  • NomicFoundation.hardhat-solidity - Hardhat integration

WASM:

  • rust-lang.rust-analyzer - Rust language server
  • vadimcn.vscode-lldb - Rust debugging

General:

  • esbenp.prettier-vscode - Code formatting

Testing Setup

EVM:

npx hardhat test

WASM:

cargo test

Local Node:

curl -X POST -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}' \
  http://localhost:9944
# Expected: {"jsonrpc":"2.0","result":"0x7a9","id":1}

Troubleshooting

IssueSolution
Rust version mismatchrustup default 1.79.0
Missing protobufUbuntu: sudo apt install protobuf-compiler
macOS: brew install protobuf
RPC not respondingVerify URL, test with curl
Port in useUse --rpc-port 9945 --ws-port 9946
Database corruptionUse --tmp flag

Next Steps


Help: GitHub Issues | Explorer

Development Environment Setup - Selendra