Stellar — Transactions, Soroban JSON-RPC methods (1/2)
API reference for Stellar. All methods ->
Part 1 of 2: 1 · 2
GET /transactions/{transaction_hash}/effects
Retrieves all effects of a particular transaction.
This endpoint returns the effects of a specific transaction.
Parameters
transaction_hash(string; path; required): transactions are commands that modify the ledger state and consist of one or more operations.cursor(integer; query): a number that points to a specific location in a collection of responses and is pulled from thepaging_tokenvalue of a record.order(string; query): a designation of the order in which records should appear. Options includeasc(ascending) ordesc(descending). If this argument isn’t set, it defaults toasc.limit(integer; query): the maximum number of records returned. The limit can range from 1 to 200 - an upper limit that is hardcoded in Horizon for performance reasons. If this argument isn’t designated, it defaults to 10.
Returns
{
"_links": {
"self": {
"href": "string",
"templated": true
},
"next": {
"href": "string",
"templated": true
},
"prev": {
"href": "string",
"templated": true
}
},
"_embedded": {
"records": [
{
"_links": {
"operation": {
"href": "string",
"templated": true
},
"succeeds": {
"href": "string",
"templated": true
},
"precedes": {
"href": "string",
"templated": true
}
},
"id": "string",
"paging_token": "string",
"account": "string",
"type": "Account Created",
"type_i": 1,
"created_at": "string"
}
]
}
}
Request example
- Standard
- Streaming
curl https://rpc.ankr.com/http/stellar_horizon/transactions/{transaction_hash}/effects{?cursor,order,limit}
curl https://rpc.ankr.com/http/stellar_horizon/transactions/{transaction_hash}/effects{?cursor,order,limit} \
-H 'Accept: text/event-stream'
Response example
{
"_links": {
"self": {
"href": "https://rpc.ankr.com/transactions/512a9946bc7ff4a363299f14f79e0beb9b9cdbd0103e3a69a44446a0aa6471a8/effects?cursor=\u0026limit=1\u0026order=asc"
},
"next": {
"href": "https://rpc.ankr.com/transactions/512a9946bc7ff4a363299f14f79e0beb9b9cdbd0103e3a69a44446a0aa6471a8/effects?cursor=121628667754319873-1\u0026limit=1\u0026order=asc"
},
"prev": {
"href": "https://rpc.ankr.com/transactions/512a9946bc7ff4a363299f14f79e0beb9b9cdbd0103e3a69a44446a0aa6471a8/effects?cursor=121628667754319873-1\u0026limit=1\u0026order=desc"
}
},
"_embedded": {
"records": [
{
"_links": {
"operation": {
"href": "https://rpc.ankr.com/operations/121628667754319873"
},
"succeeds": {
"href": "https://rpc.ankr.com/effects?order=desc\u0026cursor=121628667754319873-1"
},
"precedes": {
"href": "https://rpc.ankr.com/effects?order=asc\u0026cursor=121628667754319873-1"
}
},
"id": "0121628667754319873-0000000001",
"paging_token": "121628667754319873-1",
"account": "GAHK7EEG2WWHVKDNT4CEQFZGKF2LGDSW2IVM4S5DP42RBW3K6BTODB4A",
"type": "account_credited",
"type_i": 2,
"created_at": "2020-02-20T21:18:33Z",
"asset_type": "native",
"amount": "1573.5112616"
}
]
}
}
Soroban JSON-RPC methods
getEvents— retrieves contract events.getFeeStats— retrieves statistics for charged inclusion fees.getHealth— retrieves node health.getLatestLedger— retrieves the latest known ledgers.getLedgerEntries— retrieves ledger entries.getLedgers— retrieves list of ledgers.getNetwork— retrieves network config.getTransaction— retrieves transaction details.getTransactions— retrieves list of transactions.getVersionInfo— retrieves version info.sendTransaction— submits a transaction.simulateTransaction— submits a trial contract invocation transaction.
getEvents
Retrieves contract events.
Clients can request a filtered list of events emitted by a given ledger range.
Soroban RPC will support querying within a maximum 24 hours of recent ledgers.
Note, this could be used by the client to only prompt a refresh when there is a new ledger with relevant events. It should also be used by backend Dapp components to "ingest" events into their own database for querying and serving.
If making multiple requests, clients should deduplicate any events received, based on the event's unique id field. This prevents double-processing in the case of duplicate events being received.
By default, Soroban RPC retains the most recent 24 hours of events.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):-
startLedger(number, required): Ledger sequence number to fetch events after (inclusive). This method will return an error if startLedger is less than the oldest ledger stored in this node, or greater than the latest ledger seen by this node. If a cursor is included in the request,startLedgermust be omitted. -
filters(array of objects; optional): List of filters for the returned events. Events matching any of the filters are included. To match a filter, an event must match both acontractIdand atopic. Maximum 5 filters are allowed per request:type(string): A comma separated list of event types (system, contract, or diagnostic) used to filter events. If omitted, all event types are included.contractIds(array of strings): List of contract IDs to query for events. If omitted, return events for all contracts. Maximum 5 contract IDs are allowed per request.topics(array): List of topic filters. If omitted, query for all events. If multiple filters are specified, events will be included if they match any of the filters. Maximum 5 filters are allowed per request.- A
TopicFilterisSegmentMatcher[]— The list can be 1-4SegmentMatcherslong. - A
SegmentMatcheris one of the following:- For an exact segment match, a string containing a base64-encoded ScVal.
- For a wildcard single-segment match, the string "*", matches exactly one segment.
- A
-
pagination(object; optional): Pagination in Soroban RPC is similar to pagination in Horizon. See Pagination.cursor(string): A string ID that points to a specific location in a collection of responses and is pulled from thepaging_tokenvalue of a record. When a cursor is provided Soroban RPC will not include the element whose id matches the cursor in the response. Only elements which appear after the cursor are included.number(number): The maximum number of records returned. The limit forgetEventscan range from 1 to 10000 — an upper limit that is hardcoded in Soroban RPC for performance reasons. If this argument isn't designated, it defaults to 100.
-
Returns
latestLedger(number): The sequence number of the latest ledger known to Soroban RPC at the time it handled the request.events(array of objects):type(string): The type of event emission (enum:contract,diagnostic,system)ledger(number): Sequence number of the ledger in which this event was emitted.ledgerClosedAt(string): ISO-8601 timestamp of the ledger closing timecontractId(string): StrKey representation of the contract address that emitted this event.id(string): Unique identifier for this event. - The event's unique id field is based on atoidfrom Horizon as used in Horizon's /effects endpoint. - https://github.com/stellar/go/blob/master/services/horizon/internal/db2/history/effect.go#L58 - Specifically, it is a string containing: - bigint(32 bit ledger sequence + 20 bit txn number + 12 bit operation) +<hyphen>+ number for the event within the operation. - For example:1234-1pagingToken(string): Duplicate ofidfield, but in the standard place for pagination tokens.inSuccessfulContractCall(boolean): If true the event was emitted during a successful contract call.topic(array of strings): List containing the topic this event was emitted with:SegmentMatcher(string): ASegmentMatcheris one of the following:- For an exact segment match, a string containing a base64-encoded ScVal.
- For a wildcard single-segment match, the string "*", matches exactly one segment.
value(object): The data the event was broadcasting in the emitted event:xdr(string): The emitted body value of the event (serialized in a base64 string).
Request example
curl 'https://rpc.ankr.com/stellar_testnet_soroban' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getEvents",
"params": {
"startLedger": 1051743,
"pagination": {
"limit": 2
}
}
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"events": [
{
"type": "contract",
"ledger": 180118,
"ledgerClosedAt": "2024-01-22T16:13:07Z",
"contractId": "CB22KRA3YZVCNCQI64JQ5WE7UY2VAV7WFLK6A2JN3HEX56T2EDAFO7QF",
"id": "0000773600919453696-0000000000",
"pagingToken": "0000773600919453696-0000000000",
"topic": [
"AAAADwAAAAh0cmFuc2Zlcg==",
"AAAAEgAAAAEmtLQQgiJ5guKLxbQdFEQ8qF20pUVTAcvU9RfF4mln5g==",
"AAAAEgAAAAAAAAAAbLAgdrWIvo9rNehnYdwy70gTNnWQ4rP2Ffvq1rYk0sw=",
"AAAADgAAAD1CTE5EOkdBVEFMVEdUV0lPVDZCVURCQ1pNM1E0T1E0Qk8yQ09MT0FaN0lZU0tQTEMyUE1TT1BQR0Y1VjU2AAAA"
],
"value": "AAAACgAAAAAAAAAAAAAABkNdp0E=",
"inSuccessfulContractCall": true
},
{
"type": "contract",
"ledger": 180118,
"ledgerClosedAt": "2024-01-22T16:13:07Z",
"contractId": "CABFXDAA5BILXZPD7Y25QQPO77M5JHCCC3HWUBDGU52HNUHL4Z6YCTAC",
"id": "0000773600919453696-0000000001",
"pagingToken": "0000773600919453696-0000000001",
"topic": [
"AAAADwAAAAVjbGFpbQAAAA==",
"AAAAEgAAAAAAAAAAbLAgdrWIvo9rNehnYdwy70gTNnWQ4rP2Ffvq1rYk0sw="
],
"value": "AAAAEAAAAAEAAAACAAAAEAAAAAEAAAACAAAAAwAAAAAAAAADAAAAAwAAAAoAAAAAAAAAAAAAAAZDXadB",
"inSuccessfulContractCall": true
}
],
"latestLedger": 192067
}
}
Soroban JSON-RPC methods
getFeeStats
Retrieves statistics for charged inclusion fees.
Statistics for charged inclusion fees. The inclusion fee statistics are calculated from the inclusion fees that were paid for the transactions to be included onto the ledger. For Soroban transactions and Stellar transactions, they each have their own inclusion fees and own surge pricing. Inclusion fees are used to prevent spam and prioritize transactions during network traffic surge.
Parameters
id(integer; required): a request ID (example: 1).jsonrpc(string; required): a JSON RPC spec used (example: 2.0).method(string; required): a method used for the request.
Returns
sorobanInclusionFee(object; required): Inclusion-fee distribution statistics for Soroban transactions, measured per transaction.min(string): Minimum inclusion fee observed.max(string): Maximum inclusion fee observed.mode(string): Most frequently occurring inclusion fee.p10(string): 10th percentile inclusion fee (nearest-rank method).p20(string): 20th percentile inclusion fee (nearest-rank method).p30(string): 30th percentile inclusion fee (nearest-rank method).p40(string): 40th percentile inclusion fee (nearest-rank method).p50(string): 50th percentile inclusion fee (median, nearest-rank method).p60(string): 60th percentile inclusion fee (nearest-rank method).p70(string): 70th percentile inclusion fee (nearest-rank method).p80(string): 80th percentile inclusion fee (nearest-rank method).p90(string): 90th percentile inclusion fee (nearest-rank method).p95(string): 95th percentile inclusion fee (nearest-rank method).p99(string): 99th percentile inclusion fee (nearest-rank method).transactionCount(number): Number of Soroban transactions included in this distribution.ledgerCount(number): Number of consecutive ledgers analyzed to produce the statistics.
inclusionFee(object; required): Inclusion-fee distribution statistics for classic Stellar transactions, normalized per operation.min(string): Minimum inclusion fee observed per operation.max(string): Maximum inclusion fee observed per operation.mode(string): Most frequently occurring inclusion fee per operation.p10(string): 10th percentile inclusion fee per operation (nearest-rank method).p20(string): 20th percentile inclusion fee per operation (nearest-rank method).p30(string): 30th percentile inclusion fee per operation (nearest-rank method).p40(string): 40th percentile inclusion fee per operation (nearest-rank method).p50(string): 50th percentile inclusion fee per operation (median, nearest-rank method).p60(string): 60th percentile inclusion fee per operation (nearest-rank method).p70(string): 70th percentile inclusion fee per operation (nearest-rank method).p80(string): 80th percentile inclusion fee per operation (nearest-rank method).p90(string): 90th percentile inclusion fee per operation (nearest-rank method).p95(string): 95th percentile inclusion fee per operation (nearest-rank method).p99(string): 99th percentile inclusion fee per operation (nearest-rank method).transactionCount(number): Number of classic transactions included in this distribution.ledgerCount(number): Number of consecutive ledgers analyzed to produce the statistics.
latestLedger(number; required): Sequence number of the latest ledger known to Stellar RPC at the time it handled the request.
Request example
curl 'https://rpc.ankr.com/stellar_testnet_soroban' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getFeeStats"
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"sorobanInclusionFee": {
"max": "100",
"min": "100",
"mode": "100",
"p10": "100",
"p20": "100",
"p30": "100",
"p40": "100",
"p50": "100",
"p60": "100",
"p70": "100",
"p80": "100",
"p90": "100",
"p95": "100",
"p99": "100",
"transactionCount": "14",
"ledgerCount": 50
},
"inclusionFee": {
"max": "108",
"min": "100",
"mode": "100",
"p10": "100",
"p20": "100",
"p30": "100",
"p40": "100",
"p50": "100",
"p60": "100",
"p70": "100",
"p80": "100",
"p90": "100",
"p95": "108",
"p99": "108",
"transactionCount": "13",
"ledgerCount": 10
},
"latestLedger": 1051780
}
}
getHealth
Retrieves node health.
General node health check.
Parameters
id(integer; required): a request ID (example: 1).jsonrpc(string; required): a JSON RPC spec used (example: 2.0).method(string; required): a method used for the request.
Returns
status(string): node status (example: "healthy").
Request example
curl 'https://rpc.ankr.com/stellar_testnet_soroban' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getHealth"
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"status": "healthy"
}
}
getLatestLedger
Retrieves the latest known ledger.
For finding out the current latest known ledger of this node. This is a subset of the ledger info from Horizon.
Parameters
id(integer; required): a request ID (example: 1).jsonrpc(string; required): a JSON RPC spec used (example: 2.0).method(string; required): a method used for the request.
Returns
id(string): hash identifier of the latest ledger (as a hex-encoded string) known to Soroban RPC at the time it handles the request (pattern:^[a-f\d]{64}$).protocolVersion(number): Stellar Core protocol version associated with the latest ledger.sequence(number): the sequence number of the latest ledger known to Soroban RPC at the time it handles the request.
Request example
curl 'https://rpc.ankr.com/stellar_testnet_soroban' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getLatestLedger"
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"id": "c73c5eac58a441d4eb733c352...",
"protocolVersion": 20,
"sequence": 2539605
}
}
getLedgerEntries
Retrieves ledger entries.
For reading the current value of ledger entries directly.
Allows you to directly inspect the current state of a contract, a contract's code, or any other ledger entry. This is a backup way to access your contract data which may not be available via events or simulateTransaction.
To fetch contract wasm byte-code, use the ContractCode ledger entry key.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):keys(array of strings; required): an array containing the keys of the ledger entries you wish to retrieve (an array of serialized base64 strings).
Returns
latestLedger(number): the sequence number of the latest ledger known to Soroban RPC at the time it handles the request.entries(array): an array of objects containing all found ledger entries:key(string): the key of the ledger entry (base64 string).xdr(string): the current value of the given ledger entry (base64 string).lastModifiedLedgerSeq(number): the ledger sequence number of the last time this entry was updated.liveUntilLedgerSeq(number): sequence number of the ledger.
Request example
curl 'https://rpc.ankr.com/stellar_testnet_soroban' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getLedgerEntries",
"params": {
"keys": [
0: "AAAABgAAAAHMA/50/Q+w3Ni8UXWm/trxFBfAfl6De5kFttaMT0/ACwAAABAAAAABAAAAAgAAAA8AAAAHQ291bnRlcgAAAAASAAAAAAAAAAAg4dbAxsGAGICfBG3iT2cKGYQ6hK4sJWzZ6or1C5v6GAAAAAE="
]
}
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"entries": [
0: {
"key": "AAAAB+qfy4GuVKKfazvyk4R9P9fpo2n9HICsr+xqvVcTF+DC",
"xdr": "AAAABgAAAAAAAAABzAP+dP0PsNzYvFF1pv7a8RQXwH5eg3uZBbbWjE9PwAsAAAAQAAAAAQAAAAIAAAAPAAAAB0NvdW50ZXIAAAAAEgAAAAAAAAAAIOHWwMbBgBiAnwRt4k9nChmEOoSuLCVs2eqK9Qub+hgAAAABAAAAAwAAAAw=",
"lastModifiedLedgerSeq": 2552504
}
],
"latestLedger": 2552990
}
}
getLedgers
Retrieves list of ledgers.
The getLedgers method returns a detailed list of ledgers starting from the user specified starting point that you can paginate as long as the pages fall within the history retention of their corresponding RPC provider.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(object; required):startLedger(number; optional): ledger sequence number to start fetching from (inclusive). This must not be less than the oldest ledger stored in the node or greater than the latest ledger seen by the node. If acursoris included,startLedgermust be omitted.pagination(object; optional): pagination options, similar to Horizon pagination.cursor(string; optional): opaque string acting as a paging token. To fetch the next page of results, set this value to thecursorfield returned in the previous response.limit(number; optional): maximum number of records to return. Valid range is1–10000. Defaults to100if not specified.
xdrFormat(string; optional): output format for the response. Acceptsbase64(default) orjson. Ifjsonis used, note that the schema may change with underlying XDR updates.
Returns
ledgers(array[object]; required): List of ledger entries returned by the query.hash(string): Hash of the ledger header that was included in the chain.sequence(number): Sequence number of the ledger (also referred to as the block height).ledgerCloseTime(string): Timestamp at which the ledger was closed.headerXdr(string): Base64-encodedLedgerHeaderstructure for this ledger.metadataXdr(string): Base64-encodedLedgerCloseMetaunion for this ledger.
latestLedger(number; required): Sequence number of the latest ledger known to Stellar RPC at the time it handled the request.latestLedgerCloseTime(number; required): Unix timestamp of the close time of the latest ledger known to Stellar RPC at the time it handled the request.oldestLedger(number; required): Sequence number of the oldest ledger ingested by Stellar RPC at the time it handled the request.oldestLedgerCloseTime(number; required): Unix timestamp of the close time of the oldest ledger ingested by Stellar RPC at the time it handled the request.cursor(string; optional): Paging token to be included in a subsequent request to obtain the next page of results.
Request example
curl 'https://rpc.ankr.com/stellar_testnet_soroban' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getLedgers",
"params": {
"startLedger": 1052244,
"pagination": {
"limit": 2
}
}
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"ledgers": [
{
"hash": "318ce21369ba24f8332bd14babdb09889f24dce1bc089db067ab2af47d7aea0a",
"sequence": 1052244,
"ledgerCloseTime": "1760459309",
"headerXdr": "MYziE2m6JPgzK9FLq9sJiJ8k3OG8CJ2wZ6sq9H166goAAAAXqhYfNK6HfdyFen5WLUKzBrk4fqj2VgOFqA/e3Q0UBETV3k/2lliqEEleXCOJyLA7tEo+w6HoGUVmk9D1sibuxwAAAABo7notAAAAAAAAAAEAAAAAtV0Qsrt9KE7VwDpHpeG1kMkPV4NVRxzEUHu+ggTSPIsAAABAeBGYsdJuZvlPM7eIn7JrDrYrbTCGmMPYbMEKJtt7R8wJ2T8cjqH539FA7R8+WwwkH6aXeYnL7PGLFDprjVkHDmuVnjV3jJGH2Xbn8cE4ggoGSGNwv/kQZAVp4k9vqQu5/gq1fwb04v/lrWxbDVlQNcQczExnupW7OF5COtCaJYkAEA5UDeC2s6dkAAAAAAA6wJhozQAAAAAAAAAAAAAolQAAAGQATEtAAAAAyAtzObU3PsJWeTkdkBDOyExMTol0rEV7SX0oar2zxLtYDneB8P56sIYAP871glDb/k8XmSekQUzwCUQmkpViI6jDzf6BDMFFWKRAYhEqTq9VipuOz3SuiIzqdfMQdaLqhHjfX/XfBYxAEzDm6pGn2/xshRwOT3D56ojadgOLJjaYAAAAAAAAAAA=",
"metadataXdr": "AAAAAgAAAAAxjOITabok+DMr0Uur2wmInyTc4bw..."
},
{
"hash": "f8a3fc2f5a48f6c45a8a135f73ef6c818ec609b12b0e2a0a9ce8af73c0d4458d",
"sequence": 1052245,
"ledgerCloseTime": "1760459314",
"headerXdr": "+KP8L1pI9sRaihNfc+9sgY7GCbErDioKnOivc8DURY0AAAAXMYziE2m6JPgzK9FLq9sJiJ8k3OG8CJ2wZ6sq9H166gp533EGZ5PUMkezV8dRbxfBvkP+FWZ+DjgLLP+NYx2HzgAAAABo7noyAAAAAAAAAAEAAAAAtV0Qsrt9KE7VwDpHpeG1kMkPV4NVRxzEUHu+ggTSPIsAAABAJFqX2dyeZKxyFDk0H8uLiBqAkjnfnI/zCN43cLn26phZAivqFn+ZcURQTbPNLbMgx7Do59GWnkHZjpgFnrlDDNKlI/RUA1dq+H7EHtDzxOJuUk3iUMYSLimzRsEr3D+hRj35YE8eQRxWWnoiFL5qJnnRZG7pl6tByRySoa2a/mUAEA5VDeC2s6dkAAAAAAA6wJhplQAAAAAAAAAAAAAolQAAAGQATEtAAAAAyAtzObU3PsJWeTkdkBDOyExMTol0rEV7SX0oar2zxLtYDneB8P56sIYAP871glDb/k8XmSekQUzwCUQmkpViI6jDzf6BDMFFWKRAYhEqTq9VipuOz3SuiIzqdfMQdaLqhHjfX/XfBYxAEzDm6pGn2/xshRwOT3D56ojadgOLJjaYAAAAAAAAAAA=",
"metadataXdr": "AAAAAgAAAAD4o/wvWkj2xFqKE19z72yBjsYJsSsO..."
}
],
"latestLedger": 1052247,
"latestLedgerCloseTime": 1760459324,
"oldestLedger": 931288,
"oldestLedgerCloseTime": 1759853894,
"cursor": "1052245"
}
}