locallaunchsc-cloud/solana-dev-skills / solana-deploy
solana-deploy
FlaggedUse this skill when the user wants to deploy or upgrade a Solana program from devnet to mainnet — verifiable builds, buffer accounts, priority fees, upgrade authority management, IDL upload, program close.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 16.4 KB |
| references/authority-management.md | markdown | 6.9 KB |
| scripts/deploy-with-retries.sh | script | 9.7 KB |
| scripts/verify-build.sh | script | 4.3 KB |
scripts/verify-build.sh
View on GitHub#!/usr/bin/env bash
# verify-build.sh — Build a Solana program deterministically via solana-verify
# and print the executable hash for later on-chain comparison.
#
# Why this script exists:
# `solana-verify build` runs the toolchain inside a pinned Docker container so
# every byte of the resulting .so is reproducible across machines. The hash
# printed at the end MUST match what `solana-verify get-program-hash` returns
# after deploy and what OtterSec computes during remote verification.
#
# REQUIREMENTS:
# - Docker installed AND running. solana-verify shells out to `docker run`
# for a fully sandboxed Rust/SBF build. No Docker = no verifiable build.
# - `cargo install solana-verify --locked --version 0.4.15`
# - Run from the workspace root (where Anchor.toml or top-level Cargo.toml lives).
# - `Cargo.lock` MUST be committed (it's required for deterministic dep resolution).
#
# Usage:
# ./scripts/verify-build.sh # single-program workspace
# ./scripts/verify-build.sh my_program # multi-program: specify lib name
# ./scripts/verify-build.sh my_program programs/x # also pass a non-default mount path
#
# Tested with: Solana CLI 3.0.10, solana-verify 0.4.15, Anchor 0.31.0.
set -euo pipefail
LIBRARY_NAME="${1:-}"
MOUNT_PATH="${2:-}"
# --- Pre-flight ---------------------------------------------------------------
if ! command -v solana-verify >/dev/null 2>&1; then
echo "ERROR: solana-verify not found. Install with:" >&2
echo " cargo install solana-verify --locked --version 0.4.15" >&2
exit 1
fi
if ! command -v docker >/dev/null 2>&1; then
echo "ERROR: docker not found. solana-verify build runs in a container." >&2
exit 1
fi
if ! docker info >/dev/null 2>&1; then
echo "ERROR: Docker daemon is not running. Start Docker Desktop / dockerd and retry." >&2
exit 1
fi
if [[ ! -f Cargo.lock ]]; then
echo "ERROR: Cargo.lock not found in $(pwd)." >&2
echo " solana-verify requires Cargo.lock to be committed for deterministic builds." >&2
echo " Run 'cargo generate-lockfile' and commit the result." >&2
exit 1
fi
# --- Build --------------------------------------------------------------------
echo "==> solana-verify build (first run pulls a Docker image; ~5-15 min)"
BUILD_ARGS=()
if [[ -n "$LIBRARY_NAME" ]]; then
BUILD_ARGS+=(--library-name "$LIBRARY_NAME")
fi
if [[ -n "$MOUNT_PATH" ]]; then
BUILD_ARGS+=(--mount-path "$MOUNT_PATH")
fi
solana-verify build "${BUILD_ARGS[@]}"
# --- Locate the produced .so --------------------------------------------------
if [[ -n "$LIBRARY_NAME" ]]; then
SO_PATH="target/deploy/${LIBRARY_NAME}.so"
else
SO_COUNT=$(find target/deploy -maxdepth 1 -name '*.so' 2>/dev/null | wc -l | tr -d ' ')
if [[ "$SO_COUNT" -ne 1 ]]; then
echo "ERROR: Found $SO_COUNT .so files in target/deploy/." >&2
echo " Pass the library name explicitly: ./scripts/verify-build.sh <lib_name>" >&2
exit 1
fi
SO_PATH=$(find target/deploy -maxdepth 1 -name '*.so' | head -n 1)
fi
if [[ ! -f "$SO_PATH" ]]; then
echo "ERROR: Expected build output at $SO_PATH but it does not exist." >&2
exit 1
fi
# --- Hash + report ------------------------------------------------------------
SIZE=$(wc -c < "$SO_PATH" | tr -d ' ')
# solana-verify exposes the canonical hash used for on-chain comparison.
# Fall back to sha256sum/shasum only if solana-verify is missing (it isn't here).
HASH=$(solana-verify get-executable-hash "$SO_PATH")
cat <<EOF
==============================================================
Verifiable build complete.
Path : $SO_PATH
Size : $SIZE bytes
Hash : $HASH
==============================================================
Record this hash. After deploy, confirm the on-chain program matches:
solana-verify get-program-hash -u mainnet-beta <PROGRAM_ID>
Then submit for public verification (also triggers the OtterSec checkmark):
solana-verify verify-from-repo -u mainnet-beta \\
--program-id <PROGRAM_ID> https://github.com/<owner>/<repo> \\
--commit-hash \$(git rev-parse HEAD)
solana-verify remote submit-job --program-id <PROGRAM_ID> \\
--uploader \$(solana address)
WARNING: Do NOT run 'anchor build' or 'cargo build-sbf' after this point.
The host toolchain will produce a different hash and break verification.
EOF
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |