Environment Setup 🛠️
This guide will help you set up a complete development environment for DolphinPay.
Prerequisites
System Requirements
- Operating System: Linux, macOS, or Windows (WSL2)
- Node.js: Version 18.0 or higher
- Package Manager: npm, yarn, or bun
- Git: Latest version
Install Node.js
Option 1: Using Node Version Manager (Recommended)
# Install nvm (Linux/macOS)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
source ~/.bashrc
# Install and use Node.js 18+
nvm install 18
nvm use 18
Option 2: Direct Installation
- macOS: Download from https://nodejs.org/
- Ubuntu/Debian:
sudo apt install nodejs npm - Windows: Download installer from https://nodejs.org/
Verify Installation
node --version # Should be 18.0.0 or higher
npm --version # Should be 8.0.0 or higher
Sui Blockchain Setup
1. Install Sui CLI
# Using cargo (recommended)
cargo install --locked --git https://github.com/MystenLabs/sui.git --branch testnet sui
# Or download binary from releases
# https://github.com/MystenLabs/sui/releases
2. Configure Sui Client
# Switch to testnet
sui client switch --env testnet
# Check active address
sui client active-address
# If no address exists, create one
sui client new-address secp256k1
3. Get Testnet Tokens
# Method 1: Discord Faucet
# Join Sui Discord: https://discord.gg/sui
# Use: !faucet <your-address>
# Method 2: Official Faucet
# Visit: https://docs.sui.io/guides/developer/getting-started/get-coins
4. Verify Setup
# Check balance
sui client balance
# View gas objects
sui client gas
# Test connection
sui client chain-identifier
Wallet Setup
Browser Wallets
Sui Wallet (Recommended)
- Install from Chrome Web Store
- Create or import wallet
- Switch to testnet
- Copy your address for faucet requests
Suiet Wallet
- Install from Chrome Web Store
- Similar setup process as Sui Wallet
Verify Wallet Connection
# Your wallet address should match CLI address
sui client active-address
Development Tools
Code Editors
Visual Studio Code (Recommended)
# Install VS Code
# https://code.visualstudio.com/
# Essential extensions for DolphinPay development:
# - Move Language Support
# - TypeScript Hero
# - Prettier
# - ESLint
# - Sui Tools
Alternative Editors
- IntelliJ IDEA with Move plugin
- Sublime Text with relevant packages
- Vim/Neovim with Move syntax
Sui Tools Extension
Install the Sui VS Code Extension:
# Features:
# - Move syntax highlighting
# - Code completion
# - Error diagnostics
# - Test integration
# - Deployment tools
Package Managers
npm (Default)
# Already installed with Node.js
npm --version
Yarn
# Install Yarn
npm install -g yarn
yarn --version
Bun (High Performance)
# Install Bun
curl -fsSL https://bun.sh/install | bash
bun --version
Testing Tools
Install Sui Test Tools
# Sui already includes testing framework
sui --help | grep test
# Install additional testing tools
npm install -g @mysten/sui.js
Setup Test Environment
# Create local test environment
sui genesis
# Start local validator
sui start
# Switch to localnet
sui client switch --env localnet
Environment Configuration
Create Development Environment
# Clone repository
git clone https://github.com/dolphinslab/dolphin-pay.git
cd dolphin-pay
# Setup SDK
cd sdk
npm install
# Setup Frontend
cd ../frontend
npm install
# Return to root
cd ..
Environment Files
SDK Configuration
Create sdk/.env:
# Network settings
SUI_NETWORK=testnet
PACKAGE_ID=0x9c7ca262d020b005e0e6b6a5d083b329d58716e0d80c07b46804324074468f9c
# RPC endpoints
TESTNET_RPC=https://fullnode.testnet.sui.io:443
MAINNET_RPC=https://fullnode.mainnet.sui.io:443
Frontend Configuration
Create frontend/.env.local:
# Network configuration
NEXT_PUBLIC_SUI_NETWORK=testnet
NEXT_PUBLIC_PACKAGE_ID=0x9c7ca262d020b005e0e6b6a5d083b329d58716e0d80c07b46804324074468f9c
# Optional: Custom RPC
# NEXT_PUBLIC_RPC_URL=https://fullnode.testnet.sui.io:443
# Optional: GraphQL endpoint
# NEXT_PUBLIC_GRAPHQL_ENDPOINT=https://graphql.testnet.sui.io/graphql
Verification Checklist
✅ Sui Setup
- Sui CLI installed and working
- Testnet configured
- Wallet has testnet SUI
- Active address set
✅ Development Tools
- Node.js 18+ installed
- Package manager working
- Code editor configured
- Sui extension installed
✅ Project Setup
- Repository cloned
- Smart contracts build successfully
- SDK dependencies installed
- Frontend dependencies installed
✅ Network Access
- Can reach testnet RPC
- Wallet connected to testnet
- Gas objects available
- Test transaction works
Common Issues
Port Conflicts
# Check what's using port 3000
lsof -i :3000
# Use different port
PORT=3001 npm run dev
# Or kill conflicting process
kill -9 <PID>
Network Connection Issues
# Test RPC connection
curl -X POST https://fullnode.testnet.sui.io:443 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"sui_getChainIdentifier","params":[]}'
# Check firewall settings
sudo ufw status # Linux
Permission Issues
# Fix npm permissions (Linux/macOS)
sudo chown -R $(whoami) ~/.npm
sudo chown -R $(whoami) /usr/local/lib/node_modules
# Use nvm to avoid permission issues
nvm install 18
nvm use 18
Performance Optimization
Increase File Watchers (Linux)
# Check current limit
cat /proc/sys/fs/inotify/max_user_watches
# Increase limit (temporary)
echo 524288 | sudo tee /proc/sys/fs/inotify/max_user_watches
# Make permanent
echo 'fs.inotify.max_user_watches=524288' | sudo tee -a /etc/sysctl.conf
Enable Corepack
# Enable corepack for better package management
corepack enable
Next Steps
Now that your environment is set up:
- Quick Start - Build your first payment integration
- Smart Contracts - Learn about the contract architecture
- SDK Guide - Start building with the SDK
Ready to build? Your development environment is now configured for DolphinPay development!