APIs

Developer Docs

stx_signTransaction API method

May 21, 2025

Disclaimer: Leather does not verify transaction intent or destination. Developers must enforce proper validation of user-initiated transactions.

Request a signature from the user’s Leather wallet for a pre-built Stacks transaction.

Method name

stx_signTransaction

Parameters

  • txAddress (string, required): The Stacks address for which the transaction will be signed.

  • txHex (string, required): The hexadecimal representation of the transaction to be signed.

  • attachment (string, optional): Arbitrary data to associate with the transaction, such as a message or identifier.

  • network (string, required): The Stacks network to use. Must be one of: ["mainnet", "testnet", "devnet", "mocknet"]

Usage

This method enables frontend applications or backend services to prepare a Stacks transaction and request the user's signature via Leather. It’s ideal when transaction logic is built outside the wallet, but execution still requires user authorization and submission through their wallet.

After the user approves the signing request, Leather signs and broadcasts the transaction to the specified Stacks network.

Ensure the provided txHex matches the txAddress and is properly constructed for the chosen network.

Use case

Use this method when:

  • Frontends or backends build transactions (e.g., contract calls, token transfers)

  • You need the user to review, sign, and submit the transaction securely

  • Apps want to delegate network interaction to Leather without handling submission manually

Example scenarios:

  • Coordinated DAO voting systems

  • Marketplaces or minting flows that generate the transaction in-app

  • Multi-platform dApps where logic is centralized but execution is user-driven

Security notes

  • Requires explicit user approval in the Leather interface.

  • Once approved, the signed transaction is automatically broadcast to the network by Leather.

  • Always validate parameters before invoking this method.

Example

Example code and a live sandbox testing environment are coming soon.