Stacks
Overview of the Stacks JSON-RPC methods supported by Wallet SDK.
These are the methods that wallets should implement to handle Stacks transfers and messages via WalletConnect.
Core Methods (common)
stx_getAddresses
Retrieve active account addresses; primarily Stacks-focused.
Request
{
"id": 1,
"jsonrpc": "2.0",
"method": "stx_getAddresses",
"params": {}
}Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"addresses": [
{
"symbol": "STX",
"address": "SP…"
}
]
}
}Notes:
- Use this first to select the wallet's active address.
- Filter on
symbol: "STX"or by address prefix (SP for mainnet, ST for testnet).
Stacks Methods
stx_transferStx
Transfer STX.
Request
{
"id": 1,
"jsonrpc": "2.0",
"method": "stx_transferStx",
"params": {
"sender": "SP3F7GQ48JY59521DZEE6KABHBF4Q33PEYJ823ZXQ",
"recipient": "SP3F7GQ48JY59521DZEE6KABHBF4Q33PEYJ823ZXQ",
"amount": "100000000000",
"memo": "",
"network": "mainnet"
}
}Parameters
| Parameter | Required? | Data Type | Description |
|---|---|---|---|
sender | Required | string | The stacks address of sender (required for multi-account scenarios) |
recipient | Required | string | Stacks address |
amount | Required | string | micro-STX (uSTX) |
memo | Optional | string | Memo string to be included with the transfer transaction |
network | Optional | string | "mainnet" | "testnet" | "devnet" |
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"txid": "1234567890abcdef1234567890abcdef12345678",
"transaction": "0x…"
}
}stx_signTransaction
Sign a Stacks transaction. Optional broadcast.
Request
{
"id": 1,
"jsonrpc": "2.0",
"method": "stx_signTransaction",
"params": {
"transaction": "0x…",
"broadcast": false,
"network": "mainnet"
}
}Parameters
| Parameter | Required? | Data Type | Description |
|---|---|---|---|
transaction | Required | string | hex transaction |
broadcast | Optional | boolean | default false |
network | Optional | string | "mainnet" | "testnet" | "devnet" |
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"signature": "0x…",
"transaction": "0x…",
"txid": "1234567890abcdef1234567890abcdef12345678"
}
}Note: txid is present if broadcast=true
stx_signMessage
Sign arbitrary message; supports structured (SIP-018).
Request
{
"id": 1,
"jsonrpc": "2.0",
"method": "stx_signMessage",
"params": {
"address": "SP3F7GQ48JY59521DZEE6KABHBF4Q33PEYJ823ZXQ",
"message": "message",
"messageType": "utf8",
"network": "mainnet",
"domain": "example.com"
}
}Parameters
| Parameter | Required? | Data Type | Description |
|---|---|---|---|
address | Required | string | The stacks address of sender |
message | Required | string | Utf-8 string representing the message to be signed by the wallet |
messageType | Optional | string | Type of message for signing: utf8 for basic string or structured for structured data |
network | Optional | string | Network for signing: mainnet, testnet, signet, devnet (note: redundant since chainId is provided) |
domain | Optional | string | Domain tuple per SIP-018 (for structured messages only) |
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"signature": "0x…"
}
}stx_signStructuredMessage
Domain-bound structured signing (SIP-018).
Request
{
"id": 1,
"jsonrpc": "2.0",
"method": "stx_signStructuredMessage",
"params": {
"message": "message",
"domain": "domain"
}
}Parameters
| Parameter | Required? | Data Type | Description |
|---|---|---|---|
message | Required | string | object | message to be signed |
domain | Required | string | object | domain for structured signing |
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"signature": "0x…",
"publicKey": "0x04…"
}
}Note: publicKey is optional
stx_callContract
Wrapper method for stx_signTransaction that calls a Stacks contract.
Request
{
"id": 1,
"jsonrpc": "2.0",
"method": "stx_callContract",
"params": {
"contract": "SP3F7GQ48JY59521DZEE6KABHBF4Q33PEYJ823ZXQ.my-contract",
"functionName": "get-balance",
"functionArgs": []
}
}Parameters
| Parameter | Required? | Data Type | Description |
|---|---|---|---|
contract | Required | string | Fully qualified contract identifier, including Stacks address and contract name |
functionName | Required | string | Name of the function to call |
functionArgs | Required | string[] | Arguments to pass to the contract function, encoded as strings |
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"txid": "stack_tx_id",
"transaction": "raw_tx_hex"
}
}txid- is used to identify the transaction on the explorertransaction- hex-encoded raw transaction
Session Properties
In a connection request, it is recommended to serialize the response to stx_getAddresses in session.sessionProperties.stacks_getAddresses. This allows dapps to consume an active session without requiring a context switch to re-request all addresses and associated public keys from the wallet.