This directory contains practical examples showing how to use Switchboard for various cross-chain use cases.
Each example includes:
- Complete source code
- Step-by-step tutorial
- Network-specific configurations
- Testing instructions
Directory: simple-token/
Networks: Ethereum, Polygon, Arbitrum
Deploy a simple ERC20 token across multiple EVM networks.
# Navigate to example
cd examples/simple-token
# Follow the tutorial
cat README.mdDirectory: defi-protocol/
Networks: Ethereum, Polygon, Arbitrum, Avalanche, BSC
Launch a complete DeFi protocol with lending, borrowing, and yield farming across major DeFi networks.
Directory: nft-collection/
Networks: Ethereum, Polygon, Flow, NEAR
Deploy and manage NFT collections across different blockchain ecosystems.
Directory: cross-chain-bridge/
Networks: Ethereum, Polygon, Arbitrum, Optimism
Build a secure cross-chain bridge for asset transfers.
Directory: gamefi-platform/
Networks: Ethereum, Polygon, NEAR, Sui, Solana
Create a gaming platform that works across different blockchain ecosystems.
# Simple token deployment
switchboard init my-token --template simple-token
cd my-token
switchboard deploy --networks ethereum,polygon,arbitrum
# DeFi protocol
switchboard init my-defi --template defi-protocol
cd my-defi
switchboard deploy --category evm --exclude mainnet
# NFT collection
switchboard init my-nft --template nft-collection
cd my-nft
switchboard deploy --networks ethereum,polygon,flow,nearEach example directory contains an interactive tutorial:
# Run the token tutorial
cd examples/simple-token
npm run tutorial
# Run the DeFi tutorial
cd examples/defi-protocol
npm run tutorial:interactive
# Run the NFT tutorial
cd examples/nft-collection
npm run tutorial:guided- DeFi: Lending, DEXs, Yield Farming, Staking
- NFTs: Collections, Marketplaces, Gaming Assets
- Gaming: GameFi, Play-to-Earn, Virtual Worlds
- Infrastructure: Bridges, Oracles, Identity
- Enterprise: Supply Chain, Digital Assets, Compliance
- EVM-Only: Pure Ethereum ecosystem examples
- Multi-EVM: Multiple EVM-compatible networks
- Cross-Ecosystem: EVM + NEAR + Sui + Cosmos
- Solana-Integrated: Using Solana as coordination layer
- Beginner: Simple token deployments
- Intermediate: Multi-contract systems
- Advanced: Complex cross-chain protocols
# Begin here
cd examples/simple-token
npm run tutorial
# Then try
cd examples/basic-bridge
npm run tutorial# Multi-EVM deployment
cd examples/defi-protocol
npm run tutorial
# Cross-ecosystem
cd examples/gamefi-platform
npm run tutorial# Complex protocols
cd examples/advanced-bridge
npm run tutorial
# Custom integrations
cd examples/custom-connector
npm run tutorialEach example includes comprehensive tests:
# Run all tests for an example
cd examples/simple-token
npm test
# Run network-specific tests
npm run test:ethereum
npm run test:polygon
# Run integration tests
npm run test:integration
# Run end-to-end tests
npm run test:e2eEach example follows this structure:
example-name/
├── README.md # Detailed tutorial
├── package.json # Dependencies and scripts
├── switchboard.config.js # Network configuration
├── contracts/ # Smart contracts
│ ├── evm/ # EVM contracts
│ ├── near/ # NEAR contracts
│ └── sui/ # Sui contracts
├── scripts/ # Deployment and utility scripts
├── tests/ # Comprehensive test suites
└── docs/ # Additional documentation
Want to contribute an example? See our Contributing Guide.
- Complete Tutorial: Include step-by-step instructions
- Multiple Networks: Support at least 3 different networks
- Test Coverage: Include comprehensive tests
- Documentation: Clear README with explanations
- Real Use Case: Address a practical blockchain problem
# Create new example
mkdir examples/my-example
cd examples/my-example
# Initialize structure
switchboard init . --template example-base
# Develop your example
# Add contracts, scripts, tests, documentation
# Submit pull request
git add .
git commit -m "Add example: my-example"
git push origin feature/my-examplesimple-token: Basic ERC20 deploymentdefi-protocol: Complete DeFi platformnft-collection: NFT marketplacegamefi-platform: Gaming ecosystembridge: Cross-chain bridgedao: Governance system
Each example includes pre-configured network settings for:
- Mainnet: Production deployments
- Testnet: Development and testing
- Local: Local development networks
deploy.js: Multi-network deploymentverify.js: Contract verificationtest.js: Comprehensive testingmonitor.js: Health monitoringmigrate.js: Database migrations
Explore examples contributed by the community:
Need help with examples?