This guide walks through setting up AnchorKit on Windows 10 or Windows 11, including Rust, the WASM target, Soroban CLI, and IDE configuration.
- Prerequisites
- Install Rust
- Add the WASM Target
- Install Soroban CLI
- Install Stellar CLI (alternative)
- Clone and Build AnchorKit
- Run the Tests
- IDE Setup
- Configuration Validation
- Troubleshooting
- Windows 10 version 1903 or later, or Windows 11
- PowerShell 5.1+ (built-in) or PowerShell 7+ (recommended)
- Git for Windows — includes Git Bash
- Visual Studio Build Tools 2019 or 2022 with the "Desktop development with C++" workload
The C++ build tools are required by the Rust linker (
link.exe). If you have a full Visual Studio installation the tools are already present.
- Download
rustup-init.exefrom https://rustup.rs/. - Run the installer. When prompted, select option 1 (default installation).
- Open a new PowerShell window and verify:
rustc --version
cargo --versionYou should see output similar to:
rustc 1.78.0 (9b00956e5 2024-04-29)
cargo 1.78.0 (54d8815d0 2024-04-18)
Soroban contracts compile to WebAssembly. Add the required target:
rustup target add wasm32-unknown-unknownVerify:
rustup target list --installedwasm32-unknown-unknown should appear in the list.
The Soroban CLI lets you build, deploy, and invoke contracts locally and on testnet.
cargo install --locked soroban-cli --features optAfter installation, confirm it is on your PATH:
soroban --versionIf the command is not found, add the Cargo bin directory to your PATH:
$env:PATH += ";$env:USERPROFILE\.cargo\bin"
# To make this permanent, add the line above to your PowerShell profile:
notepad $PROFILEThe Stellar CLI is the successor to the Soroban CLI and supports the same contract commands:
cargo install --locked stellar-cli --features optstellar --versionBoth CLIs work with AnchorKit. This guide uses soroban in examples; substitute stellar if preferred.
git clone https://github.com/Haroldwonder/AnchorKit.git
cd AnchorKitBuild the contract in release mode (produces an optimised WASM binary):
cargo build --release --target wasm32-unknown-unknownBuild the host-side tooling (CLI, tests, examples):
cargo build --release# Run the full test suite
cargo test
# Run with verbose output
cargo test --verbose
# Run a specific test module
cargo test contract_testsTo validate configuration files (PowerShell equivalents of the bash scripts):
.\validate_all.ps1
.\pre_deploy_validate.ps1- Install VS Code.
- Install the rust-analyzer extension (search for
rust-lang.rust-analyzerin the Extensions panel). - Install the Even Better TOML extension for
Cargo.tomlediting. - Open the
AnchorKitfolder: File → Open Folder.
Recommended workspace settings (.vscode/settings.json):
{
"rust-analyzer.cargo.buildScripts.enable": true,
"rust-analyzer.checkOnSave.command": "clippy",
"editor.formatOnSave": true,
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer"
}
}To run tests from the editor, install the rust-analyzer test runner integration — click the ▶ Run Test code lens that appears above each #[test] function.
- Install RustRover (free for non-commercial use) or IntelliJ IDEA with the Rust plugin.
- Open the
AnchorKitdirectory as a project (File → Open). - RustRover auto-detects
Cargo.tomland indexes the project. Wait for the initial indexing to complete. - Run tests with the green ▶ gutter icons next to each test function.
AnchorKit ships PowerShell scripts for validating TOML configs and running the doctor check:
# Validate all configuration files
.\validate_all.ps1
# Run pre-deployment checks
.\pre_deploy_validate.ps1
# Validate a specific config
.\validate_health_score.ps1The CLI doctor command checks your environment end-to-end:
cargo run --bin anchorkit -- doctorSee docs/guides/DOCTOR_COMMAND.md for what each check covers.
The Microsoft C++ linker is missing. Install or repair Visual Studio Build Tools and ensure the "Desktop development with C++" workload is selected.
The WASM target is not installed. Run:
rustup target add wasm32-unknown-unknownThe Cargo bin directory is not in your PATH. Add it:
$env:PATH += ";$env:USERPROFILE\.cargo\bin"To persist across sessions, add the same line to your PowerShell profile ($PROFILE).
Windows Defender can significantly slow Rust builds. Add an exclusion for the repository directory and your Cargo cache:
- Open Windows Security → Virus & threat protection → Manage settings.
- Under Exclusions, add the
AnchorKitfolder and%USERPROFILE%\.cargo.
Run the following to configure Git to check out files with LF endings (required for shell scripts in the repo):
git config --global core.autocrlf inputIf scripts fail with "running scripts is disabled on this system", enable script execution for the current session:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserFor further help, see the QUICK_START.md guide or open an issue on the GitHub repository.