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
| Field | Value |
|---|---|
| Network Name | Selendra Mainnet |
| RPC URL | https://rpc.selendra.org |
| Chain ID | 1961 |
| Symbol | SEL |
| Explorer | https://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 syntaxNomicFoundation.hardhat-solidity- Hardhat integration
WASM:
rust-lang.rust-analyzer- Rust language servervadimcn.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
| Issue | Solution |
|---|---|
| Rust version mismatch | rustup default 1.79.0 |
| Missing protobuf | Ubuntu: sudo apt install protobuf-compilermacOS: brew install protobuf |
| RPC not responding | Verify URL, test with curl |
| Port in use | Use --rpc-port 9945 --ws-port 9946 |
| Database corruption | Use --tmp flag |
Next Steps
Help: GitHub Issues | Explorer