Skip to content

Separate tx build from simulate/sign/send #1265

Description

@leighmcculloch

I'm splitting this component of #1180 into its own issue, because I think it needs to be prioritised separately.

What

Add support for the ability to not sign and send transactions to the network and instead output their transaction XDR as base64 to stdout.

Why

The CLI signs every transactions it submits to the network. It also has the option to simulate only.

Users who wish to build a transaction and submit it at a later date or sign it on another machine need a way to perform all the operations that the CLI supports today without doing those final two steps of signing and sending. These users need the CLI to output the transaction XDR rather than performing those steps.

How

Add a --build-only option wherever the --source option exists.

When --build-only is present, commands do not simulate, sign, or send the transaction to the network. Instead the base64 encoded transaction XDR is outputted to stdout.

Stdout is intentional so that the output can be piped to other programs.

Example

For example, today the following command will simulate a deploy, then build a transaction that performs the deploy, the sign the transaction with the source, then send it to the network.

$ soroban contract asset deploy \
    --asset CDE:GCYLVLL2FC7VGFHNU4MCSQ4GP3LFVK5NPSGH5HVMLHBBWJ56WOAVSIPY \
    --source me
CAFRE77725EPX4ISTZHEDVMGHASMLBM35PURHMQXRDOWWDJLSND76NS6

For example, with this change it will be possible to build the tx without signing and submitting:

$ soroban contract asset deploy \
    --asset CDE:GCYLVLL2FC7VGFHNU4MCSQ4GP3LFVK5NPSGH5HVMLHBBWJ56WOAVSIPY \
    --source me \
    --build-only
AAAAAgAAAACUdJTjk6FaYdoQ/LNQtVN9VXKdysiWyB+6ZwjPaxxxgQDfXAwACRCAAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAYAAAAAQAAAAEAAAABQ0RFAAAAAACwuq16KL9TFO2nGClDhn7WWqutfIx+nqxZwhsnvrOBWQAAAAEAAAAAAAAAAAAAAAA=

For example, after #1180 is also complete we'd have a composable set of commands:

$ soroban contract asset deploy \
    --asset CDE:GCYLVLL2FC7VGFHNU4MCSQ4GP3LFVK5NPSGH5HVMLHBBWJ56WOAVSIPY \
    --source me \
    --build-only \
  | soroban tx simulate \
  | soroban tx sign --signer me \
  | soroban tx send
CAFRE77725EPX4ISTZHEDVMGHASMLBM35PURHMQXRDOWWDJLSND76NS6

Related

This issue is similar and related to #1264.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions