Skip to content

Allow contract upload --build-only without requiring a source account #2327

@leighmcculloch

Description

@leighmcculloch

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo (Ready for Dev)

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions