Skip to main content
The Sign Transaction screen is displayed when your application requests a wallet signature for a blockchain transaction. This screen shows users the transaction details and allows them to approve or reject the transaction before it’s signed.
Transaction signing creates a signed transaction that can be broadcast to the blockchain. This is different from Send Transaction, which both signs and broadcasts the transaction automatically.

How it works

When your application requests a transaction signature:
  1. Your app calls the sign transaction method from the MoonKey SDK
  2. The Sign Transaction screen appears, displaying transaction details
  3. User reviews the transaction information (recipient, amount, gas, etc.)
  4. User approves or rejects the signature request
  5. If approved, the signed transaction is returned to your application
  6. Your application can then broadcast the signed transaction to the blockchain

Triggering the Sign Transaction screen

Use the useSignTransaction hook from the MoonKey SDK to trigger the Sign Transaction screen:

Customizing the Sign Transaction screen

You can customize the Sign Transaction screen by passing UI options in the options.uiOptions object:

Configuration options

Basic UI Options

string
Custom title text displayed at the top of the Sign Transaction screen.Example:
string
Custom description text displayed below the title, providing context for the transaction.Example:
string
Custom text for the confirmation button.Default: 'Sign'Example:
boolean
Whether to show wallet information (address, balance) in the Sign Transaction screen.Default: trueExample:

Success Screen Options

string
Header text displayed on the success screen after the transaction is signed.Example:
string
Description text displayed on the success screen after the transaction is signed.Example:

Behavior Options

boolean
Whether the user can cancel the transaction signing request.Default: trueExample:
TransactionUIOptions
Custom options for displaying transaction information in the UI.This allows you to customize how transaction details are presented to the user.Example:

Common use cases

Token transfer transaction

Sign a transaction to transfer ERC-20 tokens:

Smart contract interaction

Sign a transaction to interact with a smart contract:

NFT minting transaction

Sign a transaction to mint an NFT:

Batch signing multiple transactions

Sign multiple transactions in sequence:

Complete example

Here’s a complete example with full transaction signing flow:

User experience flow

1

Trigger transaction signing

Your application calls signTransaction() with transaction data, wallet, and optional UI options.
2

Sign Transaction screen appears

The customized Sign Transaction screen is displayed with transaction details.
3

Review transaction details

User reviews the transaction information including recipient, amount, gas fees, and any contract interactions.
4

Approve or reject

User clicks the confirm button to sign, or cancels (if isCancellable: true) to reject.
5

Transaction signed

If approved, MoonKey signs the transaction with the user’s wallet private key.
6

Success screen

The success screen appears with the configured successHeader and successDescription.
7

Return signed transaction

The signed transaction is returned to your application for broadcasting.

Sign Transaction vs. Send Transaction

Understanding the difference between these two operations:
  • Only signs the transaction
  • Does not broadcast to the blockchain
  • Returns a signed transaction that you must broadcast manually
  • Useful when you need control over broadcasting timing
  • Can sign transactions offline
  • Good for batch operations or complex flows
  • Example: Sign now, broadcast later when conditions are met
  • Signs and broadcasts in one step
  • Automatically submits the transaction to the blockchain
  • Returns the transaction hash after broadcasting
  • Simpler for basic send operations
  • Requires active network connection
  • Best for immediate transactions
  • Example: Send ETH/tokens directly to a recipient

Broadcasting signed transactions

After signing a transaction, you need to broadcast it to the blockchain:

Best practices

Always explain what the transaction does in the description:
Enable showWalletUI so users can verify they have sufficient balance:
Inform users about next steps after signing:
Users may reject transactions or encounter errors:
Check transaction validity before prompting the user:
Set isCancellable: true for most transactions:
Only set isCancellable: false for critical flows where cancellation would break your app state.
Before broadcasting, verify the signed transaction matches your intent:

Security considerations

Always review transaction details carefully before signing. Malicious applications could trick users into signing transactions that drain their wallets or approve unlimited token spending.
For developers:
  1. Display full transaction details - Show recipient, amount, gas fees, and any contract interactions
  2. Validate transaction data - Verify the transaction is well-formed before requesting signature
  3. Check balances - Ensure users have sufficient funds before signing
  4. Rate limit signing - Prevent abuse by limiting how many transactions can be signed
  5. Log signed transactions - Keep records for debugging and user support
  6. Use secure RPC endpoints - Broadcast to trusted nodes only
For users: The Sign Transaction screen helps users by:
  • Displaying transaction details (recipient, amount, gas)
  • Showing their wallet balance
  • Providing clear context via title and description
  • Allowing them to cancel if isCancellable is true
  • Showing success confirmation before closing

Next steps

Send Transaction

Sign and send transactions in one step

Sign Message

Sign messages for authentication

UI Components Overview

Explore all UI components

Configure Appearance

Global appearance settings