This guide will help you set up your development environment for Switchboard.
Before you begin, ensure you have the following installed:
- Rust - For Solana program development
- Node.js (v16 or higher) - For SDK and service development
- Solana CLI Tools - For deploying and testing Solana programs
- Docker - For containerized services
- Git - For version control
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
# Install Solana CLI tools
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
# Install Anchor framework
cargo install --git https://github.com/coral-xyz/anchor --tag v0.28.0 anchor-cli --lockedWe recommend using nvm (Node Version Manager) to install and manage Node.js versions:
# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Install Node.js
nvm install node
nvm use node-
Clone the repository:
git clone https://github.com/your-org/switchboard.git cd switchboard -
Install project dependencies:
npm install
-
Build all packages:
npm run build
After setup, your project structure should look like:
switchboard/
├── docs/ # Documentation
├── packages/ # Core code packages
│ ├── programs/ # Solana on-chain programs
│ ├── sdk/ # Developer SDK
│ ├── services/ # Off-chain services
│ └── demo/ # Demo applications
├── scripts/ # Deployment and utility scripts
├── tests/ # Integration and end-to-end tests
├── README.md # Project overview
└── package.json # Workspace configuration
-
For Solana Programs:
cd packages/programs/state-oracle anchor build anchor test
-
For SDK Development:
cd packages/sdk npm run build npm run test
-
For Services:
cd packages/services/oracle-service npm start
To run all tests:
npm testTo run tests for a specific package:
npm test -- --scope=@switchboard/sdknpm run build- Build all packagesnpm run clean- Clean build artifactsnpm run lint- Run linter on all packagesnpm run format- Format code with prettier
If you encounter any issues during setup:
- Ensure all prerequisites are properly installed and accessible from your PATH
- Check that you're using compatible versions of the tools
- If you get permission errors, try running commands with sudo (though this shouldn't be necessary)
For additional help, please refer to the specific documentation for each component or reach out to the team.