Cairo Deploy logo

Cairo Deploy

Organization
keep-starknet-strange
cairo-deploy

Deployment guidance for Cairo contracts on Starknet covering sncast commands, account setup, declare/deploy workflow, network configuration, and contract verification.

Overview

Publisherkeep-starknet-strange
Repositorystarknet-agentic
Skill namecairo-deploy
Stars
81
Forks
26
Bundled files
1
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by keep-starknet-strange on GitHub. Read the source before you install it.

Installation

Install the Cairo Deploy AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/keep-starknet-strange/starknet-agentic/tree/main/skills/cairo-deploy
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/keep-starknet-strange/starknet-agentic.git /tmp/starknet-agentic
mkdir -p .claude/skills
cp -r /tmp/starknet-agentic/skills/cairo-deploy .claude/skills/cairo-deploy
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Cairo Deploy in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Cairo Deploy on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Cairo Deploy is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Cairo Deploy

Reference for deploying Cairo smart contracts to Starknet using sncast (Starknet Foundry).

When to Use

  • Deploying contracts to Starknet devnet, Sepolia, or mainnet
  • Declaring contract classes
  • Setting up deployer accounts
  • Configuring network endpoints
  • Verifying deployed contracts
  • Invoking/calling deployed contracts

When NOT to Use

  • Writing or refactoring contract logic (cairo-contract-authoring).
  • Unit, integration, or fuzz testing (cairo-testing).
  • Gas or performance optimization (cairo-optimization).
  • Security review of existing code (cairo-auditor).

Quick Start

  1. Build with scarb build, then declare and deploy with sncast.
  2. Use skills catalog when the task moves back into authoring, testing, or auditing.

Setup

Install Starknet Foundry

bash
# Install via asdf (recommended for version pinning)
asdf plugin add starknet-foundry
asdf install starknet-foundry 0.64.0
asdf global starknet-foundry 0.64.0

# Or install directly
curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/scripts/install.sh | sh
snfoundryup

.tool-versions

Pin versions for reproducible builds:

scarb 2.15.1
starknet-foundry 0.64.0

Note: snforge 0.64.0 requires Scarb >= 2.13.1 (recommended: >= 2.18.0). Check github.com/foundry-rs/starknet-foundry/releases for the latest.

Build

bash
# Build contracts (generates Sierra + CASM)
scarb build

Output goes to target/dev/:

  • myproject_MyContract.contract_class.json (Sierra)
  • myproject_MyContract.compiled_contract_class.json (CASM)

Account Setup

Create a New Account

bash
# Generate account on Sepolia
sncast account create \
    --url https://starknet-sepolia.g.alchemy.com/v2/YOUR_KEY \
    --name my-deployer

# This outputs the account address — fund it with ETH/STRK before deploying

# Deploy the account contract
sncast account deploy \
    --url https://starknet-sepolia.g.alchemy.com/v2/YOUR_KEY \
    --name my-deployer

Import Existing Account

bash
sncast account import \
    --url https://starknet-sepolia.g.alchemy.com/v2/YOUR_KEY \
    --name my-deployer \
    --address 0x123... \
    --private-key 0xabc... \
    --type oz

Account types: oz (OpenZeppelin), argent, braavos

sncast.toml

Configure defaults to avoid repeating flags:

toml
[default]
url = "https://starknet-sepolia.g.alchemy.com/v2/YOUR_KEY"
account = "my-deployer"
accounts-file = "~/.starknet_accounts/starknet_open_zeppelin_accounts.json"
wait = true

[mainnet]
url = "https://starknet-mainnet.g.alchemy.com/v2/YOUR_KEY"
account = "mainnet-deployer"

Use profiles: sncast --profile mainnet declare ...

Declare (Register Class)

Before deploying, declare the contract class on-chain:

bash
# Declare contract
sncast declare \
    --contract-name MyContract

# Output:
# class_hash: 0x1234...
# transaction_hash: 0xabcd...

If the class is already declared, sncast will tell you — that's fine, use the existing class hash.

Deploy (Create Instance)

bash
# Deploy with constructor args
sncast deploy \
    --class-hash 0x1234... \
    --constructor-calldata 0xOWNER_ADDRESS

# Multiple constructor args (space-separated)
sncast deploy \
    --class-hash 0x1234... \
    --constructor-calldata 0xOWNER 0xTOKEN_ADDRESS 1000

Constructor Calldata Encoding

Arguments are passed as felt252 values:

  • ContractAddress — pass as hex 0x123...
  • u256 — pass as TWO felts: low high (e.g., 1000 0 for 1000)
  • felt252 — pass directly
  • bool — 1 for true, 0 for false
  • ByteArray (strings) — use sncast's string encoding or pass raw

Invoke (Write)

bash
# Call a write function
sncast invoke \
    --contract-address 0xCONTRACT \
    --function "transfer" \
    --calldata 0xRECIPIENT 1000 0

Call (Read)

bash
# Call a view function (free, no tx)
sncast call \
    --contract-address 0xCONTRACT \
    --function "get_balance" \
    --calldata 0xACCOUNT

Programmatic Deployment (starknet.js)

ts
import { Account, CallData, Contract, RpcProvider } from "starknet";

const provider = new RpcProvider({ nodeUrl: process.env.STARKNET_RPC! });
const account = new Account({ provider, address: process.env.ACCOUNT_ADDRESS!, signer: process.env.PRIVATE_KEY! });

const declareTx = await account.declare({ contract: compiledSierra, casm: compiledCasm });
await provider.waitForTransaction(declareTx.transaction_hash);

const deployTx = await account.deploy({
  classHash: declareTx.class_hash,
  constructorCalldata: CallData.compile({ owner: process.env.OWNER! }),
});
await provider.waitForTransaction(deployTx.transaction_hash);

const contract = new Contract({ abi, address: deployTx.contract_address[0], providerOrAccount: account });
await contract.invoke("set_fee", [10]);
const fee = await contract.call("get_fee", []);
console.log({ fee });

Multicall

Execute multiple calls in a single transaction:

bash
# Create a multicall file
cat > multicall.toml << 'EOF'
[[call]]
call_type = "deploy"
class_hash = "0x1234..."
inputs = ["0xOWNER"]

[[call]]
call_type = "invoke"
contract_address = "0xTOKEN"
function = "approve"
inputs = ["0xSPENDER", "1000", "0"]
EOF

sncast multicall run --path multicall.toml

Deploy Script Pattern

For complex deployments, use a script:

bash
#!/bin/bash
set -euo pipefail

RPC_URL="https://starknet-sepolia.g.alchemy.com/v2/YOUR_KEY"
ACCOUNT="my-deployer"

echo "Building..."
scarb build

echo "Declaring MyToken..."
TOKEN_CLASS=$(sncast --json declare --contract-name MyToken --url $RPC_URL --account $ACCOUNT | jq -r '.class_hash')
echo "Token class: $TOKEN_CLASS"

echo "Deploying MyToken..."
TOKEN_ADDR=$(sncast --json deploy --class-hash $TOKEN_CLASS --constructor-calldata 0xOWNER --url $RPC_URL --account $ACCOUNT | jq -r '.contract_address')
echo "Token deployed at: $TOKEN_ADDR"

echo "Declaring AMM..."
AMM_CLASS=$(sncast --json declare --contract-name AMM --url $RPC_URL --account $ACCOUNT | jq -r '.class_hash')

echo "Deploying AMM..."
AMM_ADDR=$(sncast --json deploy --class-hash $AMM_CLASS --constructor-calldata $TOKEN_ADDR --url $RPC_URL --account $ACCOUNT | jq -r '.contract_address')
echo "AMM deployed at: $AMM_ADDR"

echo "Done. Addresses:"
echo "  Token: $TOKEN_ADDR"
echo "  AMM:   $AMM_ADDR"

Network Endpoints

NetworkRPC URL
Devnet (local)http://localhost:5050
Sepolia (testnet)https://starknet-sepolia.g.alchemy.com/v2/KEY
Mainnethttps://starknet-mainnet.g.alchemy.com/v2/KEY

Alternative providers: Infura, Nethermind (free tier available). Keyless public endpoints for quick tests: https://api.cartridge.gg/x/starknet/sepolia/rpc/v0_10 and https://api.cartridge.gg/x/starknet/mainnet/rpc/v0_10 (rate limited).

Local Devnet

bash
# Install and run starknet-devnet-rs
cargo install starknet-devnet
starknet-devnet --seed 42

# Devnet provides pre-funded accounts — use them for testing

Contract Verification

Verify source code on Voyager or Starkscan:

bash
# Verify on Voyager (manual: upload Sierra JSON via web UI)
# https://sepolia.voyager.online/contract/0xADDRESS#code

# Or use Starkloupe (formerly Walnut) for programmatic verification
# https://app.starkloupe.co

Note: sncast verify supports Starkloupe and Voyager backends. Use --verifier starkloupe or --verifier voyager explicitly. (--verifier walnut was replaced by --verifier starkloupe in Starknet Foundry 0.64.0.)

Upgradeable Contracts

For contracts using OZ UpgradeableComponent:

bash
# 1. Declare new class
sncast declare --contract-name MyContractV2

# 2. Call upgrade on existing contract
sncast invoke \
    --contract-address 0xEXISTING_CONTRACT \
    --function "upgrade" \
    --calldata 0xNEW_CLASS_HASH

Common Errors

ErrorCauseFix
Contract not foundAccount not deployedRun sncast account deploy
Insufficient max feeNot enough ETH/STRK for gasFund the deployer account
Class already declaredSame class hash existsUse the existing class hash for deploy
Entry point not foundWrong function nameCheck the contract ABI
Invalid calldataWrong number/type of argsCheck constructor signature, remember u256 = 2 felts

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Cairo Deploy AI skill do?

Deployment guidance for Cairo contracts on Starknet covering sncast commands, account setup, declare/deploy workflow, network configuration, and contract verification.

Why use Cairo Deploy on TypingMind?

Because you install it once and use it with any model. Cairo Deploy is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Cairo Deploy in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/keep-starknet-strange/starknet-agentic/tree/main/skills/cairo-deploy. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Cairo Deploy?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Cairo Deploy?

As many as you like. As long as a model supports skills, you can use Cairo Deploy with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Cairo Deploy AI skill free?

Yes. It is published on GitHub by keep-starknet-strange under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇