Skip to main content

Example Index

These examples are organized as small reference implementations you can copy and adapt.

Running The Sweep

Use cowboy/examples/run_examples.sh as the shared example-sweep entrypoint.
# Shared mesa devnet
./run_examples.sh

# Shared mesa devnet with full raw Cowboy CLI output
./run_examples.sh --verbose 17-hn-feed

# Shared canyon devnet
./run_examples.sh --server canyon

# Existing local validator
./run_examples.sh --server local

# Explicit RPC endpoint
./run_examples.sh --server http://localhost:4000 17-hn-feed

# Temporary isolated local validator
./run_examples.sh --spawn-local
Use --server when you already know which validator to hit. Use --spawn-local when you want the script to boot a temporary local validator for the run. Use --verbose when you want the raw Cowboy CLI output instead of the compact command/result formatting. For direct demo runs outside the sweep, set COWBOY_EXAMPLES_VERBOSE=1.

Actor-To-Actor Composition

  • 18-ring-demo for the smallest actor-to-actor message chain
  • 19-multi-actor-workflow for request, validation, and settlement
  • 22-actor-escrow-workflow for a CIP-20-backed buyer, seller, and escrow lifecycle
  • 29-casino-rounds for a token-backed casino, automated bettor actors, and a separate long-running casino watcher

Runner Continuation

  • 20-minimal-runner-continuation for the smallest continuation and callback reference
  • 23-read-through-oracle-cache for a refresh-once cache pattern
  • 24-failure-recovery for pending, failed, retried, and recovered states

Timer Examples

  • 21-pure-timer-scheduler for a timer-only on_timer loop
  • 11-alerts-and-schedulers for a more complete scheduler example

Auth

  • 25-auth-roles for owner-only admin methods and delegated roles

Simulation

  • 26-local-simulation for local simulation, mock host style verification, and expected output

Games

  • 30-blackjack for a dealer-owned blackjack table with chip escrow, split hands, and insurance
Use the numbered directories under cowboy/examples/ in the repository for the runnable code and companion README files, and use run_examples.sh when you want to sweep multiple examples through one entrypoint.
  • CIP-1: Actor Message Scheduler
  • CIP-2: Verifiable Off-Chain Compute
  • CIP-3: Dual-Metered Gas
  • CIP-5: Native Timers
  • CIP-6: Python SDK & Actor API