This guide covers building, deploying, initializing, and verifying CommitLabs contracts on Stellar Soroban testnet and mainnet.
- Rust + Cargo
- Soroban CLI (
soroban) - Access to a funded deployer account for the target network
Create a local config file:
cp config/deploy.env.example config/deploy.envSet the required values in config/deploy.env:
STELLAR_ACCOUNT: secret key, identity name, or public key used to sign transactionsSTELLAR_ADMIN_ADDRESS: public key used as admin in contract initialization
Optional overrides:
NETWORK:testnetormainnet(scripts also accept a positional network argument)STELLAR_RPC_URL: RPC endpointSTELLAR_NETWORK_PASSPHRASE: network passphraseRUST_TARGET: defaultwasm32v1-none
bash scripts/build-contracts.shbash scripts/deploy-testnet.shbash scripts/deploy-mainnet.shThe deployment script enforces the following order:
commitment_nftcommitment_coreattestation_engine
The deployment script performs:
- Initialize
commitment_nftwith admin address - Initialize
commitment_corewith admin and NFT contract address - Set
commitment_coreas the NFT core contract - Add
commitment_coreas an authorized minter - Initialize
attestation_enginewith admin and core contract address
After initialization, the script verifies:
commitment_nft.get_admincommitment_nft.get_core_contractattestation_engine.get_attestations(with a dummy commitment id)
These checks confirm the contracts respond and the primary addresses are set.
Deployment outputs are stored in:
deployments/testnet.jsondeployments/mainnet.json
Each file contains network metadata and deployed contract IDs.
If not explicitly set, the scripts use:
- Testnet RPC:
https://soroban-testnet.stellar.org - Testnet passphrase:
Test SDF Network ; September 2015 - Mainnet RPC:
https://soroban-mainnet.stellar.org - Mainnet passphrase:
Public Global Stellar Network ; September 2015
All CLI options can be set via environment variables (per Soroban CLI defaults):
STELLAR_ACCOUNTSTELLAR_RPC_URLSTELLAR_NETWORK_PASSPHRASESTELLAR_FEE
- Missing WASM files: run
bash scripts/build-contracts.shand confirm thetarget/wasm32v1-none/release/*.wasmartifacts exist. - Authorization errors: ensure
STELLAR_ACCOUNTsigns forSTELLAR_ADMIN_ADDRESS(they should match). - RPC timeouts: override
STELLAR_RPC_URLto a reliable RPC provider. - Invoke failures: re-run with
--very-verboseto inspect Soroban CLI logs.
- Do not commit real secrets or funded accounts.
- Prefer Soroban identities stored in your local key store instead of plain text secret keys in shell history.
- Rotate keys after test deployments.
- Restrict admin keys to minimal access and use separate operational keys where possible.
Smart contracts are immutable once deployed. Rollback should be performed by:
- Deploying new contract instances.
- Updating the stored contract IDs in
deployments/<network>.json. - Re-initializing dependent services to point at the new addresses.