Allow `contract upload --build-only` without requiring a source account

Open
#2,327 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust, wasm
Domain
blockchain, cli

Research direction

Start at the CLI entry point for stellar contract upload and trace how --build-only validates --source. Confirm completion by building the command without --source and ensuring the resulting transaction can be piped to stellar tx simulate.

Written by the indexing model from the issue text.

Description

feature request
What problem does your feature solve?

--build-only should not require a source account. source account can be pass in as optional.

The stellar contract upload --build-only command currently requires a --source account to be specified, even though uploading a contract wasm doesn't involve any authorization. When using --build-only to just build the transaction (e.g., to later simulate it), there's no need for an actual account.

Use case: A developer wants to simulate uploading a contract to mainnet to estimate costs, but doesn't have an account configured. Since the upload operation requires no auth, they should be able to build and simulate the transaction without needing a real account.

Current workaround: On mainnet, you can work around this by specifying any existing account as the source:

stellar contract upload --wasm target/wasm32v1-none/release/test_empty.wasm --build-only --source GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF | stellar tx simulate

This works because the account just needs to exist for the simulation, but it's not intuitive and requires knowing about an arbitrary existing account.

What would you like to see?

When using --build-only, the --source option should either:

  • Be optional, with the CLI using a placeholder/zero account automatically, or
  • Accept a special value indicating "any account" or "simulation mode"

This would allow commands like:

stellar contract upload --wasm contract.wasm --build-only | stellar tx simulate
What alternatives are there?
  • Use any known existing account as --source (current workaround shown above)
  • Configure a local identity even when you don't need one
Dominant language
Rust
Stars
123
Forks
141
Avg merge
2d 21h
Merged PRs (30d)
17

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stellar/stellar-cli

All issues in stellar/stellar-cli

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.