- Install Soroban CLI
cargo install --locked stellar-cli@25.0.0-
Create Stellar Account
- For testnet: Friendbot
- For mainnet: Use a secure wallet
-
Configure Environment
cp .env.example .env
# Edit .env with your configuration# Set network in .env
NETWORK=testnetAll deployments are automatically saved in deployments:
testnet.json- Check for Deployed contract details
| Variable | Description | Required |
|---|---|---|
NETWORK |
Target network (testnet/mainnet) | Yes |
STELLAR_SECRET_KEY |
Deployment account secret key | Yes |
TESTNET_RPC_URL |
Testnet RPC endpoint | Yes |
After deployment, verify your contracts details:
# View deployment record
cat deployments/testnet.jsonFollow the following steps to deploy your contracts using the deploy.sh file
- Set the environment variables using
set -e - Set the list of contracts to read and deploy using the snippet below:
CONTRACTS=(
payment_stream
distributor
)- Load the environment variables using
source .env - Created a Deployments folder, inside the folder, create two
jsonfiles to keep the Contract IDs for deployment on the Testnet and Mainnet. - Allow your deployment script to read the required Stellar Paraphrase using
NETWORK_PARAPHRASE=${TESTNET_NETWORK_PASSPHRASE} - When deploying your contracts'
wasmfiles, loop over all the available contracts in your project using the code snippet below:
for CONTRACT in "${CONTRACTS[@]}"; do
WASM_PATH="contracts/target/wasm32-unknown-unknown/release/${CONTRACT}.wasm"- Get your depoyed CONTRACT_ID by deploying your Stellar contracts using the required details in the code block below:
CONTRACT_ID=$(stellar contract deploy \
--wasm "$WASM_PATH" \
--source "$STELLAR_SECRET_KEY" \
--network "$NETWORK" \
--network-passphrase "$NETWORK_PARAPHRASE")- And, finally deploy your contract using
./scripts/deploy.sh
Once your contracts are successfully deployed, initialize the contracts in the steps below.
- Set the environment variables.
- Load your contracts in a
CONTRACTSvariable. - Load the environment variables.
- Loop over the deployed contracts' addressess in the deployments folder using the snippet below.
for CONTRACT in "${CONTRACTS[@]}"; do
CONTRACT_ID=$(jq -r ".${CONTRACT}" "$DEPLOYMENTS_FILE")- Invoke the Contracts using the code block below.
stellar contract invoke \
--id "$CONTRACT_ID" \
--network "$NETWORK" \
--source "$STELLAR_SECRET_KEY" \
--network-passphrase "$NETWORK_PARAPHRASE"\
-- \
initialize \
--admin "$STELLAR_SECRET_KEY"- Run the code snippet below to initialize your contracts
./scripts/initialize.sh