Feature Request: Add encoding/decoding commands for Soroban types in Stellar CLI

Open
#2,239 10 comments 1 reaction 1 assignee View on GitHub

@fnando is already working on this.

Since Feb 11, 2026.

Assessment

This issue has not been assessed yet.

Description

stale
What problem does your feature solve?

Developers frequently need to convert between different Soroban type representations, especially when using tools like Stellar Lab that require exact hex encoding. Currently, there's an inconsistency: Stellar CLI automatically handles type conversions during contract invocations (e.g., accepting "ABCD" for a BytesN<32> parameter), but there's no standalone command to perform these conversions independently.

Common scenarios: converting strings to BytesN<32> hex format for use in Stellar Lab, encoding addresses to bytes, decoding hex values back to human-readable formats, preparing parameters for contract calls or inspection.

What would you like to see?

Encoding/decoding commands added to the Stellar CLI:

# Encode example
stellar contract encode --type bytes-n-32 --value "ABCD"
# Output: 4142434400000000000000000000000000000000000000000000000000000000

# Decode example
stellar contract decode --type bytes-n-32 --value "4142434400000000000000000000000000000000000000000000000000000000"
# Output: ABCD (or hex if not valid UTF-8)

This would reduce friction when switching between CLI and Lab and would improve developer experience.

What alternatives are there?

Using Python/Node/Unix commands, custom scripts or online converters.

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.