🎯 Target Audience: Web developers familiar with traditional APIs who are new to blockchain development
If you're coming from traditional web development, this is the most important concept to understand:
| Traditional API Keys | Blockchain Private Keys |
|---|---|
| ✅ Can be regenerated if compromised | ❌ CANNOT be regenerated |
| ✅ Limited scope and permissions | ❌ Full access to all funds |
| ✅ Centrally managed | ❌ Your responsibility only |
| 🚨 Exposure = permanent fund loss |
NEVER:
- Commit private keys to version control
- Store private keys in plain text files
- Share private keys in chat/email
- Use mainnet private keys in development
- Store private keys in browser localStorage
ALWAYS:
- Use environment variables (.env files)
- Use different keys for development/production
- Write down seed phrases on paper (not digital)
- Store recovery phrases in multiple secure physical locations
- Use hardware wallets for production/mainnet
- Go to metamask.io and install the browser extension
- Create a new wallet (write down your seed phrase on paper!)
- Important: This will be your development wallet only
Create a .env file in your project root:
# .env file - NEVER commit this to version control!
PRIVATE_KEY=your_development_private_key_here
SEPOLIA_RPC_URL=https://sepolia.infura.io/v3/your_infura_keyAdd to your .gitignore:
.env
.env.local
.env.development
.env.production
For Development Only:
- Open MetaMask
- Click account menu → Account details
- Click "Export Private Key"
- Enter your password
- Copy private key to .env file only
Think of testnets as "staging environments" for blockchain:
- Free "fake" cryptocurrency for testing
- Identical functionality to mainnet
- Safe environment for development
- No real value - perfect for learning
Sepolia is Ethereum's primary testing network:
Network Details:
- Network Name: Sepolia Testnet
- RPC URL:
https://sepolia.infura.io/v3/YOUR_KEY - Chain ID: 11155111
- Currency Symbol: SepoliaETH
- Block Explorer: https://sepolia.etherscan.io
- Open MetaMask
- Click network dropdown (usually shows "Ethereum Mainnet")
- Click "Add Network" → "Add a network manually"
- Enter the network details above
- Click "Save"
You need testnet ETH to pay for transactions:
Sepolia Faucets (free testnet ETH):
Steps:
- Switch MetaMask to Sepolia network
- Copy your wallet address
- Visit a faucet and paste your address
- Wait 1-2 minutes for ETH to arrive
- Verify balance in MetaMask
For development, Hardhat provides a local blockchain:
npx hardhat nodeBenefits:
- 🎁 10,000 ETH automatically provided
- ⚡ Instant transactions
- 🌐 No internet required
- 🔄 Perfect for rapid testing
Think of gas as the "postage stamp" for blockchain transactions:
- Gas = Computational Work measurement
- Higher Gas = Faster Processing
- Every Operation Costs Gas
| Traditional Web | Blockchain Equivalent |
|---|---|
| Server processing time | Gas units consumed |
| Hosting costs | Gas fees paid |
| API rate limits | Gas limits per block |
| Server capacity | Network throughput |
Typical Operations (on Sepolia testnet):
| Operation | Gas Cost | USD Equivalent |
|---|---|---|
| Deploy WTTP site | ~2,000,000 gas | ~$1-5 on mainnet |
| Upload small file (1KB) | ~50,000 gas | ~$0.10-0.50 |
| Upload medium file (10KB) | ~200,000 gas | ~$0.50-2.00 |
| Permission change | ~30,000 gas | ~$0.05-0.25 |
| Delete file | ~25,000 gas | ~$0.05-0.20 |
- Batch Operations: Combine multiple actions in one transaction
- Off-Peak Hours: Gas costs fluctuate with network usage
- Efficient Data: Smaller files = lower costs
- Local Testing: Use Hardhat network for development
graph TD
A[Local Hardhat Testing] --> B[Sepolia Testnet Testing]
B --> C[Production Deployment]
A1[Free & Fast] --> A
B1[Real Network Testing] --> B
C1[Real ETH Required] --> C
Development (.env.development):
PRIVATE_KEY=your_dev_key_here
NETWORK=localhost
RPC_URL=http://127.0.0.1:8545Testing (.env.test):
PRIVATE_KEY=your_test_key_here
NETWORK=sepolia
RPC_URL=https://sepolia.infura.io/v3/your_keyProduction (.env.production):
PRIVATE_KEY=your_production_key_here
NETWORK=mainnet
RPC_URL=https://mainnet.infura.io/v3/your_key// NEVER do this!
const PRIVATE_KEY = "0x1234567890abcdef..."; // Hardcoded private key// NEVER do this!
console.log("Private key:", process.env.PRIVATE_KEY); // Logging private keys# NEVER do this!
git add .env # Committing environment variables// ✅ Proper private key usage
require('dotenv').config();
const privateKey = process.env.PRIVATE_KEY;
if (!privateKey) {
throw new Error('PRIVATE_KEY not found in environment variables');
}// ✅ Safe error handling
try {
const result = await contract.deploy();
console.log("Deploy successful:", result.address);
} catch (error) {
console.error("Deploy failed:", error.message); // Don't log full error object
}Before starting WTTP development, ensure you have:
- MetaMask installed and development wallet created
- Seed phrase written down on paper and stored safely
- Environment variables configured with development private key
- Sepolia network added to MetaMask
- Testnet ETH obtained from faucets
- Local Hardhat node tested and working
- Private key security rules understood and followed
- Gas cost concepts understood
- Development workflow planned (local → testnet → mainnet)
Now that you understand blockchain fundamentals:
- Read: What is WTTP? - Understanding the protocol
- Study: Contract Architecture - How WTTP works
- Practice: Getting Started Tutorial - Your first WTTP site
- Build: Common Use Cases - Real-world applications
💡 Pro Tip: Always start with local Hardhat testing, then move to Sepolia testnet, and only deploy to mainnet when everything works perfectly. This saves both time and money!