On this pageNavigation ▾

Setup & Initial Workflow

This step-by-step guide walks you through the complete lifecycle of a Soroban project with Caatinga.

Step 1: Scaffold Project

Initialize a new project using the default react-vite-counter template:

npx ctg init my-dapp
cd my-dapp
npm install

Step 2: Health Check

Verify your toolchain and dependencies:

npx ctg doctor

Step 3: Build Smart Contracts

Compile the Rust contracts in contracts/:

npx ctg build

This compiles your contracts and generates .wasm binaries.

Step 4: Deploy to Testnet

Deploy your contracts using your configured network and Stellar identity:

npx ctg deploy --network testnet --source alice

Caatinga resolves dependencies, deploys the WASM binaries on-chain, and writes contract metadata to caatinga.artifacts.json.

Step 5: Generate Bindings & Invoke

Generate TypeScript bindings for your frontend:

npx ctg generate

ctg generate requires a frontend.bindingsOutput field in caatinga.config.ts — the default template sets this up for you, but --minimal projects do not. If you scaffolded with --minimal, add it first:

frontend: {
  bindingsOutput: "./src/contracts/generated"
}

Now invoke contract functions directly:

npx ctg invoke counter increment --source alice

Read the updated balance/counter state:

npx ctg read counter value