How to Use getSignaturesForAddress
Learn getSignaturesForAddress use cases, code examples, request parameters, response structure, and tips.
The getSignaturesForAddress
RPC method allows you to retrieve a list of confirmed transaction signatures that involve a specific account address. This is useful for fetching the transaction history of an account. Signatures are returned in reverse chronological order (newest first).
Common Use Cases
- Account Transaction History: Displaying the past transactions for a user’s wallet. For more advanced parsing of transaction history, consider using Helius’s Enhanced Transactions API.
- Activity Auditing: Reviewing all transactions associated with a particular smart contract or account.
- Specific Transaction Lookup: Finding a specific transaction by iterating through an account’s history if only the involved address is known.
- Data Indexing: Building a localized index of transactions for faster querying and analysis.
Request Parameters
address
(string
): (Required) The base-58 encoded public key of the account for which to retrieve transaction signatures.options
(object
, optional): An optional configuration object with the following fields:limit
(number
, optional): The maximum number of signatures to return. The default is 1000, and the maximum allowed is 1000.before
(string
, optional): A base-58 encoded transaction signature. If provided, the query will start searching for transactions before this signature.until
(string
, optional): A base-58 encoded transaction signature. If provided, the query will search for transactions until this signature is reached (exclusive).commitment
(string
, optional): Specifies the commitment level to use for the query. Supported values arefinalized
,confirmed
, orprocessed
. If omitted, the default commitment of the RPC node is used (usuallyfinalized
).minContextSlot
(number
, optional): The minimum slot that the request can be evaluated at. This is not a filter on historical transactions but sets the minimum slot for the node’s context.
Response Structure
The result
field of the JSON-RPC response is an array of signature information objects. Each object has the following structure:
signature
(string
): The base-58 encoded transaction signature.slot
(u64
): The slot in which the transaction was processed.err
(object
|null
): An error object if the transaction failed, ornull
if it succeeded.memo
(string
|null
): The memo associated with the transaction, if any.blockTime
(i64
|null
): The estimated production time of the block containing the transaction, as a Unix timestamp (seconds since epoch).null
if not available.confirmationStatus
(string
|null
): The confirmation status of the transaction (e.g.,processed
,confirmed
,finalized
).null
if not available (e.g., for older Helius responses).
Examples
1. Get the Latest Signatures for an Address
This example fetches the most recent (up to 1000) transaction signatures for a given address.
2. Get Signatures with a Limit
This example fetches a specified number of recent transaction signatures for an address.
3. Paginating Through Transaction History
This example demonstrates how to fetch transaction history in batches using the before
parameter.
Developer Tips
- Pagination: To get a complete transaction history for an active account, you’ll likely need to make multiple requests, using the
before
parameter with the last signature received in the previous batch and alimit
. - Rate Limits: Be mindful of RPC node rate limits when fetching extensive transaction histories.
- Order: Signatures are always returned from newest to oldest.
limit
Parameter: Thelimit
parameter can be between 1 and 1000. If not specified, it defaults to 1000.until
Parameter: This parameter can be used to stop fetching signatures if a known older signature is reached, which can be useful if you only need transactions up to a certain point.minContextSlot
: This parameter does not filter historical transactions. It specifies the minimum slot the RPC node should use for its context when evaluating the request. If the node’s state is older than this slot, it may return an error.- Transaction Details: This method only returns signatures and basic information. To get full transaction details, you would use the
getTransaction
method with each signature.
By using getSignaturesForAddress
with its pagination options, you can effectively retrieve and manage transaction histories for any Solana address.