Skip to content

stellar contract invoke --wasm is invalid — affects ~6 example contract tutorials #2212

@kaankacar

Description

@kaankacar

What version are you using?

Stellar CLI v23.2.1

What did you do?

Followed example contract tutorials (Storage, Events, Logging, Auth, Tokens). They instruct running:

stellar contract invoke \
  --wasm target/wasm32v1-none/release/soroban_logging_contract.wasm \
  --id 1 \
  -- \
  hello \
  --value friend

Documentation URL: https://developers.stellar.org/docs/build/smart-contracts/example-contracts/logging (and others)

What did you expect to see?

The contract function executing and returning a result.

What did you see instead?

error: unexpected argument '--wasm' found

The --wasm flag was removed from stellar contract invoke in PR # 997 (in the stellar-cli repo, October 2023). The sandbox mode that allowed invoking directly from a WASM file no longer exists. Contracts must be deployed first, then invoked by contract ID.

Fix: Replace all invoke-with-wasm patterns with a two-step deploy-then-invoke workflow:

# Step 1: Deploy
stellar contract deploy \
  --wasm target/wasm32v1-none/release/soroban_logging_contract.wasm \
  --alias logging-contract \
  --source-account alice \
  --network testnet

# Step 2: Invoke
stellar contract invoke \
  --id logging-contract \
  --source-account alice \
  --network testnet \
  -- \
  hello \
  --value friend

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

To Do

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions