XRP — book, deposit, get, nft, ripple, channel, Methods, server (2/2)
API reference for XRP. All methods ->
Part 2 of 2: 1 · 2
ripple_path_find
Finds a path for payment between two accounts, once.
Although the rippled server tries to find the cheapest path or combination of paths for making a payment, it is not guaranteed that the paths returned by this method are, in fact, the best paths.
Caution: Be careful with the pathfinding results from untrusted servers. A server could be modified to return less-than-optimal paths to earn money for its operators. A server may also return poor results when under heavy load. If you do not have your own server that you can trust with pathfinding, you should compare the results of pathfinding from multiple servers run by different parties, to minimize the risk of a single server returning poor results.
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):source_account(string — address; required): The account that would send funds.destination_account(string — address; required): The account that would receive funds.destination_amount(currency amount; required): How much the destination account would receive. Special case: You can specify-1(for XRP) or provide-1as thevaluefield (for tokens). This requests a path to deliver as much as possible, while spending no more than the amount specified insend_max(if provided).domain(string — hash; optional): The ledger entry ID of a permissioned domain. If provided, only return paths that use the corresponding permissioned DEX. (Requires the PermissionedDEX amendment)ledger_hash(string — hash; optional): The unique hash of the ledger version to use. (See Specifying Ledgers)ledger_index(ledger index; optional): The ledger index of the ledger to use, or a shortcut string to choose a ledger automatically. (See Specifying Ledgers)send_max(currency amount; optional): Maximum amount that would be spent. Cannot be used withsource_currencies.source_currencies(array; optional): Array of currencies that the source account might want to spend. Each entry in the array should be a JSON object with a mandatorycurrencyfield and optionalissuerfield, like how currency amounts are specified. Cannot contain more than 18 source currencies. By default, uses all source currencies available up to a maximum of 88 different currency/issuer pairs.
Returns
The response follows the standard format, with a successful result containing the following fields:
alternatives(array): Array of objects with possible paths to take, as described below. If empty, then there are no paths connecting the source and destination accounts.destination_account(string): Unique address of the account that would receive a payment transaction.destination_currencies(array): Array of strings representing the currencies that the destination accepts, as 3-letter codes likeUSDor as 40-character hex like015841551A748AD2C1F76FF6ECB0CCCD00000000.
Each element in the alternatives array is an object that represents a path from one possible source currency (held by the initiating account) to the destination account and currency. This object has the following fields:
paths_computed(array): Array of arrays of objects defining payment paths.source_amount(string or object): Currency Amount that the source would have to send along this path for the destination to receive the desired amount.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "ripple_path_find",
"params": [
{
"destination_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"destination_amount": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "0.001"
},
"source_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"source_currencies": [
{
"currency": "XRP"
},
{
"currency": "USD"
}
]
}
]
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"alternatives": [
{
"paths_canonical": [],
"paths_computed": [
[
{
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"type": 48
}
]
],
"source_amount": "461"
},
{
"paths_canonical": [],
"paths_computed": [],
"source_amount": {
"currency": "USD",
"issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"value": "0.0010015"
}
}
],
"destination_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"destination_amount": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "0.001"
},
"destination_currencies": [
"JOE",
"MXN",
"USD",
"DYM",
"CNY",
"015841551A748AD2C1F76FF6ECB0CCCD00000000",
"EUR",
"BTC",
"XRP"
],
"full_reply": true,
"source_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"status": "success"
}
}
Payment Channel Methods:
Payment channels are a tool for facilitating repeated, unidirectional payments, or temporary credit between two parties. Use these methods to work with payment channels.
channel_verify
Checks a payment channel claim's signature.
The channel_verify method checks the validity of a signature that can be used to redeem a specific amount of XRP from a payment channel.
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):amount(string; required): The amount of XRP, in drops, that the providedsignatureauthorizes.channel_id(string; required): The Channel ID of the channel that provides the amount. This is a 64-character hexadecimal string.public_key(string; required): The public key of the channel and the key pair that was used to create the signature, in hexadecimal or the XRP Ledger'sbase58format.signature(string; required): The signature to verify, in hexadecimal.
Returns
signature_verified(boolean): Iftrue, the signature is valid for the stated amount, channel, and public key.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "channel_verify",
"params": [
{
"channel_id": "5DB01B7FFED6B67E6B0414DED11E051D2EE2B7619CE0EAA6286D67A3A4D5BDB3",
"signature": "304402204EF0AFB78AC23ED1C472E74F4299C0C21F1B21D07EFC0A3838A420F76D783A400220154FB11B6F54320666E4C36CA7F686C16A3A0456800BBC43746F34AF50290064",
"public_key": "aB44YfzW24VDEJQ2UuLPV2PvqcPCSoLnL7y5M1EzhdW4LnK5xMS3",
"amount": "1000000"
}
]
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"signature_verified": true,
"status": "success"
}
}
Server Info Methods:
Use these methods to retrieve information about the current state of the rippled server.
fee
Retrieves information on the transaction cost.
The fee command reports the current state of the open-ledger requirements for the transaction cost. This requires the FeeEscalation amendment to be enabled.
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): none.
Returns
The response follows the standard format, with a successful result containing the following fields:
current_ledger_size(string — integer): Number of transactions provisionally included in the in-progress ledger.current_queue_size(string — integer): Number of transactions currently queued for the next ledger.drops(object): Various information about the transaction cost (theFeefield of a transaction), in drops of XRP.drops.base_fee(string — integer): The transaction cost required for a reference transaction to be included in a ledger under minimum load, represented in drops of XRP.drops.median_fee(string — integer): An approximation of the median transaction cost among transactions included in the previous validated ledger, represented in drops of XRP.drops.minimum_fee(string — integer): The minimum transaction cost for a reference transaction to be queued for a later ledger, represented in drops of XRP. If greater thanbase_fee, the transaction queue is full.drops.open_ledger_fee(string — integer): The minimum transaction cost that a reference transaction must pay to be included in the current open ledger, represented in drops of XRP.
expected_ledger_size(string — integer): The approximate number of transactions expected to be included in the current ledger. This is based on the number of transactions in the previous ledger.ledger_current_index(number): The Ledger Index of the current open ledger these stats describe.levels(object): Various information about the transaction cost, in fee levels. The ratio in fee levels applies to any transaction relative to the minimum cost of that particular transaction.levels.median_level(string — integer): The median transaction cost among transactions in the previous validated ledger, represented in fee levels.levels.minimum_level(string — integer): The minimum transaction cost required to be queued for a future ledger, represented in fee levels.levels.open_ledger_level(string — integer): The minimum transaction cost required to be included in the current open ledger, represented in fee levels.levels.reference_level(string — integer): The equivalent of the minimum transaction cost, represented in fee levels.
max_queue_size(string — integer): The maximum number of transactions that the transaction queue can currently hold.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "fee",
"params": [{}]
}'
Response example
{
"result": {
"current_ledger_size": "89",
"current_queue_size": "0",
"drops": {
"base_fee": "10",
"median_fee": "5000",
"minimum_fee": "10",
"open_ledger_fee": "10"
},
"expected_ledger_size": "396",
"ledger_current_index": 100647307,
"levels": {
"median_level": "128000",
"minimum_level": "256",
"open_ledger_level": "256",
"reference_level": "256"
},
"max_queue_size": "7920",
"status": "success"
}
}
feature
Retrieves information on the protocol amendments.
The feature command returns information about amendments this server knows about, including whether they are enabled and if the server knows how to apply the amendments.
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):feature(string; optional): The unique ID of an amendment, as hexadecimal; or the short name of the amendment. If provided, limits the response to one amendment. Otherwise, the response lists all amendments.
Returns
The response follows the standard format, with a successful result containing a map of amendments as a JSON object.
The keys of the object are amendment IDs. The values for each key are amendment objects that describe the status of the amendment with that ID. If the request specified a feature, the map contains only the requested amendment object, after applying any changes from the request. Each amendment object has the following fields:
enabled(boolean): Whether this amendment is currently enabled in the latest ledger.name(string; optional): The human-readable name for this amendment, if known.supported(boolean): Whether the server knows how to apply this amendment. If this field is set tofalse(the server does not know how to apply this amendment) andenabledis set totrue(this amendment is enabled in the latest ledger), this amendment may cause your server to be amendment blocked.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "fee",
"params": [
{
"feature": "4C97EBA926031A7CF7D7B36FDE3ED66DDA5421192D63DE53FFB46E43B9DC8373"
}
]
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"current_ledger_size": "36",
"current_queue_size": "0",
"drops": {
"base_fee": "10",
"median_fee": "5000",
"minimum_fee": "10",
"open_ledger_fee": "10"
},
"expected_ledger_size": "396",
"ledger_current_index": 100647615,
"levels": {
"median_level": "128000",
"minimum_level": "256",
"open_ledger_level": "256",
"reference_level": "256"
},
"max_queue_size": "7920",
"status": "success"
}
}
manifest
Retrieves public information on a known validator.
The manifest method reports the current "manifest" information for a given validator public key. The "manifest" is a block of data that authorizes an ephemeral signing key with a signature from the validator's master key pair.
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):public_key(string; required): The base58-encoded public key of the validator to look up. This can be the master public key or ephemeral public key.
Returns
The response follows the standard format, with a successful result containing the following fields:
details(object; optional): The data contained in this manifest. Omitted if the server does not have a manifest for thepublic_keyfrom the request. See Details Object below for a full description of its contents.manifest(string; optional): The full manifest data in base64 format. This data is serialized to binary before being base64-encoded. Omitted if the server does not have a manifest for thepublic_keyfrom the request.requested(string): Thepublic_keyfrom the request.
Details Object
If provided, the details object contains the following fields:
domain(string): The domain name this validator claims to be associated with. If the manifest does not contain a domain, this is an empty string.ephemeral_key(string): The ephemeral public key for this validator, in base58.master_key(string): The master public key for this validator, in base58.seq(number): The sequence number of this manifest. This number increases whenever the validator operator updates the validator's token to rotate ephemeral keys or change settings.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "manifest",
"params": [
{
"public_key":"nHUFE9prPXPrHcG3SkwP1UzAQbSphqyQkQK9ATXLZsfkezhhda3p"
}
]
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"details": {
"domain": "alloy.ee",
"ephemeral_key": "n9LMfcjE6dMyshCqiftLFXpB9K3Mnd2r5bG7K8osmrkFpHUoR3c1",
"master_key": "nHUFE9prPXPrHcG3SkwP1UzAQbSphqyQkQK9ATXLZsfkezhhda3p",
"seq": 4
},
"manifest": "JAAAAARxIe3AkJgOyqs3y+UuiAI27Ff3Mrfbt8e7mjdo06bnGEp5XnMhAu2LSAwZEQnm/mq9K6sSZJk5JkbcKCv6C7vQW2C8RnZVdkcwRQIhAI9uwQ1p58oyob1E+DaFLwjTdiRbVIKSMPqaaUwnJdN2AiB79DlPXHwztNULraVTkehbDsCAyDdf3VZB3FvkCZNOFHcIYWxsb3kuZWVwEkBf6A9ktcj2H4a61Av8ujQFL2KNcmr/FuEKbwlZEniJvhf0UqNiYc2bAsTJE5wMn00E0JBbw2m9OFwto50DcdkC",
"requested": "nHUFE9prPXPrHcG3SkwP1UzAQbSphqyQkQK9ATXLZsfkezhhda3p",
"status": "success"
}
}
server_definitions
Retrieves an SDK-compatible
definitions.jsongenerated from the currently runningrippledinstance.
The server_definitions command returns an SDK-compatible definitions.json, generated from the rippled instance currently running. You can use this to query a node in a network, quickly receiving the definitions necessary to serialize/deserialize its binary data.
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): none.
Returns
To see a full definitions.json file and descriptions of the top-level fields, see the Definitions File.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "server_definitions",
"params": []
}'
Response example
{
"id": 1,
"result": {
"FIELDS": [
[
"Generic",
{
"isSerialized": false,
"isSigningField": false,
"isVLEncoded": false,
"nth": 0,
"type": "Unknown"
}
],
[
"Invalid",
{
"isSerialized": false,
"isSigningField": false,
"isVLEncoded": false,
"nth": -1,
"type": "Unknown"
}
],
[
"ObjectEndMarker",
{
"isSerialized": true,
"isSigningField": true,
"isVLEncoded": false,
"nth": 1,
"type": "STObject"
}
],
[
"ArrayEndMarker",
{
"isSerialized": true,
"isSigningField": true,
"isVLEncoded": false,
"nth": 1,
"type": "STArray"
}
]
...
]
}
}