STREAMD
streamd. Each streamd server connects to the Stream network, relays cryptographically signed transactions, and maintains a complete local copy of the shared global ledger. The streamd source code is written in C++ and is available on GitHub under an open-source license.
- Creation and installation
- API Reference
- Transaction Reference
WebSocket and JSON-RPC APIs
streamd server, use the WebSocket API or JSON-RPC API. Both APIs support the same commands with almost identical parameters. Alternatively, use StreamAPI, a simplified JavaScript client library that works with Node.js or a web browser:
- WebSocket API uses the WebSocket protocol, which can be implemented by most browsers and JavaScript to achieve persistent two-way communication. There is not a 1:1 correlation between requests and responses. Some requests to the server will respond to multiple messages asynchronously; other times, responses may arrive in a different order than the request that submitted them. The
streamdserver can be configured to accept secure (wss://), insecure (ws://) WebSocket connections, or both. - The JSON-RPC API relies on request-response communication over HTTP or HTTPs. (The
streamdserver can be configured to accept HTTP, HTTPS, or both.) For commands that prompt multiple responses, you can provide a callback URL. - The
streamdprogram can also be used as a fast command line client to send JSON-RPC requests to a runningstreamdserver. This is designed for administrative purposes and is not a supported API.
API Changes
WebSocket and JSON-RPC APIs are still under development and are subject to change.
Connecting to streamd
streamd server, you need to know which server to connect to. Most servers are configured not to accept requests directly from external networks.
The following public servers are provided by labs.stream:
| Domain | Location | Memo |
|---|---|---|
| api.labs.stream | cn | (recommended) |
streamd instance. This is required to run administrative commands. In that case, use the IP address and port to which your server is bound.Why Run Your Own streamd Server?
streamd server. In general, you can trust your own server, control its workload, and decide when and how to use it.
Trusting the streamd server you use is important: you need to know that the software behaves as its source code specifies. You must also use sound security practices to protect the server from attacks. A malicious server could exploit you or cause you to lose funds. For example:
- A malicious server can report that you received a payment when no payment was made.
- It can selectively show or hide payment paths and currency transactions, not providing you with the best deal to protect your own interests.
- If you send it your account secrets, it can conduct any transaction in your name, and even transfer or destroy all the money in your account balance.
streamd can scale down its responses when needed. If you share a server with others, you may not always receive the best results.WebSocket API
streamd server, you can build your own client in JavaScript to run in a browser (see this example) or Node.js. Currently Stream Labs maintains a public WebSocket server at the following address:
| Domain | Port |
|---|---|
| api.labs.stream | 443 (wss://) |
| api.labs.stream | 5006 (ws://) |
streamd server, or have someone you trust do so.JSON-RPC
streamd server.
Request format
To make a JSON-RPC request, send an HTTP POST request to the root of thestreamd IP port on which the server is listening for JSON-RPC connections (/). You can use HTTP/1.0 or HTTP/1.1. If you use HTTPS, you should use TLS v1.2. For security reasons, streamd does not support SSL v3 or earlier.
Always include a Content-Type header containing the value application/json.
If you plan to make multiple requests, use Keep-Alives so that you do not have to close and reopen the connection between requests.
Send the request body as a JSON object with the following properties:
- Place the command in the top-level
"method"field - Includes top-level
"params"fields. The content of this field should be a single-item array containing only one nested JSON object containing all parameters of the command.
| Domain | Port |
|---|---|
| api.labs.stream | 5005 |
streamd server, or have someone you trust do so.
If you run your own streamd server, make sure you have the JSON-RPC interface in the streamd.cfg file, as JSON-RPC is not available by default. The relevant part looks like this example:
# [rpc_ip]: # IP address or domain to bind to allow insecure RPC connections. # Defaults to not allow RPC connections. # # [rpc_port]: # Port to bind to if allowing insecure RPC connections. [rpc_ip] 127.0.0.1 [rpc_port] 8088
Command-Line Interface
streamd connects to the local instance. Alternatively, you can specify a server connection configuration file or --rpc-ip command line parameter. For example:
streamd --rpc_ip=api.labs.streamd:5005 server_info
Request Format
- WebSocket requests put the command name in the
“command”field alongside the command parameters at the root of the JSON object. An optional“id”field is echoed in the response so that you can match responses to requests even when they arrive out of order. - JSON-RPC requests put the command in the
“method”field and the parameters in a separate object, as the first member of the“params”array. There is no“id”field because each response is returned directly to its request. - The command line outputs commands after any formal command line selection, followed by a restricted set of parameters, separated by whitespace.
{
"id": 2,
"command": "account_info",
"account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"strict": true,
"ledger_index": "validated"
}
POST http://s1.labs.stream:51234/
{
"method": "account_info",
"params": [
{
"account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"strict": true,
"ledger_index": "validated"
}
]
}
streamd account_info vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV validated true
Response Format
{
"id": 2,
"status": "success",
"type": "response",
"result": {
"account_data": {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Balance": "27389517749",
"Flags": 0,
"LedgerEntryType": "AccountRoot",
"OwnerCount": 18,
"PreviousTxnID": "B6B410172C0B65575D89E464AF5B99937CC568822929ABF87DA75CBD11911932",
"PreviousTxnLgrSeq": 6592159,
"Sequence": 1400,
"index": "4F83A2CF7E70F77F79A307E6A472BFC2585B806A70833CCD1C26105BAE0D6E05"
},
"ledger_index": 6760970
}
}
{
"id": 2,
"status": "success",
"type": "response",
"result": {
"account_data": {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Balance": "27389517749",
"Flags": 0,
"LedgerEntryType": "AccountRoot",
"OwnerCount": 18,
"PreviousTxnID": "B6B410172C0B65575D89E464AF5B99937CC568822929ABF87DA75CBD11911932",
"PreviousTxnLgrSeq": 6592159,
"Sequence": 1400,
"index": "4F83A2CF7E70F77F79A307E6A472BFC2585B806A70833CCD1C26105BAE0D6E05"
},
"ledger_index": 6760970
}
}
{
"result": {
"account_data": {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Balance": "27389517749",
"Flags": 0,
"LedgerEntryType": "AccountRoot",
"OwnerCount": 18,
"PreviousTxnID": "B6B410172C0B65575D89E464AF5B99937CC568822929ABF87DA75CBD11911932",
"PreviousTxnLgrSeq": 6592159,
"Sequence": 1400,
"index": "4F83A2CF7E70F77F79A307E6A472BFC2585B806A70833CCD1C26105BAE0D6E05"
},
"ledger_index": 6761012,
"status": "success"
}
}
Error Responses
streamd server successfully receives your request, it will attempt to respond with a standardized error format.
Some error examples:
{
"id": 3,
"status": "error",
"type": "response",
"error": "ledgerIndexMalformed",
"request": {
"account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"command": "account_info",
"id": 3,
"ledger_index": "-",
"strict": true
}
}
HTTP Status: 200 OK
{
"result": {
"error": "ledgerIndexMalformed",
"request": {
"account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"command": "account_info",
"ledger_index": "-",
"strict": true
},
"status": "error"
}
}
{
"result": {
"error": "ledgerIndexMalformed",
"request": {
"account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"command": "account_info",
"ledger_index": "-",
"strict": true
},
"status": "error"
}
}
WebSocket API error response format
| field | Type | Description |
|---|---|---|
| id | (Varies) | Provide the ID of this response in the WebSocket request |
| status | String | "error" if the request caused an error. |
| type | String | Normally "response", indicating a response to a command. |
| error | String | A unique code identifying the type of error. |
| request | Object | A copy of the request that caused the error, in JSON format. Warning: any account secrets included in the request are also included here. |
JSON-RPC API Error Response Format
Some JSON-RPC requests will respond with error codes at the HTTP layer. In these cases, the response is plain text within the body of the response. For example, if you forget to specify the command in themethod parameter, the response will look like this:
HTTP Status: 400 Bad Request Null methodFor other errors returned with HTTP status 200 OK, the JSON response contains the following fields:
| field | Type | Description |
|---|---|---|
| result | Object | Object containing the response to the query |
| result.error | String | A unique code identifying the type of error. |
| result.status | String | "error" if the request caused an error. |
| result.request | Object | A copy of the request prompting this error in JSON format. Warning: If the request contains any account secrets, they will be displayed here! NOTE: The request is reformatted in WebSocket format regardless of what it is. |
Caution When Sharing Errors
When your request results in an error, the entire request is logged in the background as a partial response so you can try to debug the error. However, this also includes any confidentiality included as part of the request. When sharing incorrect information, be very careful not to accidentally reveal important private account information to others.
Universal Errors
error code values:
unknownCmd- The request does not contain a command recognized by thestreamdserver.jsonInvalid- (WebSocket only) The request was not a valid JSON object.- JSON-RPC returns a 400 Bad Request HTTP error in this case.
missingCommand- (WebSocket only) The request did not specify a command field.- JSON-RPC returns a 400 Bad Request HTTP error in this case.
tooBusy- The server is under heavy load and cannot execute this command at this time. If you connect to the server as an administrator, you will usually not be denied.noNetwork- The server cannot connect to the remaining radar networks (and cannot run in standalone mode).noCurrent- Due to high load, network issues, validator failure, misconfiguration, or other issues, the server does not know what the existing ledger is.noClosed- The server has no closed ledgers, primarily because it has not completed startup.wsTextRequired- (WebSocket only) The request's opcode is not text.
Format Conventions
WebSocket and JSON-RPC APIs generally take the same parameters, albeit in different ways (see Request Formatting for details). Many similar parameters appear in the API, and there are some conventions for how to specify these parameters.
All field names are case-sensitive. In the response, fields obtained directly from the ledger node or transaction object start with an uppercase letter. Other fields, including some that continually dynamically generate responses, are lowercase.
Basic Data Types
Different types of objects are uniquely identified in different ways:
Accounts are distinguished by their respective addresses, such as "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59". The address starts with the letters r, and some streamd also accept hexadecimal address form.
Transactions are identified by the binary coded hash value of the transaction, and you can also identify them by the account and serial number sent by the transaction.
Each complete ledger has a ledger index and a unique hash value, which can be used to specify an instance of the ledger.
Addresses
- The address length is between 25-35 characters
- Starts with the letters
v - Use English letters, excluding numbers
0, uppercase lettersO, uppercase lettersI, lowercase lettersl - Case sensitive
- Contains 4 bytes of checksum
- The number of valid addresses generated is close to 2^32
Hashes
- Length of 64 characters
- Represented as hexadecimal: 0-9, A-F
- Usually represented in uppercase letters
Account Sequence Numbers
A serial number is a 32-bit unsigned integer that identifies a transaction or offer relative to a specific account.
Each account in the Stream ledger has a serial number, starting from 1. For a transaction to be sent to the network or included to a validated ledger, it must have a sequence field that matches the current sequence of the sending account. The account's sequence field is incremented every time a transaction from that account is included in the verified ledger (regardless of whether the transaction succeeded or failed). This preserves the order of transactions for that account and distinguishes between two potentially identical transactions.
Each node in the Stream is tagged with the sending account address and sequence value of the OfferCreate transaction that created it. These two fields together provide a unique identifier.
Ledger Index
1, and each new account's category index is higher than its previous account's index 1.
The ledger index expresses the order between accounts; the Hash value identifies the exact content of the account. Two accounts with the same hash are always the same. For certified ledgers, hash values and serial numbers are equally valid, and the relationship is one-to-one. However, this does not apply to ongoing accounts:
- Because transactions are not fully propagated throughout the network, two different
streamdservers may have accounts with the same sequence number but different contents. - There may be multiple closed account versions competing for consensus. These accounts have the same serial number but different contents (different hashes). In the end, only one can be authenticated
- The contents of the existing ledger change over time, even if the sequence number is the same, this will cause the hash to change. Therefore, its hash cannot be calculated until the ledger is closed.
Specifying a Ledger
Many API methods require you to specify a ledger instance that includes the correct data to be retrieved and the latest data for a specific version of the shared ledger. Commands that accept a version of the ledger all work the same way. There are three ways you can specify the ledger:
- Specify the ledger via the serial number in the
ledger_indexparameter. Each closed ledger has an identifiable sequence number that is one greater than the previous validated ledger. (The origin ledger sequence number is 0) - Specify the ledger via the hash value in the
ledger_hashparameter. - Specify the ledger via one of the shortcuts in the
ledger_indexparameter:validated: For most recent ledgers that have been verified by the entire networkclosed: For most recent ledgers that have been modified and closed and raised by nodes for verificationcurrent: For the version of the ledger that the node is currently running
There is also a deprecated ledger parameter that accepts the above three formats. Do not use this parameter, it may be removed without notification.
If you do not specify a ledger, the current (in progress) ledger will be selected by default. If you provide more than one specified ledger, the deprecated ledger field will be used first, if it still exists, falling back to ledger_hash. The ledger_index field is ignored unless neither of the other two are present.
Note: Do not rely on this default behavior; it changes frequently. Instead, you need to make a version of the ledger on every call.
Currencies
stm |
Issue currency |
|---|---|
| No publisher | Usually distributed through a publisher |
| specified as string | Specify as object |
| Transfer between accounts | Trust relationship transfer |
| Cannot be created, can only be destroyed | Can be freely issued and redeemed |
Maximum value 100000000000(1e11) |
Maximum value 9999999999999999e80 |
| Accurate to the nearest "drop" (0.000001 stm) | 15 decimal digits of precision, minimum non-zero absolute value is 1000000000000000e-96 |
The Stream ledger uses decimal arithmetic with a different precision than typical floating point numbers, so monetary amounts are always presented as strings
Specifying Currency Amounts
STM
STM quantities can be represented as strings. (STM precision is a 64-bit integer, and JSON integers are limited to 32 bits, so integer overflow may occur when using JSON.) STM is formally specified in "drops", and each drop is equivalent to 0.000001 STM. Therefore, in the JSON document,"1000000" represents 1.0stm.
Do not specify STM as an object
Unit tests allow submission of STM values with decimal points - for example, "1.23" means 1.23STM. All other cases should be described with drops, without decimal points: for example, "1230000" means 1.23STM.Non-STM
If you are specifying a non-STM currency (including fiat currencies, precious metals, virtual currencies, or other custom currencies), you must specify it with a currency specification object. Here are the three fields of that JSON object:| field | Type | Description |
|---|---|---|
currency |
String - Currency Code | Arbitrary code for currency to issue. Cannot be STM. |
value |
String | Quoted decimal representation of the amount of currency. This can include scientific notation, such as 1.23e11 meaning 123,000,000,000. Both e and E may be used. |
issuer |
String | Unique account address of the entity issuing the currency. In other words, the person or business where the currency can be redeemed. |
rR5Am25ArfXFmqgNwjZgnfk59EACMhs2hZc, you would specify:
{
"currency": "USD",
"value": "153.75",
"issuer": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV"
}
Unit tests allow submission of non-STM currency amounts as a slash-separated string in the form of "amount/currency/issuer". In all other cases use the JSON object form above.
Specify currency without amount
If you want to specify a non-STM currency without a quantity (especially for the purpose of defining an order order for a currency transaction offer), you need to specify it as above, but ignore thevalue field.
If you want to specify an STM without a quantity (also to define an order), you should make it a JSON object with the unique "currency" field. STM should never include the issuer field.
Finally, if the payment recipient account trusts multiple gateways that issue currencies, you can indicate payment in any combination of issuing currencies that the recipient accepts. To achieve this, specify the recipient account address as the issuer value in the JSON object.Currency Codes
There are two currency codes in the STM ledger:
- Three-character currency codes. Uppercase ISO 4217 currency codes are recommended. Any combination of uppercase and lowercase letters, digits, and these symbols is allowed:
?,!,@,#,$,%,^,&,*,<,>,(,),{,},[,],|. The uppercase currency code STM is reserved for STM and cannot be used for issued currencies. - 160-bit hexadecimal value, according to the STM ledger's internal currency format, such as
0158415500000000C1F76FF6ECB0BAC600000000, which is an uncommon expression.
Specifying Time
streamdThe server and its API represent times as unsigned integers. Measured as the number of seconds since January 1, 2000 (00:00 UTC). This works similarly to Unix epoch, except that the Stream Epoch after the Unix Epoch is 946684800 seconds.
Do not convert Stream Epoch times to UNIX Epoch times in 32-bit variables: this may cause integer overflow.
Possible Server States
Depending on how the streamd server is configured, running time, and other factors, a server may participate in a multinational Stream peer-to-peer network to varying degrees. This is represented as the server_state field in responses to the server_info and server_state commands. This possible response tracks a series of ascending interactions, with each subsequent value replacing the previous one. They are defined as follows (in order of priority from small to large):
Value | Description |
|---|---|
disconnected | The server is not connected to the Stream Ledger peer-to-peer network whatsoever. It may be running in offline mode, or it may not be able to access the network for whatever reason. |
connected | The server believes it is connected to the network. |
syncing | The server is currently behind on ledger versions. (It is normal for a server to spend a few minutes catching up after you start it.) |
tracking | The server is in agreement with the network |
full | The server is fully caught-up with the network and could participate in validation, but is not doing so (possibly because it has not been configured as a validator). |
validating | The server is currently participating in validation of the ledger |
proposing | The server is participating in validation of the ledger and currently proposing its own version |
Note: The distinction between
full,validatingandproposingis based on synchronicity of the remaining global network, and it is normal for servers to fluctuate between these states during general operation.
Modifying the Ledger
- submit command
- submit_multisigned command
API Methods
WebSocket and JSON-RPC API methods are defined based on command names and are divided into public commands and management commands. Public commands are not necessarily available to the general public, but can be used by any client connected to the server. (Think of public commands as the organization members or customers who run the server, while administrative commands are the people responsible for keeping the server running). Public commands include operations such as checking the status of the ledger, finding a path to connect users, and submitting transactions. Administrative commands, on the other hand, are intended only for trusted server operators and contain commands for managing, monitoring, and debugging the server.
Public Commands
account_currencies- Get the list of currencies that the account can send or receiveaccount_channels- Get the list of payment channels whose account is the source of the channelaccount_info- Get basic data about the accountaccount_lines- Get information about account trust relationshipsaccount_objects- Get all ledger objects owned by an accountaccount_offers- Get information about account currency exchange offersaccount_tx- Get information about account transactionsbook_offers- Get information about offers to exchange two currencieschannel_authorize- Sign money claims from payment channelschannel_verify- View the signature of the payment channel statementfee- Get information about transaction costsgateway_balances- Calculate the total amount issued by the accountledger- Get information about the ledger versionledger_closed- Get the latest closed ledger versionledger_current- Get the current working ledger versionledger_data- Get the original content of the ledger versionledger_entry- Get an element from the ledger versionnostream_check- Get recommended changes to an account's DefaultStream and NoStream settingspath_find- Find payment paths between two accounts and receive updatesping- Confirm connection to serverrandom- Generate a random numberstream_path_find- Find a payment path between two accounts, onceserver_info- Retrieve the status of the server in a human-readable formatserver_state- Retrieve the status of the server in a machine-readable formatsign- Password signing transactionsign_for- helps with multi-signaturessubmit- Send transaction to the networksubmit_multisigned- Send a multi-signed transaction to the networksubscribe- listen to updates about a specific subjecttransaction_entry- Retrieve information about a transaction from a specific ledger versiontx- Retrieve information about transactions from all ledgers at handtx_history- Retrieve information about all recent transactionsunsubscribe- Stop listening to updates on a specific topic
owner_info command is deprecated. Use account_objects instead.Administrative Commands
streamd management command is only available when connecting on a host and port identified as admin in the configuration file. (By default, the command line client uses the administrative connection.)
can_delete- allows online deletion of ledgers to a specific ledgerconnect- Force the streamd server to connect to a specific peerconsensus_info- Get information about the consensus statusfeature- Get information about protocol revisionsfetch_info- Get information about server and network synchronizationget_counts- Get statistics about server internal and memory usageledger_accept- Close and advance the ledger in standalone modeledger_cleaner- Configure the ledger clearing service to check for corrupted dataledger_request- Query a peer for a specific ledger versionlog_level- Get or modify log verbositylogrotate- Reopen the log filepeers- Get information about connected peersprint- Get information about internal subsystemsstop- Shut down the streamd servervalidation_create- Generate keys for new streamd validatorsvalidation_seed- Temporarily sets the key used for verificationvalidators- Get information about the current validatorvalidator_list_sites- Get information about sites that publish validator listswallet_propose- Generate keys for new accounts
ledger_header- Use theledgercommand instead.unl_add,unl_delete,unl_list,unl_load,unl_network,unl_reset,unl_score- Use UNL management configuration files instead.wallet_seed- - Usewallet_proposeinstead.
Command-Line Access
streamd application (as a standalone instance) as a JSON-RPC client. In this mode, it has the syntax to trigger most API methods with a single line from the command prompt, as described in each method. However, some methods or options do not have command line syntax. For unsupported syntax, you can use the following methods:
json- Passing JSON via the command line
Note: The command line interface is for administrative purposes only and is not a supported API.
Account Information
The "accounts" in the Stream ledger represent STM holders and transaction senders. Accounts can send and receive STM and issued assets, participate in decentralized exchanges, and change their own settings. Creating an account involves generating a key and then receiving STM from another account. See Accounts for more information.
account_currencies
account_currencies command retrieves a list of currencies that an account can send or receive based on its trustline. (This is not an exhaustive list, but it can be used to populate the user interface.)
Example of request format:
{
"command": "account_currencies",
"account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"strict": true,
"ledger_index": "validated"
}
{
"method": "account_currencies",
"params": [
{
"account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"account_index": 0,
"ledger_index": "validated",
"strict": true
}
]
}
The request contains the following parameters:
Field |
Type | Description |
|---|---|---|
account |
String | A unique identifier for the account, usually the account's address. |
strict |
Boolean | (optional) If true, only the address or public key of the account parameter is accepted. Default is false. |
ledger_hash |
String | (Optional) A 20-byte hex string of the ledger version to use. (See Specifying Ledgers) |
ledger_index |
String or Unsigned Integer | (Optional) The sequence number or shortcut string of the ledger to use automatically selects the ledger. (See Specifying Ledgers) |
account_index.
Response format example:
{
"result": {
"ledger_index": 155786,
"receive_currencies": [
"BTC",
"CNY",
"ETH"
],
"send_currencies": [
"CNY"
],
"validated": true
},
"status": "success",
"type": "response"
}
200 OK
{
"result": {
"ledger_index": 155786,
"receive_currencies": [
"BTC",
"CNY",
"ETH"
],
"send_currencies": [
"CNY"
],
"status": "success",
"validated": true
}
}
Note: The currencies an account can send or receive are defined based on a check of its trust lines. If an account has a trust line for a currency and has enough room to increase the balance, it can receive that currency. If the trustline's balance can be reduced, the account can send the currency. This method does not check whether the trust row is frozen or authorizedPossible errors
- Any common error type.
invalidParams- One or more fields were specified incorrectly, or one or more required fields are missing.actNotFound- The address specified in theaccountrequest field does not correspond to an account in the ledger.lgrNotFound- The ledger specified byledger_hashorledger_indexdoes not exist, or it does exist, but the server does not.
account_info
account_info command will retrieve information about the account, its activity and STM balance. All retrieved information is related to a specific version of the ledger.
Example of account_info request:
{
"id": 2,
"command": "account_info",
"account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"strict": true,
"ledger_index": "current",
"queue": true
}
{
"method": "account_info",
"params": [
{
"account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"strict": true,
"ledger_index": "current",
"queue": true
}
]
}
#Syntax: account_info account [ledger_index|ledger_hash] [strict] rippled account_info vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV trueThe request contains the following parameters:
Field |
Type | Description |
|---|---|---|
account |
String | A unique identifier for the account, usually the account's address. |
strict |
Boolean | (Optional, defaults to False) If set to True, this account field only accepts public keys or Stream ledger addresses. |
ledger_hash |
String | (Optional) A 20-byte hex string of the ledger version to use. (See Specifying Ledgers) |
ledger_index |
String or Unsigned Integer | (Optional) The sequence number or shortcut string of the ledger to use automatically selects the ledger. (See Specifying Ledgers) |
queue |
Boolean | (optional) If true and the FeeEscalation amendment is also enabled, statistics about queued transactions associated with this account will also be returned. Can only be used when querying data for the current open ledger. |
signer_lists |
Boolean | (optional) If true, the MultiSign amendment is enabled and any SignerList objects associated with this account will also be returned. |
ident, ledger.
An example of a successful response:
{
"id": 2,
"result": {
"account_data": {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Balance": "99999986730672448",
"Flags": 0,
"LedgerEntryType": "AccountRoot",
"OwnerCount": 15,
"PreviousTxnID": "17CF128117A275D1E0F0638CE38DADD7DE4F978818F1E950C89CA5C62620E27D",
"PreviousTxnLgrSeq": 155512,
"Sequence": 293,
"index": "C2FA6D77327E553B9D611CA7BE4CC0CB33817EE23919EC09C48D10E4C5653037"
},
"ledger_current_index": 155823,
"validated": false
},
"status": "success",
"type": "response"
}
{
"result": {
"account_data": {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Balance": "99999986730672448",
"Flags": 0,
"LedgerEntryType": "AccountRoot",
"OwnerCount": 15,
"PreviousTxnID": "17CF128117A275D1E0F0638CE38DADD7DE4F978818F1E950C89CA5C62620E27D",
"PreviousTxnLgrSeq": 155512,
"Sequence": 293,
"index": "C2FA6D77327E553B9D611CA7BE4CC0CB33817EE23919EC09C48D10E4C5653037"
},
"ledger_current_index": 155823,
"validated": false
},
"status": "success",
"type": "response"
}
The response follows a standard format, with the result containing the requested account, its data, and the ledger it applies to, as shown below:
Field |
Type | Description |
|---|---|---|
account_data |
Object | The AccountRoot ledger object stores this account information in the ledger. |
signer_lists |
Array | (Omitted unless the request specifies signer_lists and at least one SignerList is associated with the account.) Array of SignerList ledger objects associated with this account for multi-signing. Since an account can only have at most one SignerList, the array must have only one member if it exists. |
ledger_current_index |
Integer | (Omitted if ledger_index is provided) The serial number of the latest ledger used when retrieving this information. This information does not contain any ledger changes more recent than this. |
ledger_index |
Integer | (Omitted if ledger_current_index is provided) The sequence number of the ledger used to retrieve this information. This information does not contain changes to any ledger more recent than this. |
queue_data |
Object | (Omitted unless queue is specified as true and querying the currently open ledger.) Information about queued-transactions. This information describes the status of the local streamd server, which may differ from other servers in the consensus network. Some fields may be ignored because the values are "lazy" calculated by the queuing mechanism. |
validated |
Boolean | True if this data comes from a verified version of the ledger; if omitted or set to false, this data is not final. |
queue_data parameter (if present) contains the following fields:
Field |
Type | Description |
|---|---|---|
txn_count |
Integer | The number of queued transactions for this address. |
auth_change_queued |
Boolean | (can be omitted) Whether transactions in the queue change the way this address authorizes transactions. If true, the address may not proceed with further transaction processing until the transaction has been executed or removed from the queue. |
lowest_sequence |
Integer | (can be omitted) The lowest sequence number in the transaction queue of this address. |
highest_sequence |
Integer | (can be omitted) The highest sequence number in the transaction queue of this address. |
max_spend_drops_total |
String | (can be omitted) If each transaction in the queue consumes as much STM as possible, integer drops of STM can be deducted from the address. |
transactions |
Array | (optional) Information about each queued transaction at this address. |
transactions array (if present) can contain any or all of the following fields:
Field |
Type | Description |
|---|---|---|
auth_change |
Boolean | Whether this transaction changes the way this address authorizes transactions. |
fee |
String | The transaction cost of this transaction, in STM. |
fee_level |
String | The transaction costs of this transaction, relative to the lowest cost for such transactions, are calculated at fee levels. |
max_spend_drops |
String | The maximum amount of STM, in drops, that this transaction can send or destroy. |
seq |
Integer | The sequence number of this transaction. |
- Any common error type.
invalidParams- One or more fields were specified incorrectly, or one or more required fields are missing. For example, a request that specifiesqueueastruebutledger_indexis not specified for the current open ledger.actNotFound- The address specified in theaccountrequest field does not correspond to an account in the ledger.lgrNotFound- A ledger created byledger_hashorledger_indexthat does not exist, or does exist but is not found by the server.
account_lines
account_lines method returns information about the account's trust lines, including balances for all non-STM currencies and assets. All retrieved information is related to a specific version of the ledger.
Example of request format:
{
"id": 1,
"command": "account_lines",
"account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"ledger": "current"
}
{
"method": "account_lines",
"params": [
{
"account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"ledger": "current"
}
]
}
The request accepts the following parameters:
Field |
Type | Description |
|---|---|---|
account |
String | A unique identifier for the account, usually the account's address. |
ledger_hash |
String | (Optional) A 20-byte hex string of the ledger version to use. (See Specifying Ledgers) |
ledger_index |
String or Unsigned Integer | (Optional) The sequence number or shortcut string of the ledger to use automatically selects the ledger. (See Specifying Ledgers) |
peer |
String | (Optional)The address of the second account. If provided, only the trust line connecting the two accounts is displayed. |
limit |
Integer | (Optional, defaults vary) Limit the number of transactions to retrieve. The server does not need to respect this value. Must be in the range of 10 to 400. |
marker |
(Not Specified) | (optional)The value from the previous paginated response. Continue to recover data if this response stops. |
ledger and peer_index.
An example of a successful response:
{
"id": 1,
"result": {
"account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"ledger_current_index": 155833,
"lines": [{
"account": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"balance": "999857.44805",
"currency": "CNY",
"limit": "1000000000000000e-4",
"limit_peer": "0",
"no_vstream": true,
"quality_in": 0,
"quality_out": 0
}, {
"account": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"balance": "0",
"currency": "STM",
"limit": "0",
"limit_peer": "0",
"quality_in": 0,
"quality_out": 0
}, {
"account": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"balance": "0",
"currency": "XCN",
"limit": "0",
"limit_peer": "0",
"quality_in": 0,
"quality_out": 0
}, {
"account": "vp9Ykz8Af9bYV6zpjxRiza2oeim8xmiu7i",
"balance": "0",
"currency": "BTC",
"limit": "1000000000000000e-4",
"limit_peer": "0",
"no_vstream": true,
"no_vstream_peer": true,
"quality_in": 0,
"quality_out": 0
}, {
"account": "vp9Ykz8Af9bYV6zpjxRiza2oeim8xmiu7i",
"balance": "0",
"currency": "ETH",
"limit": "1000000000000000e-4",
"limit_peer": "0",
"no_vstream": true,
"quality_in": 0,
"quality_out": 0
}, {
"account": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"balance": "0",
"currency": "BTC",
"limit": "1000000000000000e-4",
"limit_peer": "0",
"no_vstream": true,
"quality_in": 0,
"quality_out": 0
}],
"validated": false
},
"status": "success",
"type": "response"
}
200 OK
{
"result": {
"account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"ledger_current_index": 155833,
"lines": [{
"account": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"balance": "999857.44805",
"currency": "CNY",
"limit": "1000000000000000e-4",
"limit_peer": "0",
"no_vstream": true,
"quality_in": 0,
"quality_out": 0
}, {
"account": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"balance": "0",
"currency": "XRP",
"limit": "0",
"limit_peer": "0",
"quality_in": 0,
"quality_out": 0
}, {
"account": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"balance": "0",
"currency": "XCN",
"limit": "0",
"limit_peer": "0",
"quality_in": 0,
"quality_out": 0
}, {
"account": "vp9Ykz8Af9bYV6zpjxRiza2oeim8xmiu7i",
"balance": "0",
"currency": "BTC",
"limit": "1000000000000000e-4",
"limit_peer": "0",
"no_vstream": true,
"no_vstream_peer": true,
"quality_in": 0,
"quality_out": 0
}, {
"account": "vp9Ykz8Af9bYV6zpjxRiza2oeim8xmiu7i",
"balance": "0",
"currency": "ETH",
"limit": "1000000000000000e-4",
"limit_peer": "0",
"no_vstream": true,
"quality_in": 0,
"quality_out": 0
}, {
"account": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"balance": "0",
"currency": "BTC",
"limit": "1000000000000000e-4",
"limit_peer": "0",
"no_vstream": true,
"quality_in": 0,
"quality_out": 0
}],
"validated": false
},
"status": "success",
"type": "response"
}
The response follows a standard format and contains the account address and a successful result in an array of trustline objects. Specifically, the result object contains the following fields:
Field |
Type | Description |
|---|---|---|
account |
String | The unique address of the account in this request. Trust-line balances are reported from this account's perspective. |
lines |
Array | An array of trustline objects, described below. If the number of trust lines is large, only this limit number of times is returned at a time. |
ledger_current_index |
Integer | (Omitted if ledger_hash or ledger_index is provided) The ordinal number of the ledger version to use when retrieving this data. |
ledger_index |
Integer | (Omitted if ledger_current_index is provided instead) The sequence number provided in the request, which version of the ledger to use when retrieving this data. |
ledger_hash |
String | (can be omitted) The version of the ledger used when retrieving this data from the Hex hash provided in the request. |
marker |
Not Specified | A server-defined value indicating that the response is paginated. Pass this to the next call to resume where this call left off. Omitted if there are no additional pages after this. |
Field |
Type | Description |
|---|---|---|
account |
String | The unique address of this trustline counterparty. |
balance |
String | The current balance on this trust line, expressed as a number. A positive balance means the perspective account holds value; a negative balance means it owes value. |
currency |
String | A currency code identifying what currencies this trust line can accommodate. |
limit |
String | The maximum amount that this account is willing to owe the counterparty. |
limit_peer |
String | The maximum amount that the counterparty is willing to owe the perspective account. |
quality_in |
Unsigned integer | The rate at which this account is evaluated for its income balance on this trust limit, i.e. the rate per billion units of this value. (For example, a value of 500 million represents a 0.5:1 ratio.) As a special case, 0 is treated as a 1:1 ratio. |
quality_out |
Unsigned integer | The ratio of the account value to the outgoing balance on this trust limit, as a ratio of this value per 1 billion units. (For example, a value of 500 million represents a 0.5:1 ratio.) As a special case, 0 is treated as a 1:1 ratio. |
no_stream |
Boolean | (can be omitted) true if this account has the NoStream flag enabled for this line. If omitted, the same as false. |
no_stream_peer |
Boolean | (can be omitted) true if the peer account has the NoStream flag enabled. If omitted, the same as false. |
authorized |
Boolean | (can be omitted) true if this account has authorized this trustline. If omitted, the same as false. |
peer_authorized |
Boolean | (can be omitted) true if the peer account authorizes this trustline. If omitted, the same as false. |
freeze |
Boolean | (can be omitted) true if this account has frozen this trust line. If omitted, the same as false. |
freeze_peer |
Boolean | (can be omitted) trueIf the peer account freezes this trust line. If omitted, the same as false. |
- Any common error type.
invalidParams- One or more fields were specified incorrectly, or one or more required fields are missing.actNotFound- The addressaccountspecified in the request field does not correspond to an account in the ledger.lgrNotFound- A ledger created byledger_hashorledger_indexthat does not exist, or does exist but is not found by the server.actMalformed- If the field provided bymarkeris not acceptable.
account_offers
account_offers method retrieves a list of offers by a specific account as a specific ledger version.
Example of request format:
{
"id": 2,
"command": "account_offers",
"account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"ledger": "current"
}
{
"method": "account_offers",
"params": [
{
"account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"ledger_index": "current"
}
]
}
#Syntax: account_offers account [ledger_index] rippled account_offers vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV currentThe request can contain the following parameters:
Field |
Type | Description |
|---|---|---|
account |
String | A unique identifier for the account, usually the account's address. |
ledger |
Unsigned integer, or String | (Deprecated, Optional) A unique identifier for the ledger version to use, such as a ledger serial number, hash, or a shortcut such as "verified". |
ledger_hash |
String | (Optional) A 20-byte hexadecimal string identifying the ledger version to use. |
ledger_index |
(optional) Ledger Index | (Optional, defaults to current) The serial number of the ledger to use, or "current", "closed" or "validated" to dynamically select a ledger. (See Specifying Ledgers) |
limit |
Integer | (Optional, defaults vary) Limit the number of transactions to retrieve. The server does not need to respect this value. Must be in the range of 10 to 400. |
marker |
Not Specified | (Optional)The value from the previous paginated response. Continue retrieving data while this response is stalled. |
ledger.
An example of a successful response:
{
"id": 2,
"result": {
"account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"ledger_current_index": 155935,
"offers": [{
"flags": 0,
"seq": 234,
"taker_gets": {
"currency": "CNY",
"issuer": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"value": "1"
},
"taker_pays": "1000000"
}, {
"flags": 0,
"seq": 239,
"taker_gets": {
"currency": "CNY",
"issuer": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"value": "0.00195"
},
"taker_pays": "1950000"
}, {
"flags": 0,
"seq": 275,
"taker_gets": {
"currency": "CNY",
"issuer": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"value": "1.85"
},
"taker_pays": "1000000"
}],
"validated": false
},
"status": "success",
"type": "response"
}
200 OK
{
"result": {
"account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"ledger_current_index": 155935,
"offers": [{
"flags": 0,
"seq": 234,
"taker_gets": {
"currency": "CNY",
"issuer": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"value": "1"
},
"taker_pays": "1000000"
}, {
"flags": 0,
"seq": 239,
"taker_gets": {
"currency": "CNY",
"issuer": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"value": "0.00195"
},
"taker_pays": "1950000"
}, {
"flags": 0,
"seq": 275,
"taker_gets": {
"currency": "CNY",
"issuer": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"value": "1.85"
},
"taker_pays": "1000000"
}],
"validated": false
},
"status": "success",
"type": "response"
}
Responses follow the standard format, with successful results containing the following fields:
Field |
Type | Description |
|---|---|---|
account |
String | Unique address identifies the account offering the product |
offers |
Array | Array of objects, each of which represents an offer offered by this account, that is the same as the requested version of the ledger. If the number of quotes is large, only limit can be returned at one time. |
ledger_current_index |
Integer | (Omitted if ledger_hash or ledger_index is provided) The ordinal number of the ledger version to use when retrieving this data. |
ledger_index |
Integer | (Omitted if ledger_current_index is provided instead) The sequence number provided in the request, which version of the ledger to use when retrieving this data. |
ledger_hash |
String | (can be omitted) The Hex hash provided in the request The ledger version to use when retrieving this data. |
marker |
(Not Specified) | (can be omitted) Server-defined value indicating that the response is paginated. Pass this to the next call to resume where this call left off. Omit if there is no information page after this. |
Field |
Type | Description |
|---|---|---|
flags |
Unsigned integer | The options for this offer entry are set to bit flags. |
seq |
Unsigned integer | The sequence number of the transaction that created this entry. (The transaction sequence number is related to the account.) |
taker_gets |
String or Object | The amount received by the account accepting the quote, as a string or currency specification object representing the amount in STM. (See Specifying Currency Amounts) |
taker_pays |
String or Object | The amount offered by the account accepting the quote, as a string or currency specification object representing the amount in STM. (See Specifying Currency Amounts) |
quality |
String | The quoted exchange rate is calculated by dividing the original ratio taker_pays by the original quotation taker_gets. When an offer is executed, the offer with the best (lowest) quality is consumed first; offers with the same quality will be executed from oldest to latest. |
expiration |
Unsigned integer | (May be omitted) The time, in seconds since the Stream Epoch, after which this offer is considered expired. See also: Offer Expiration. |
- Any common error type.
invalidParams- One or more fields were specified incorrectly, or one or more required fields are missing.actNotFound- The addressaccountspecified in the request field does not correspond to an account in the ledger.lgrNotFound- A ledger created byledger_hashorledger_indexthat does not exist, or does exist but is not found by the server.actMalformed- If the field provided bymarkeris not acceptable.
account_tx
account_tx method retrieves a list of transactions involving the specified account.
Example of request format:
{
"id": 2,
"command": "account_tx",
"account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"ledger_index_min": -1,
"ledger_index_max": -1,
"binary": false,
"limit": 2,
"forward": false
}
{
"method": "account_tx",
"params": [
{
"account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"binary": false,
"forward": false,
"ledger_index_max": -1,
"ledger_index_min": -1,
"limit": 2
}
]
}
#Syntax account_tx account ledger_index_min ledger_index_max [offset] [limit] [binary] [count] [forward] rippled -- account_tx vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV -1 -1 2 5 1 0 1The request contains the following parameters:
Field |
Type | Description |
|---|---|---|
account |
String | The account's unique identifier, usually the account's address. |
ledger_index_min |
Integer | (optional) is used to specify the oldest ledger to contain transactions. A value of -1 instructs the server to use the earliest validating ledger version available. |
ledger_index_max |
Integer | (optional) is used to specify the most recent ledger to include transactions from. A value of -1 indicates that the server uses the latest authentication ledger version available. |
ledger_hash |
String | (Optional) Only used to find transactions in a single ledger. (See Specifying Ledgers.) |
ledger_index |
String or Unsigned Integer | (Optional) Only used to find transactions in a single ledger. (See Specifying Ledgers.) |
binary |
Boolean | (optional) Defaults to false. If set to true, transactions are returned as hex strings instead of JSON. |
forward |
Boolean | (optional) Defaults to false. If set to true, values using the oldest ledger index are returned first. Otherwise, results will be indexed with the latest ledger first. (Each page of results may not be sorted internally, but the page is sorted overall.) |
limit |
Integer | (Optional)The default value varies. Limit the number of transactions to retrieve. The server does not need to respect this value. |
marker |
(Not Specified) | The value from the previously paginated response. Continue retrieving data while this response is stalled. This value is stable even if the server's available ledger range changes. |
ledger_index, ledger_hash, ledger_index_min, or ledger_index_max.
Note: For WebSocket and JSON-RPC, there is an older, deprecated version of theaccount_txmethod. For this reason, Stream recommends not using any of the following fields:offset,count,descending,ledger_max, andledger_min. If you use any of these deprecated fields, this method does not support pagination.
Repeat query data
As with other paging methods, you can use thismarker field to return multiple pages of data.
In the time between requests, "ledger_index_min": -1 and "ledger_index_max": -1 may change to refer to a different version of the ledger than what they previously did. markerAs long as the marker does not indicate a point outside the ledger range specified in the request, this field can be paged safely even if the ledger range changes in the request.
An example of a successful response:
{
"id": 2,
"result": {
"account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"ledger_index_max": 155983,
"ledger_index_min": 2,
"limit": 2,
"marker": {
"ledger": 153500,
"seq": 0
},
"transactions": [{
"meta": {
"AffectedNodes": [{
"ModifiedNode": {
"FinalFields": {
"Account": "vfq4sckDNcNcyfrDQed6FBqqDfEgTgsjtJ",
"Balance": "21492361",
"Flags": 8388608,
"OwnerCount": 14,
"Sequence": 78
},
"LedgerEntryType": "AccountRoot",
"LedgerIndex": "ADEFE0B5A676E5431444ADA797634C65B963A00B9B79DBFA4821DA786DD6C8B4",
"PreviousFields": {
"Balance": "22492373",
"Sequence": 77
},
"PreviousTxnID": "BEE1FD0E440416A4CFD29663ADB2BAB5356CBE3FE2AF7659C69B4153612BBD52",
"PreviousTxnLgrSeq": 153524
}
}, {
"ModifiedNode": {
"FinalFields": {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Balance": "99999986730672448",
"Flags": 0,
"OwnerCount": 15,
"Sequence": 293
},
"LedgerEntryType": "AccountRoot",
"LedgerIndex": "C2FA6D77327E553B9D611CA7BE4CC0CB33817EE23919EC09C48D10E4C5653037",
"PreviousFields": {
"Balance": "99999986729672448"
},
"PreviousTxnID": "BEE1FD0E440416A4CFD29663ADB2BAB5356CBE3FE2AF7659C69B4153612BBD52",
"PreviousTxnLgrSeq": 153524
}
}],
"TransactionIndex": 0,
"TransactionResult": "tesSUCCESS",
"delivered_amount": "1000000"
},
"tx": {
"Account": "vfq4sckDNcNcyfrDQed6FBqqDfEgTgsjtJ",
"Amount": "1000000",
"Destination": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Fee": "12",
"Flags": 2147483648,
"LastLedgerSequence": 155520,
"Memos": [{
"Memo": {
"MemoData": "68616861",
"MemoType": "6D656D6F"
}
}],
"Sequence": 77,
"SigningPubKey": "021ADD58CB32BFD8F3F24A027081CE3928CEE072E85692123DE4DF92EFCF2CE2BC",
"TransactionType": "Payment",
"TxnSignature": "304402200C8B73E45DD5C43D6C10ECF26BE1D0212BA121BC0EB090441B09AE21FAD2F17C02206143819F8B15F4C8C83A4735E56E971E7465A76C2116443092E8E7179B4A7AFD",
"date": 575694990,
"hash": "17CF128117A275D1E0F0638CE38DADD7DE4F978818F1E950C89CA5C62620E27D",
"inLedger": 155512,
"ledger_index": 155512
},
"validated": true
}]
},
"status": "success",
"type": "response"
}
200 OK
{
"result": {
"account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"ledger_index_max": 155983,
"ledger_index_min": 2,
"limit": 2,
"marker": {
"ledger": 153500,
"seq": 0
},
"transactions": [{
"meta": {
"AffectedNodes": [{
"ModifiedNode": {
"FinalFields": {
"Account": "vfq4sckDNcNcyfrDQed6FBqqDfEgTgsjtJ",
"Balance": "21492361",
"Flags": 8388608,
"OwnerCount": 14,
"Sequence": 78
},
"LedgerEntryType": "AccountRoot",
"LedgerIndex": "ADEFE0B5A676E5431444ADA797634C65B963A00B9B79DBFA4821DA786DD6C8B4",
"PreviousFields": {
"Balance": "22492373",
"Sequence": 77
},
"PreviousTxnID": "BEE1FD0E440416A4CFD29663ADB2BAB5356CBE3FE2AF7659C69B4153612BBD52",
"PreviousTxnLgrSeq": 153524
}
}, {
"ModifiedNode": {
"FinalFields": {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Balance": "99999986730672448",
"Flags": 0,
"OwnerCount": 15,
"Sequence": 293
},
"LedgerEntryType": "AccountRoot",
"LedgerIndex": "C2FA6D77327E553B9D611CA7BE4CC0CB33817EE23919EC09C48D10E4C5653037",
"PreviousFields": {
"Balance": "99999986729672448"
},
"PreviousTxnID": "BEE1FD0E440416A4CFD29663ADB2BAB5356CBE3FE2AF7659C69B4153612BBD52",
"PreviousTxnLgrSeq": 153524
}
}],
"TransactionIndex": 0,
"TransactionResult": "tesSUCCESS",
"delivered_amount": "1000000"
},
"tx": {
"Account": "vfq4sckDNcNcyfrDQed6FBqqDfEgTgsjtJ",
"Amount": "1000000",
"Destination": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Fee": "12",
"Flags": 2147483648,
"LastLedgerSequence": 155520,
"Memos": [{
"Memo": {
"MemoData": "68616861",
"MemoType": "6D656D6F"
}
}],
"Sequence": 77,
"SigningPubKey": "021ADD58CB32BFD8F3F24A027081CE3928CEE072E85692123DE4DF92EFCF2CE2BC",
"TransactionType": "Payment",
"TxnSignature": "304402200C8B73E45DD5C43D6C10ECF26BE1D0212BA121BC0EB090441B09AE21FAD2F17C02206143819F8B15F4C8C83A4735E56E971E7465A76C2116443092E8E7179B4A7AFD",
"date": 575694990,
"hash": "17CF128117A275D1E0F0638CE38DADD7DE4F978818F1E950C89CA5C62620E27D",
"inLedger": 155512,
"ledger_index": 155512
},
"validated": true
}]
},
"status": "success",
"type": "response"
}
Responses follow a standard format, with successful results containing the following fields:
Field |
Type | Description |
|---|---|---|
account |
String | Identifies the unique address of the associated account |
ledger_index_min |
Integer | The earliest ledger sequence number transaction actually searched. |
ledger_index_max |
Integer | The most recent ledger sequence number transaction actually searched. |
limit |
Integer | limitThe value used in the request. (This may differ from the actual limit value implemented by the server.) |
marker |
(Not Specified) | Server-defined value indicating that the response is paginated. Pass this to the next call to resume where this call left off. |
transactions |
Array | An array of transactions matching the request criteria, as described below. |
validated |
Boolean | If included and set to true, the information in this reply is from a verified version of the ledger. Otherwise, the information may change. |
Note: The server may respond with different values than provided forEach transaction object contains the following fields, depending on whether it is requested in JSON or hexadecimal string (ledger_index_minandledger_index_max, for example, if it does not have the version you specified on hand.
"binary":true) format.
Field |
Type | Description |
|---|---|---|
ledger_index |
Integer | Contains the sequence number of the ledger version of this transaction. |
meta |
Object(JSON)or String(Binary) | If binary is True, then this is a hexadecimal string of transaction metadata. Otherwise, transaction metadata will be included in JSON format. |
tx |
Object | (JSON mode only) JSON object that defines the transaction |
tx_blob |
String | (Binary mode only) Unique hash of the string representing the transaction. |
validated |
Boolean | Whether the transaction is included in the verified ledger. Any transactions that are not already in the verification ledger may be subject to change. |
- Any common error type.
invalidParams- One or more fields were specified incorrectly, or one or more required fields are missing.actMalformed- The addressaccountspecified in the request field is not in the correct format.actBitcoin- The addressaccountspecified in this field is formatted as a Bitcoin address, not an STM ledger address.lgrIdxsInvalid- A ledger specified byledger_index_minorledger_index_maxthat does not exist, or exists but does not exist on the server.
novstream_check
novstream_check command provides a quick way to check the status of an account's DefaultStream field and its trustline's Novstream flag, and compare it to the recommended settings.
Example of request format:
{
"id": 0,
"command": "novstream_check",
"account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"role": "gateway",
"ledger_index": "current",
"limit": 2,
"transactions": true
}
{
"method": "novstream_check",
"params": [
{
"account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"ledger_index": "current",
"limit": 2,
"role": "gateway",
"transactions": true
}
]
}
Note: There is no command line syntax for this method. Use the json command to access this command from the command line.
The request contains the following parameters:
Field |
Type | Description |
|---|---|---|
account |
String | The account's unique identifier, usually the account's address. |
role |
String | The address refers to a gateway or user. Recommendations depend on the account's role. Issuers must enable DefaultStream and NoStream must be disabled on all trust lines. Users should disable DefaultStream and Novstream should be enabled on all trust lines. |
transactions |
Boolean | (Optional) If true contains a set of suggested transactions as a JSON object, you can sign and submit to resolve the issue. Default is false. |
limit |
Unsigned Integer | (Optional)The maximum number of trustline questions to include in the results. Default is 300. |
ledger_hash |
String | (Optional) A 20-byte hex string of the ledger version to use. (See Specifying Ledgers) |
ledger_index |
String or Unsigned Integer | (Optional) The sequence number or shortcut string of the ledger to use automatically selects the ledger. (See Specifying Ledgers) |
{
"id": 0,
"result": {
"ledger_current_index": 169518,
"problems": ["You should immediately set your default vstream flag", "You should clear the no vstream flag on your CNY line to vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz", "You should clear the no vstream flag on your BTC line to vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz", "You should clear the no vstream flag on your BTC line to vp9Ykz8Af9bYV6zpjxRiza2oeim8xmiu7i"],
"transactions": [{
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Fee": 10,
"Sequence": 335,
"SetFlag": 8,
"TransactionType": "AccountSet"
}, {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Fee": 10,
"Flags": 262144,
"LimitAmount": {
"currency": "BTC",
"issuer": "vp9Ykz8Af9bYV6zpjxRiza2oeim8xmiu7i",
"value": "1000000000000000e-4"
},
"Sequence": 338,
"TransactionType": "TrustSet"
}],
"validated": false
},
"status": "success",
"type": "response"
}
{
"id": 0,
"result": {
"ledger_current_index": 169518,
"problems": ["You should immediately set your default vstream flag", "You should clear the no vstream flag on your CNY line to vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz", "You should clear the no vstream flag on your BTC line to vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz", "You should clear the no vstream flag on your BTC line to vp9Ykz8Af9bYV6zpjxRiza2oeim8xmiu7i"],
"transactions": [{
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Fee": 10,
"Sequence": 335,
"SetFlag": 8,
"TransactionType": "AccountSet"
}, {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Fee": 10,
"Flags": 262144,
"LimitAmount": {
"currency": "BTC",
"issuer": "vp9Ykz8Af9bYV6zpjxRiza2oeim8xmiu7i",
"value": "1000000000000000e-4"
},
"Sequence": 338,
"TransactionType": "TrustSet"
}],
"validated": false
},
"status": "success",
"type": "response"
}
Responses follow a standard format, with successful results containing the following fields:
Field |
Type | Description |
|---|---|---|
ledger_current_index |
Number | The sequence number of the ledger used to calculate these results. |
problems |
Array | Array of strings with a human-readable problem description. If an account's DefaultStream setting does not meet the recommendations, then at most one entry is included, and at most one entry is limit whose message line's NoStream setting does not meet the recommendations. |
transactions |
Array | (can be omitted) If the request specifies transactions as true, then this is an array of JSON objects, each of which is a transaction in JSON form, which should fix one of the problems described. This array is the same length as the array problems, and each entry is intended to solve the problem described at the same index in the array. |
- Any common error type.
invalidParams- One or more fields were specified incorrectly, or one or more required fields are missing.actNotFound- The addressaccountspecified in the request field does not correspond to an account in the ledger.lgrNotFound- A ledger created byledger_hashorledger_indexthat does not exist, or does exist but is not found by the server.
wallet_propose
wallet_propose request is a management command and cannot be run by users without permission! (Administrative commands cannot be passed outside the network, thus protecting them from those who would steal account secrets.)
Sample request format:
{
"command": "wallet_propose",
"passphrase": "test"
}
{
"method": "wallet_propose",
"params": [
{
"passphrase": "test"
}
]
}
#Syntax: wallet_propose [passphrase] streamd -- wallet_propose testThe request contains the following parameters:
Field |
Type | Description |
|---|---|---|
passphrase |
String | (Optional) Specifies a passphrase for testing purposes. If not specified, the server will use a randomly generated key. Except for testing purposes, keys should be randomly generated. Some Stream-like addresses and values in other formats are prohibited. |
{
"result" : {
"account_id" : "vp2YHP5k3bSd6LRFT4phDjVMLXQjH4hiaG",
"master_key" : "AHOY CLAD JUDD NOON MINI CHAD CUBA JAN KANT AMID DEL LETS",
"master_seed" : "ssyXjRurNo75TjXjubby65cD96ak8",
"master_seed_hex" : "5BDD10A694F2E36CCAC0CBE28CE2AC49",
"public_key" : "aBPXjfsA7fY2LLPxRuZ7Sj2ADzoSEGDW4Atd5MgxdHz5FQvGPbqU",
"public_key_hex" : "02CF23BCB1252D153713954AF374F44F82C255170ECAEDB059783128F53288F34F",
"status" : "success"
}
}
Responses follow a standard format, with successful results containing various important information about the new (potential) account, including the following fields:
| Field | Type | Description |
|---|---|---|
| master_seed | String | This is the private key of the key pair. The master seed from which all other information about this account is obtained, in Stream's base58-encoded string format. Typically, you use keys in this format to sign transactions. |
| master_seed_hex | String | Master seed, hexadecimal format. A simple, widely supported way to represent private keys. Can be used to sign transactions. |
| master_key | String | Master seed, in RFC 1751 format. A version of the private key that is easier to remember and easier to record. Can be used to sign transactions. |
| account_id | String | The address of this account is in base58 format. This is not the public key, but its hash. It also has a checksum, so a typo will almost certainly result in an invalid address, rather than a valid, but different address. This is the primary identifier of the account in the STM ledger. You tell people this to get paid and use it in transactions to show who you are, what you pay for, trust, etc. Multi-signature lists also use these to identify other signers |
| public_key | String | The public key of the key pair, using Stream's base58 encoded string format. Derived from master_seed. |
| public_key_hex | String | This is the public key of the key pair, expressed in hexadecimal. Derived from master_seed. To verify signatures in transactions, streamd requires this public key. This is why the format of the signed transaction contains the public key in the SigningPubKey field. |
- Any common error type.
invalidParams- One or more fields were specified incorrectly.badSeed- A forbidden seed value specified by this request (in thepassphrase,seedorseed_hexfield), such as an empty string, or a string similar to an STM ledger address.
Ledger Information
Each streamd server maintains a complete copy of the current state of the STM ledger, containing all accounts, transactions, offers and other data in the network in an optimized tree format. As transactions and offers are proposed, each server integrates them into its current copy of the ledger, periodically closes it, and (if configured) participates in advancing the globally validated version. After the network reaches consensus, this version of the ledger is verified and made permanent. Any transactions not included in one version of the ledger will become candidates for inclusion in the next validated version.
ledger
{
"id": 14,
"command": "ledger",
"ledger_index": "validated",
"full": false,
"accounts": false,
"transactions": false,
"expand": false,
"owner_funds": false
}
{
"method": "ledger",
"params": [
{
"ledger_index": "validated",
"accounts": false,
"full": false,
"transactions": false,
"expand": false,
"owner_funds": false
}
]
}
#Syntax: ledger ledger_index|ledger_hash [full|tx] # "full" is equivalent to "full": true # "tx" is equivalent to "transactions": true streamd ledger currentThe request can contain the following parameters:
Field |
Type | Description |
|---|---|---|
ledger_hash |
String | (Optional) A 20-byte hex string of the ledger version to use. (See Specifying Ledgers) |
ledger_index |
String or Unsigned Integer | (Optional) The sequence number or shortcut string of the ledger to use automatically selects the ledger. (See Specifying Ledgers) |
full |
Boolean | (optional) Requires administrator. If true returns complete information for the entire ledger. If you do not specify a ledger version, it is ignored. Default is false. (Equivalent to enabling transactions, accounts and expand) Note: This is a very large amount of data - hundreds of megabytes! |
accounts |
Boolean | (optional) Requires administrator. If true, return the account information in the account book. If you do not specify a ledger version, it is ignored. Default is false. Warning: This returns a lot of data! |
transactions |
Boolean | (optional) If true returns transaction information in the specified ledger version. Default is false. If you do not specify a ledger version, it is ignored. |
expand |
Boolean | (Optional) Provide complete JSON formatted information for transaction/account information, not just a hash. Default is false. Unless you request a transaction or account, it will be ignored. |
owner_funds |
Boolean | (Optional) If the metadata of the OfferCreate transaction in the response true contains the owner_funds field. Default is false. Ignored unless a transaction is included and expand is true. |
binary |
Boolean | (Optional) If both true and transactions and expand are both true return transaction information in binary format (hex string) instead of JSON format. |
queue |
Boolean | (optional) If true and the command is requesting the current ledger, an array of queued transactions will be included in the result. |
ledger field is deprecated and may be removed without notice.
An example of a successful response:
{
"id": 14,
"result": {
"ledger": {
"accepted": true,
"account_hash": "C3FED0CFCF26EF342D1213435258C9EB3098620FC2096DFFA1244B333386E64E",
"close_time": 575706870,
"close_time_human": "2018-Mar-30 06:34:30",
"close_time_resolution": 10,
"closed": true,
"hash": "03B5A2196152202BFD2F78CEE331ED05AF33D0C381BFD9F168A25C14FCF60870",
"ledger_hash": "03B5A2196152202BFD2F78CEE331ED05AF33D0C381BFD9F168A25C14FCF60870",
"ledger_index": "156118",
"parent_hash": "DEEC565070B7689FC64F6B64DEAD224DCFF037E8A85D8C237627C6460B3EB95B",
"seqNum": "156118",
"totalCoins": "99999999999992838",
"total_coins": "99999999999992838",
"transaction_hash": "0000000000000000000000000000000000000000000000000000000000000000"
},
"ledger_index": 156118,
"validated": true
},
"status": "success",
"type": "response"
}
200 OK
{
"result": {
"ledger": {
"accepted": true,
"account_hash": "C3FED0CFCF26EF342D1213435258C9EB3098620FC2096DFFA1244B333386E64E",
"close_time": 575706870,
"close_time_human": "2018-Mar-30 06:34:30",
"close_time_resolution": 10,
"closed": true,
"hash": "03B5A2196152202BFD2F78CEE331ED05AF33D0C381BFD9F168A25C14FCF60870",
"ledger_hash": "03B5A2196152202BFD2F78CEE331ED05AF33D0C381BFD9F168A25C14FCF60870",
"ledger_index": "156118",
"parent_hash": "DEEC565070B7689FC64F6B64DEAD224DCFF037E8A85D8C237627C6460B3EB95B",
"seqNum": "156118",
"totalCoins": "99999999999992838",
"total_coins": "99999999999992838",
"transaction_hash": "0000000000000000000000000000000000000000000000000000000000000000"
},
"ledger_index": 156118,
"validated": true
},
"status": "success",
"type": "response"
}
Responses follow the standard format, with successful results containing information about the ledger, including the following fields:
Field |
Type | Description |
|---|---|---|
ledger |
Object | Full header data for this ledger. |
ledger.account_hash |
String | Displays a hash of all account status information in this ledger in hexadecimal format |
ledger.accountState |
Array | (Omitted unless requested) All account status information in this ledger. |
ledger.close_time |
Integer | The time of this ledger is closed within seconds after the Stream Epoch |
ledger.close_time_human |
String | The time of this ledger is closed in a human-readable format |
ledger.close_time_resolution |
Integer | The ledger closing time is rounded up within these seconds. |
ledger.closed |
Boolean | Whether this ledger has been closed |
ledger.ledger_hash |
String | A hash that uniquely identifies the entire ledger. |
ledger.ledger_index |
String | The ledger index of this ledger, as a referenced integer |
ledger.parent_hash |
String | A hash that uniquely identifies the ledger that preceded it. |
ledger.total_coins |
String | As a quoted integer, the total number of STM drops in the network. (This will decrease as transaction costs burn STM.) |
ledger.transaction_hash |
String | The hash of the transaction information contained in this ledger, as hex |
ledger.transactions |
Array | (Omitted when not requested) Transactions applied in this ledger version. By default, the member is the transaction's identifyinghash string. If the request specifies expand as true, the member is entirely a representation of the transaction, rather than JSON or binary, depending on whether the request specifies binary as true. |
ledger_hash |
String | A hash that uniquely identifies the entire ledger. |
ledger_index |
Number | The ledger index for this ledger. |
queue_data |
Array | (Ignored unless requested with the queue parameter) An array of objects describing queued transactions in the same order as the queue. If the request specifies expand as true, the member contains the complete representation of the transaction, which can be in JSON or binary form, depending on whether the request specifies binary as true. Fee correction required. |
accepted, hash, seqNum, totalCoins.
Each member of the queue_data array represents a transaction in the queue. Some fields of this object may be ignored because they have not been calculated yet. The fields of this object are as follows:
| Field | Value | Description |
|---|---|---|
account |
String | This address sends this queued transaction. |
tx |
String or Object | By default, this is a string containing the hash of the transaction ID. If the transaction extends in binary format, then this is an object whose only field is tx_blob, containing the binary form of the transaction as a decimal string. If the transaction is extended in JSON format, this is an object containing the transaction object, including the hash of the transaction's identity in this hash field. |
retries_remaining |
Number | How many times this transaction can be retried before being delivered. |
preflight_result |
String | Preliminary results of preliminary transaction check. This is always tesSUCCESS. |
last_result |
String | (can be omitted) If this transaction remains in the queue after getting a retriable (ter) result, this is the exact result code that ter it gets. |
auth_change |
Boolean | (can be omitted) Whether this transaction changes the way transactions are authorized for this address. |
fee |
String | (May be omitted) The transaction cost of this transaction, in STM. |
fee_level |
String | (can be omitted) The transaction cost for this transaction, relative to the lowest cost for such a transaction, expressed in fee levels. |
max_spend_drops |
String | (can also be omitted) The maximum amount of STM, in drops, that this transaction may send or destroy. |
"owner_funds": true and extends the transaction, the response owner_funds has a field in the metaData object for each OfferCreate-type transaction. The purpose of this field is to make it easier to track the supply funding status of each new verified ledger. The definition of this field is slightly different from the version of this field in the Order Book ordering flow:
Field |
value | Description |
|---|---|---|
owner_funds |
String | The amount of the TakerGets currency held by the Account that submitted this OfferCreate transaction, after all transactions in this ledger have been executed. This does not check whether the currency is frozen. |
- Any common error type.
invalidParams- One or more fields were specified incorrectly, or one or more required fields are missing.lgrNotFound- A ledger created byledger_hashorledger_indexthat does not exist, or does exist but is not found by the server.noPermission- If you specifyfulloraccountsas true, but are not connected to the server as an administrator (usually, admin needs to connect to the local port).
ledger_closed
ledger_closed method returns the unique identifier of the most recently closed ledger. (This ledger is not necessarily valid and immutable.)
Example of request format:
{
"id": 2,
"command": "ledger_closed"
}
{
"method": "ledger_closed",
"params": [
{}
]
}
#Syntax: ledger_closed streamd ledger_closedThis method does not accept any parameters. An example of a successful response:
{
"id": 2,
"result": {
"ledger_hash": "D771E2D1A624BBD3FA26827C48F3B6BD5B33E1C642E0982B239D4928E967E25A",
"ledger_index": 156173
},
"status": "success",
"type": "response"
}
200 OK
{
"result": {
"ledger_hash": "D771E2D1A624BBD3FA26827C48F3B6BD5B33E1C642E0982B239D4928E967E25A",
"ledger_index": 156173
},
"status": "success",
"type": "response"
}
Responses follow a standard format, with successful results containing the following fields:
Field |
Type | Description |
|---|---|---|
ledger_hash |
String | 20-byte hex string with unique hash of the ledger |
ledger_index |
Unsigned Integer | The serial number of this ledger |
- Any common error type.
ledger_current
The ledger_current method returns the unique identifier of the currently ongoing ledger. This command is useful for testing because the returned ledger is still changing.
Example of request format:
{
"id": 2,
"command": "ledger_current"
}{
"method": "ledger_current",
"params": [
{}
]
}#Syntax: ledger_current streamd ledger_current
The request does not contain parameters.
An example of a successful response:
{
"id": 2,
"result": {
"ledger_current_index": 156196
},
"status": "success",
"type": "response"
}200 OK
{
"result": {
"ledger_current_index": 156196
"status": "success",
}
}Responses follow the standard format, with successful results containing the following fields:
Field | Type | Description |
|---|---|---|
ledger_current_index | Unsigned Integer | The serial number of this ledger |
Possible errors:
- Any common error type.
ledger_data
ledger_data method retrieves the contents of the specified ledger. You can loop through multiple calls to retrieve the entire contents of a single ledger version.
Example of request format:
{
"id": 2,
"ledger_hash": "D771E2D1A624BBD3FA26827C48F3B6BD5B33E1C642E0982B239D4928E967E25A",
"command": "ledger_data",
"limit": 5,
"binary": true
}
{
"method": "ledger_data",
"params": [
{
"binary": true,
"ledger_hash": "D771E2D1A624BBD3FA26827C48F3B6BD5B33E1C642E0982B239D4928E967E25A",
"limit": 5
}
]
}
Note: There is no command line syntax forThe request can contain the following fields:ledger_data. You can access this method from the command line using thejsoncommand.
Field |
Type | Description |
|---|---|---|
id |
(Arbitrary) | (WebSocket only) Any identifier that separates this request from others when responses are delayed or out of order. |
ledger_hash |
String | (Optional) A 20-byte hex string of the ledger version to use. (See Specifying Ledgers) |
ledger_index |
String or Unsigned Integer | (Optional) The sequence number or shortcut string of the ledger to use automatically selects the ledger. (See Specifying Ledgers) |
binary |
Boolean | (Optional, defaults to False) If set to true, returns the ledger object as a hashed hex string instead of JSON. |
limit |
Integer | (optional, changed by default) Limits the number of ledger objects to be retrieved. The server does not need to respect this value. |
marker |
(Not Specified) | The value from the previously paginated response. Continue retrieving data while this response is stalled. |
ledger field is deprecated and may be removed without notice.
An example of a successful response:
{
"id": 2,
"result": {
"ledger_hash": "D771E2D1A624BBD3FA26827C48F3B6BD5B33E1C642E0982B239D4928E967E25A",
"ledger_index": "156173",
"marker": "1E58E0D2E99FFE7EF7C2B98EE63998F845860CF2A58EAE711C12A894A1205A63",
"state": [{
"data": "11006F2200000000240000000B250000015133000000000000000034000000000000000055E8146BAA479266D61727383AAF3A7EBA3061B917F08C61BFA82B2C551CAF94355010AFE8D4AF92CB0CBD5051A499BA555711BA23DFD44FACDE675A17AF4C4A80AAAB6440000000000F424065D485543DF729C000000000000000000000000000434E590000000000C3B914002ED6944382B78F183DD6613F0E5CC5FD8114F2D333C71B380B69EDEB68751F7AAD5EE3350E8C",
"index": "0027D7CCB2CF1E7A8A15A7F255F459BB0B1B42CD2908929C23E948D73966ABC2"
}, {
"data": "11006F22000200002400000011250000123A33000000000000000034000000000000000055FA09A55BB3DA539D72B12D3D359C51901F8467F9C97A113E4AAE54D7A546A50750108F8858298670F04B0D754DDD47BAF18BCDDC13409AF229994F1550F7DCA7000064D4CA71EA17A3C000000000000000000000000000434E590000000000C3B914002ED6944382B78F183DD6613F0E5CC5FD6540000000004AC4A08114F2D333C71B380B69EDEB68751F7AAD5EE3350E8C",
"index": "01985A028B3C15B0CD5D0D5B60F2558043F56FFC4CA04B2177CBBFDF2215D22C"
}, {
"data": "1100642200000000581150F3BF4E6D62FAAD62B4D65887E58BA3607C7871238F49B84ED7A30C2EB49E82148B17262A312E4FF5BE1138A85301428C74628BB80113C21F5F400136752D1233FCD9812C4F10D2FCACCE4BCD3398C223F74CFAB010381DA5BE6436A2A7A04FCC55D92AAD60CF3E071B8F13C1D774E219750CFC03207C67DDC9FD121609956EB68CCDF0B4289C763685FB8A3FA9547817E97E92928D5E679FCE3C3F9D3C2889918CB3DCDF310F5B9FCA974BD60D6D5EEB0A3C3D3537CBE8E980C47F489D3CA16E08921B1FE1B20A9A539E233647D82A24A5CAA933931870599E86525727BC6E65DF438FBAF5A39DC30219C91D5AEBB7F70E9B9BDEC3C4BEDBF68A044A7A482962DDF6D960E8C573B95D016433550944DE2ED51E00F41A27E4290774398E42ABB509F49B87B29E5E02505C44437495B816B06BCB6DDEFAFC5BA1323B98B9F0813AF51F525B5C96D7A8179894DD9AD4E9810A5D6023BCD72B3F207649244430791157BD5F29CE9E5B5716D7B83DA9C99B8E5C756BCE430B6CF8BE6F90427EB2EC9131C8A571BA94200A3770C9D26C5403C8C1E19923F8CD02F91FC56E10E6B5170A3EDE8AB39A201597EB0956F310FF0A0F32F4130FB708445AD0483C67C59FE5B1DF6E74A8B270556CDF991503A1F915EA64BB4A48AD87243669CC9CB2F2C658FB816B63C501E346EBAD252E15DFFE136A96882961C1356F6187424C87825150C9AE89E67CC751283DA7ABC6C74E3254E44DE414EB4CB416DF",
"index": "1150F3BF4E6D62FAAD62B4D65887E58BA3607C7871238F49B84ED7A30C2EB49E"
}, {
"data": "1100642200000000581325AE6430D47924A0E9389AC91A7D1125B1AF64A0D729E790BD4BB6DDEFC072821415B8498C737803B6C6D57F0F5F085C8746AF154B011340B84627D80CFDCF5C9721417038617F7A174E0081C69E402490A73AA5A5070CB456D1739F8B693C93D3E4EC9788D1D6492ED5B841360F2DCC625A3EA47C04ABC9",
"index": "1325AE6430D47924A0E9389AC91A7D1125B1AF64A0D729E790BD4BB6DDEFC072"
}, {
"data": "11006F2200000000240000000625000001483300000000000000003400000000000000005597674188B06F3ED44BA2F34180E0B538579504647796E00D8DD5F865D85F0EBB5010AFE8D4AF92CB0CBD5051A499BA555711BA23DFD44FACDE675B038D7EA4C6800064400000000098968065D4C38D7EA4C68000000000000000000000000000434E590000000000C3B914002ED6944382B78F183DD6613F0E5CC5FD8114F2D333C71B380B69EDEB68751F7AAD5EE3350E8C",
"index": "159769461D9A3B758F9315780270886EA863E21F3677997F319EB58E1F71174A"
}],
"validated": true
},
"status": "success",
"type": "response"
}
{
"id": 2,
"result": {
"ledger_hash": "D771E2D1A624BBD3FA26827C48F3B6BD5B33E1C642E0982B239D4928E967E25A",
"ledger_index": "156173",
"marker": "1E58E0D2E99FFE7EF7C2B98EE63998F845860CF2A58EAE711C12A894A1205A63",
"state": [{
"Account": "vP3AYvkqCZTP3oh9b9zDzVqgf9odzhFCcC",
"BookDirectory": "AFE8D4AF92CB0CBD5051A499BA555711BA23DFD44FACDE675A17AF4C4A80AAAB",
"BookNode": "0000000000000000",
"Flags": 0,
"LedgerEntryType": "Offer",
"OwnerNode": "0000000000000000",
"PreviousTxnID": "E8146BAA479266D61727383AAF3A7EBA3061B917F08C61BFA82B2C551CAF9435",
"PreviousTxnLgrSeq": 337,
"Sequence": 11,
"TakerGets": {
"currency": "CNY",
"issuer": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"value": "1.5"
},
"TakerPays": "1000000",
"index": "0027D7CCB2CF1E7A8A15A7F255F459BB0B1B42CD2908929C23E948D73966ABC2"
}, {
"Account": "vP3AYvkqCZTP3oh9b9zDzVqgf9odzhFCcC",
"BookDirectory": "8F8858298670F04B0D754DDD47BAF18BCDDC13409AF229994F1550F7DCA70000",
"BookNode": "0000000000000000",
"Flags": 131072,
"LedgerEntryType": "Offer",
"OwnerNode": "0000000000000000",
"PreviousTxnID": "FA09A55BB3DA539D72B12D3D359C51901F8467F9C97A113E4AAE54D7A546A507",
"PreviousTxnLgrSeq": 4666,
"Sequence": 17,
"TakerGets": "4900000",
"TakerPays": {
"currency": "CNY",
"issuer": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"value": "29.4"
},
"index": "01985A028B3C15B0CD5D0D5B60F2558043F56FFC4CA04B2177CBBFDF2215D22C"
}, {
"Flags": 0,
"Indexes": ["5F400136752D1233FCD9812C4F10D2FCACCE4BCD3398C223F74CFAB010381DA5", "BE6436A2A7A04FCC55D92AAD60CF3E071B8F13C1D774E219750CFC03207C67DD", "C9FD121609956EB68CCDF0B4289C763685FB8A3FA9547817E97E92928D5E679F", "CE3C3F9D3C2889918CB3DCDF310F5B9FCA974BD60D6D5EEB0A3C3D3537CBE8E9", "80C47F489D3CA16E08921B1FE1B20A9A539E233647D82A24A5CAA93393187059", "9E86525727BC6E65DF438FBAF5A39DC30219C91D5AEBB7F70E9B9BDEC3C4BEDB", "F68A044A7A482962DDF6D960E8C573B95D016433550944DE2ED51E00F41A27E4", "290774398E42ABB509F49B87B29E5E02505C44437495B816B06BCB6DDEFAFC5B", "A1323B98B9F0813AF51F525B5C96D7A8179894DD9AD4E9810A5D6023BCD72B3F", "207649244430791157BD5F29CE9E5B5716D7B83DA9C99B8E5C756BCE430B6CF8", "BE6F90427EB2EC9131C8A571BA94200A3770C9D26C5403C8C1E19923F8CD02F9", "1FC56E10E6B5170A3EDE8AB39A201597EB0956F310FF0A0F32F4130FB708445A", "D0483C67C59FE5B1DF6E74A8B270556CDF991503A1F915EA64BB4A48AD872436", "69CC9CB2F2C658FB816B63C501E346EBAD252E15DFFE136A96882961C1356F61", "87424C87825150C9AE89E67CC751283DA7ABC6C74E3254E44DE414EB4CB416DF"],
"LedgerEntryType": "DirectoryNode",
"Owner": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"RootIndex": "1150F3BF4E6D62FAAD62B4D65887E58BA3607C7871238F49B84ED7A30C2EB49E",
"index": "1150F3BF4E6D62FAAD62B4D65887E58BA3607C7871238F49B84ED7A30C2EB49E"
}, {
"Flags": 0,
"Indexes": ["B84627D80CFDCF5C9721417038617F7A174E0081C69E402490A73AA5A5070CB4", "56D1739F8B693C93D3E4EC9788D1D6492ED5B841360F2DCC625A3EA47C04ABC9"],
"LedgerEntryType": "DirectoryNode",
"Owner": "vpyqxXzyoX62Bs6WRckYuUoVQjiGaBvCwB",
"RootIndex": "1325AE6430D47924A0E9389AC91A7D1125B1AF64A0D729E790BD4BB6DDEFC072",
"index": "1325AE6430D47924A0E9389AC91A7D1125B1AF64A0D729E790BD4BB6DDEFC072"
}, {
"Account": "vP3AYvkqCZTP3oh9b9zDzVqgf9odzhFCcC",
"BookDirectory": "AFE8D4AF92CB0CBD5051A499BA555711BA23DFD44FACDE675B038D7EA4C68000",
"BookNode": "0000000000000000",
"Flags": 0,
"LedgerEntryType": "Offer",
"OwnerNode": "0000000000000000",
"PreviousTxnID": "97674188B06F3ED44BA2F34180E0B538579504647796E00D8DD5F865D85F0EBB",
"PreviousTxnLgrSeq": 328,
"Sequence": 6,
"TakerGets": {
"currency": "CNY",
"issuer": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"value": "10"
},
"TakerPays": "10000000",
"index": "159769461D9A3B758F9315780270886EA863E21F3677997F319EB58E1F71174A"
}],
"validated": true
},
"status": "success",
"type": "response"
}
200 OK
{
"result": {
"ledger_hash": "D771E2D1A624BBD3FA26827C48F3B6BD5B33E1C642E0982B239D4928E967E25A",
"ledger_index": "156173",
"marker": "1E58E0D2E99FFE7EF7C2B98EE63998F845860CF2A58EAE711C12A894A1205A63",
"state": [{
"Account": "vP3AYvkqCZTP3oh9b9zDzVqgf9odzhFCcC",
"BookDirectory": "AFE8D4AF92CB0CBD5051A499BA555711BA23DFD44FACDE675A17AF4C4A80AAAB",
"BookNode": "0000000000000000",
"Flags": 0,
"LedgerEntryType": "Offer",
"OwnerNode": "0000000000000000",
"PreviousTxnID": "E8146BAA479266D61727383AAF3A7EBA3061B917F08C61BFA82B2C551CAF9435",
"PreviousTxnLgrSeq": 337,
"Sequence": 11,
"TakerGets": {
"currency": "CNY",
"issuer": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"value": "1.5"
},
"TakerPays": "1000000",
"index": "0027D7CCB2CF1E7A8A15A7F255F459BB0B1B42CD2908929C23E948D73966ABC2"
}, {
"Account": "vP3AYvkqCZTP3oh9b9zDzVqgf9odzhFCcC",
"BookDirectory": "8F8858298670F04B0D754DDD47BAF18BCDDC13409AF229994F1550F7DCA70000",
"BookNode": "0000000000000000",
"Flags": 131072,
"LedgerEntryType": "Offer",
"OwnerNode": "0000000000000000",
"PreviousTxnID": "FA09A55BB3DA539D72B12D3D359C51901F8467F9C97A113E4AAE54D7A546A507",
"PreviousTxnLgrSeq": 4666,
"Sequence": 17,
"TakerGets": "4900000",
"TakerPays": {
"currency": "CNY",
"issuer": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"value": "29.4"
},
"index": "01985A028B3C15B0CD5D0D5B60F2558043F56FFC4CA04B2177CBBFDF2215D22C"
}, {
"Flags": 0,
"Indexes": ["5F400136752D1233FCD9812C4F10D2FCACCE4BCD3398C223F74CFAB010381DA5", "BE6436A2A7A04FCC55D92AAD60CF3E071B8F13C1D774E219750CFC03207C67DD", "C9FD121609956EB68CCDF0B4289C763685FB8A3FA9547817E97E92928D5E679F", "CE3C3F9D3C2889918CB3DCDF310F5B9FCA974BD60D6D5EEB0A3C3D3537CBE8E9", "80C47F489D3CA16E08921B1FE1B20A9A539E233647D82A24A5CAA93393187059", "9E86525727BC6E65DF438FBAF5A39DC30219C91D5AEBB7F70E9B9BDEC3C4BEDB", "F68A044A7A482962DDF6D960E8C573B95D016433550944DE2ED51E00F41A27E4", "290774398E42ABB509F49B87B29E5E02505C44437495B816B06BCB6DDEFAFC5B", "A1323B98B9F0813AF51F525B5C96D7A8179894DD9AD4E9810A5D6023BCD72B3F", "207649244430791157BD5F29CE9E5B5716D7B83DA9C99B8E5C756BCE430B6CF8", "BE6F90427EB2EC9131C8A571BA94200A3770C9D26C5403C8C1E19923F8CD02F9", "1FC56E10E6B5170A3EDE8AB39A201597EB0956F310FF0A0F32F4130FB708445A", "D0483C67C59FE5B1DF6E74A8B270556CDF991503A1F915EA64BB4A48AD872436", "69CC9CB2F2C658FB816B63C501E346EBAD252E15DFFE136A96882961C1356F61", "87424C87825150C9AE89E67CC751283DA7ABC6C74E3254E44DE414EB4CB416DF"],
"LedgerEntryType": "DirectoryNode",
"Owner": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"RootIndex": "1150F3BF4E6D62FAAD62B4D65887E58BA3607C7871238F49B84ED7A30C2EB49E",
"index": "1150F3BF4E6D62FAAD62B4D65887E58BA3607C7871238F49B84ED7A30C2EB49E"
}, {
"Flags": 0,
"Indexes": ["B84627D80CFDCF5C9721417038617F7A174E0081C69E402490A73AA5A5070CB4", "56D1739F8B693C93D3E4EC9788D1D6492ED5B841360F2DCC625A3EA47C04ABC9"],
"LedgerEntryType": "DirectoryNode",
"Owner": "vpyqxXzyoX62Bs6WRckYuUoVQjiGaBvCwB",
"RootIndex": "1325AE6430D47924A0E9389AC91A7D1125B1AF64A0D729E790BD4BB6DDEFC072",
"index": "1325AE6430D47924A0E9389AC91A7D1125B1AF64A0D729E790BD4BB6DDEFC072"
}, {
"Account": "vP3AYvkqCZTP3oh9b9zDzVqgf9odzhFCcC",
"BookDirectory": "AFE8D4AF92CB0CBD5051A499BA555711BA23DFD44FACDE675B038D7EA4C68000",
"BookNode": "0000000000000000",
"Flags": 0,
"LedgerEntryType": "Offer",
"OwnerNode": "0000000000000000",
"PreviousTxnID": "97674188B06F3ED44BA2F34180E0B538579504647796E00D8DD5F865D85F0EBB",
"PreviousTxnLgrSeq": 328,
"Sequence": 6,
"TakerGets": {
"currency": "CNY",
"issuer": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"value": "10"
},
"TakerPays": "10000000",
"index": "159769461D9A3B758F9315780270886EA863E21F3677997F319EB58E1F71174A"
}],
"validated": true
},
"status": "success",
"type": "response"
}
Responses follow a standard format, with successful results containing the following fields:
Field |
Type | Description |
|---|---|---|
ledger_index |
Unsigned Integer | The serial number of this ledger |
ledger_hash |
String | Hash that uniquely identifies the entire ledger |
state |
Array | An array of JSON objects containing the data in the tree, as defined below |
marker |
(Not Specified) | Server-defined value indicating that the response is paginated. Pass this to the next call to resume where this call left off |
state array depends on whether binary is set to true or not in the request. Each state object may contain the following fields:
Field |
Type | Description |
|---|---|---|
data |
String | (includes only if "binary":true) the hexadecimal representation of the required data |
LedgerEntryType |
String | (contains only if "binary":false) A string indicating what type of ledger object this object represents. See the complete list of ledger formats. |
| (Additional fields) | (Various) | (contains only if "binary":false) describes the other fields of this object, depending on which LedgerEntryType it is. |
index |
String | A unique identifier for this ledger entry, as hexadecimal. |
- Any common error type
invalidParams- One or more fields were specified incorrectly, or one or more required fields are missing.lgrNotFound- A ledger created byledger_hashorledger_indexthat does not exist, or does exist but is not found by the server.
ledger_entry
ledger_entry method returns a single ledger object from the STM ledger in raw format. See Ledger Format for information about the different types of objects that can be retrieved.
Note: There is no command line version of this method. You can access this method from the command line using the json command.
Example of request format:
{
"id": 3,
"command": "ledger_entry",
"type": "account_root",
"account_root": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"ledger_index": "validated"
}
{
"method": "ledger_entry",
"params": [
{
"account_root": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"ledger_index": "validated",
"type": "account_root"
}
]
}
This method can retrieve several different types of data. You can choose which type of items to retrieve by passing the appropriate parameters. Specifically, you should provide one of the following fields:
index- Retrieve any type of ledger object by its unique IDaccount_root- Retrieves the AccountRoot object. This is roughly equivalent to the account_info command.directory- Retrieves a DirectoryNode that contains a list of other ledger objectsoffer- Retrieves an offer object that defines an offer to exchange currencystream_state- Retrieves a StreamState object that tracks the (non-STM) currency balance between two accounts.
Field |
Type | Description |
|---|---|---|
index |
String | (Optional)Specifies the unique identifier of the individual ledger entry to be retrieved. |
account_root |
String - Address | (Optional)Specifies the AccountRoot object to retrieve. |
directory |
Object or String | (optional)Specifies a DirectoryNode. (DirectoryNode objects each contain a list of IDs of the things they contain.) If a string, interpreted in hexadecimal as a unique index into the directory. If an object requires one of the dir_root or owner as a subfield, a sub_index subfield can also be selected. |
directory.sub_index |
Unsigned Integer | (optional) Jumps to a higher "page" directory if provided. |
directory.dir_root |
String | (Required if directory is specified as an object and directory.owner is not provided) A hexadecimal string identifying the unique index of the directory to be retrieved. |
directory.owner |
String | (Required if directory is specified as an object directory.dir_root and is not provided) The unique address of the account associated with this directory |
offer |
Object or String | (optional)Specifies the Offer object to be retrieved. If a string, interpreted as the unique index of the offer. If an object requires subfields account and seq to uniquely identify the proposal. |
offer.account |
String - Address | (Required if offer is specified) The account from which the offer was submitted. |
offer.seq |
Unsigned Integer | (Required if offer is specified) The sequence number of the transaction that created the Offer object. |
stream_state |
Object | (Optional) An object that specifies the StreamState (trust line) object to retrieve. The accounts and currency subfields must uniquely specify the StreamState entry to be retrieved. |
stream_state.accounts |
Array | (Required if stream_state is specified) 2-length array of account addresses defining the two accounts linked by this StreamState object |
stream_state.currency |
String | (Required if stream_state is specified) The currency code of the StreamState object to retrieve. |
binary |
Boolean | (Optional) If true, returns the contents of the requested ledger object as a hexadecimal string. Otherwise, return the data in JSON format. The default is true if searching for index and false otherwise. |
ledger_hash |
String | (Optional) A 20-byte hex string of the ledger version to use. (See Specifying Ledgers) |
ledger_index |
String or Unsigned Integer | (Optional) The sequence number or shortcut string of the ledger to use automatically selects the ledger. (See Specifying Ledgers) |
generator and ledger parameters are obsolete and may be removed without further notice.
An example of a successful response:
{
"id": 3,
"result": {
"index": "C2FA6D77327E553B9D611CA7BE4CC0CB33817EE23919EC09C48D10E4C5653037",
"ledger_index": 156275,
"node": {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Balance": "99999986731672268",
"Flags": 0,
"LedgerEntryType": "AccountRoot",
"OwnerCount": 13,
"PreviousTxnID": "8D262E7AFD3E498C924EBA62F901FB4867C1CF04BD7248C8E894EDDD6320A376",
"PreviousTxnLgrSeq": 156245,
"Sequence": 308,
"index": "C2FA6D77327E553B9D611CA7BE4CC0CB33817EE23919EC09C48D10E4C5653037"
},
"validated": true
},
"status": "success",
"type": "response"
}
200 OK
{
"result": {
"index": "C2FA6D77327E553B9D611CA7BE4CC0CB33817EE23919EC09C48D10E4C5653037",
"ledger_index": 156275,
"node": {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Balance": "99999986731672268",
"Flags": 0,
"LedgerEntryType": "AccountRoot",
"OwnerCount": 13,
"PreviousTxnID": "8D262E7AFD3E498C924EBA62F901FB4867C1CF04BD7248C8E894EDDD6320A376",
"PreviousTxnLgrSeq": 156245,
"Sequence": 308,
"index": "C2FA6D77327E553B9D611CA7BE4CC0CB33817EE23919EC09C48D10E4C5653037"
},
"validated": true
},
"status": "success",
}
Responses follow a standard format, with successful results containing the following fields:
Field |
Type | Description |
|---|---|---|
index |
String | The unique identification key of this ledger_entry |
ledger_index |
Unsigned Integer | The unique sequence number of the ledger from which this data was retrieved |
node |
Object | (Omitted if "binary": true is specified) An object containing the data for this ledger object, according to the ledger format. |
node_binary |
String | (Omitted unless "binary":true is specified) The binary data of the ledger object, as hexadecimal. |
- Any common error type.
invalidParams- One or more fields were specified incorrectly, or one or more required fields are missing.lgrNotFound- A ledger created byledger_hashorledger_indexthat does not exist, or does exist but is not found by the server.
ledger_request
ledger_request command tells the server to obtain a specific ledger version from its connected peer. This only works if an immediately connected peer of the server owns the ledger. You may need to run the command multiple times to fully obtain the ledger.
The ledger_request request is an administrative command that cannot be run by unprivileged users!
Example of request format:
{
"id": 102,
"command": "ledger_request",
"ledger_index": 13800000
}
streamd ledger_request 13800000The request contains the following parameters:
Field |
Type | Description |
|---|---|---|
ledger_index |
Number | (Optional) Retrieve the specified ledger by its ledger index. |
ledger_hash |
String | (Optional) Retrieve the specified ledger by its identification hash. |
ledger_index or ledger_hash, but not both.
The response follows the standard format. However, if the requested ledger is not yet available, the request returns a failure response even if it successfully instructs the streamd server to begin retrieving that ledger.
Note: To retrieve a ledger, the Stream server must have a direct peer relationship with the ledger in its history. If no peer owns the requested ledger, you can use theA failure response indicates getting the status of the ledger. A successful response contains ledger information in a format similar to theconnectcommand or thefixed_ipssection of the configuration file to add the Stream's full history server tos1.labs.streamand thenledger_requestmake the request again.
ledger command.
Loading: "/etc/streamd.cfg"
Connecting to 127.0.0.1:5005
{
"result" : {
"acquiring" : {
"hash" : "01DDD89B6605E20338B8EEB8EB2B0E0DD2F685A2B164F3790C4D634B5734CC26",
"have_header" : false,
"peers" : 2,
"timeouts" : 0
},
"error" : "lgrNotFound",
"error_code" : 20,
"error_message" : "acquiring ledger containing requested index",
"request" : {
"command" : "ledger_request",
"ledger_index" : 18851277
},
"status" : "error"
}
}
Loading: "/etc/streamd.cfg"
Connecting to 127.0.0.1:5005
{
"result" : {
"hash" : "EB68B5B4F6F06BF59B6D7532BCB98BB98E2F10C2435D895217AA0AA7E910FBD5",
"have_header" : true,
"have_state" : false,
"have_transactions" : false,
"needed_state_hashes" : [
"C46F7B9E795135447AF24BAF999AB8FC1612A997F6EAAF8B784C226FF0BD8E25",
"E48F528E4FC2A1DC492C6264B27B420E2285B2A3ECF3A253DB480DA5BFB7F858",
"B62CD0B2E1277F78BC279FA037F3F747587299B60D23A551C3F63DD137DC0CF8",
"30014C55701FB8426E496A47B297BEC9E8F5BFA47763CC22DBD9024CC81D39DD",
"7EB59A853913898FCEA7B701637F33B1054BD36C32A0B910B612EFB9CDFF6334",
"07ECAD3066D62583883979A2FADAADC8F7D89FA07375843C8A47452639AB2421",
"97A87E5246AF78463485CB27E08D561E22AAF33D5E2F08FE2FACAE0D05CB5478",
"50A0525E238629B32324C9F59B4ECBEFE3C21DC726DB9AB3B6758BD1838DFF68",
"8C541B1ED47C9282E2A28F0B7F3DDFADF06644CAB71B15A3E67D04C5FAFE9BF4",
"2C6CC536C778D8C0F601E35DA7DD9888C288897E4F603E76357CE2F47E8A7A9F",
"309E78DEC67D5725476A59E114850556CC693FB6D92092997ADE97E3EFF473CC",
"8EFF61B6A636AF6B4314CAC0C08F4FED0759E1F782178A822EDE98275E5E4B10",
"9535645E5D249AC0B6126005B79BB981CBA00286E00154D20A3BCF65743EA3CA",
"69F5D6FCB41D1E6CEA5ADD42CBD194086B45E957D497DF7AEE62ADAD485660CE",
"07E93A95DBB0B8A00925DE0DF6D27E41CACC77EF75055A89815006109D82EAD3",
"7FDF25F660235DCAD649676E3E6729DF920A9B0B4B6A3B090A3C64D7BDE2FB20"
],
"needed_transaction_hashes" : [
"BA914854F2F5EDFCBD6E3E0B168E5D4CD0FC92927BEE408C6BD38D4F52505A34",
"AE3A2DB537B01EB33BB3A677242DE52C9AE0A64BD9222EE55E52855276E7EA2A",
"E145F737B255D93769673CBA6DEBA4F6AC7387A309DAACC72EA5B07ECF03C215",
"073A118552AA60E1D3C6BE6F65E4AFA01C582D9C41CCC2887244C19D9BFA7741",
"562DB8580CD3FE19AF5CEA61C2858C10091151B924DBF2AEB7CBB8722E683204",
"437C0D1C2391057079E9539CF028823D29E6437A965284F6E54CEBF1D25C5D56",
"1F069486AF5533883609E5C8DB907E97273D9A782DF26F5E5811F1C42ED63A3D",
"CAA6B7DA68EBA71254C218C81A9EA029A179694BDD0D75A49FB03A7D57BCEE49"
],
"peers" : 6,
"status" : "success",
"timeouts" : 1
}
}
Loading: "/etc/streamd.cfg"
Connecting to 127.0.0.1:5005
{
"result" : {
"ledger" : {
"accepted" : true,
"account_hash" : "84EBB27D9510AD5B9A3A328201921B3FD418D4A349E85D3DC69E33C7B506407F",
"close_time" : 486691300,
"close_time_human" : "2015-Jun-04 00:01:40",
"close_time_resolution" : 10,
"closed" : true,
"hash" : "DCF5D723ECEE1EF56D2B0024CD9BDFF2D8E3DC211BD2B9460165922564ACD863",
"ledger_hash" : "DCF5D723ECEE1EF56D2B0024CD9BDFF2D8E3DC211BD2B9460165922564ACD863",
"ledger_index" : "13840000",
"parent_hash" : "8A3F6FBC62C11DE4538D969F9C7966234635FE6CEB1133DDC37220978F8100A9",
"seqNum" : "13840000",
"totalCoins" : "99999022883526403",
"total_coins" : "99999022883526403",
"transaction_hash" : "3D759EF3AF1AE2F78716A8CCB2460C3030F82687E54206E883703372B9E1770C"
},
"ledger_index" : 13840000,
"status" : "success"
}
}
The three possible response formats are as follows:
- When a
lgrNotFounderror is returned, the response has a field,acquiringa Ledger request object indicating the progress of acquiring the ledger from the peer network. - When the response indicates that the server is currently retrieving the ledger, the body of the result is a ledger request object indicating the progress of retrieving the ledger from the peer network.
- When the ledger is fully available, the response is a representation of the ledger header.
streamd server will return a ledger request object indicating its progress in fetching the ledger. The object has the following fields:
Field |
Type | Description |
|---|---|---|
hash |
String | (can be omitted) Requests the hash of the ledger, if the server knows it. |
have_header |
Boolean | Whether the server has the header section of the requested ledger. |
have_state |
Boolean | (can be omitted) Whether the server has an account status section of the requested ledger. |
have_transactions |
Boolean | (can be omitted) Whether the server has the transaction section of the requested ledger. |
needed_state_hashes |
Array of Strings | (May be omitted) There are up to 16 hash objects in the state tree that the server still needs to retrieve. |
needed_transaction_hashes |
Array of Strings | (May be omitted) There are up to 16 object hashes in the transaction tree that the server still needs to retrieve. |
peers |
Number | How many nodes the server queries to find this ledger. |
timeouts |
Number | The number of attempts to retrieve this ledger that have timed out. |
- Any common error type.
invalidParams- One or more fields were specified incorrectly, or one or more required fields are missing. This error can also occur if you specify a ledger index that is equal to or higher than the ledger currently being processed.lgrNotFound- If the ledger has not been provided yet. This indicates that the server has started fetching the ledger, although it may fail if no connected peer owns the requested ledger. (Previously, this error used the codeledgerNotFound.)
ledger_accept
{
"id": "Accept my ledger!",
"command": "ledger_accept"
}
#Syntax: ledger_accept streamd ledger_acceptThis request does not accept any parameters. An example of a successful response:
{
"id": "Accept my ledger!",
"status": "success",
"type": "response",
"result": {
"ledger_current_index": 6643240
}
}
Responses follow a standard format, with successful results containing the following fields:
Field |
Type | Description |
|---|---|---|
ledger_current_index |
Unsigned Integer | The serial number of the newly created "current" ledger |
Note: When a ledger is closed, streamd determines the canonical sequence of transactions in that ledger and replays them. This can change the results of transactions temporarily applied to the current ledger.
Possible errors:
- Any common error type.
notStandAlone- If thestreamdserver is not currently running in standalone mode.
Transaction Management
Transactions are the only way to modify the shared state of the STM ledger. All activity on Stream takes the form of transactions: payments, currency-exchange offers, account settings, and changes to the ledger itself, such as enabling new features.
Transactions involve several sources of complexity. In traditional banking, a trusted third party (a bank or an ACH) verifies participants' identities and ensures that their balances are adjusted accurately. Stream uses cryptography and distributed computing to perform these functions. Sending STM does not require a third party outside the distributed network itself. Stream accounts also support issuing balances in any currency and trading on a decentralized exchange. This adds flexibility, but the system must account for counterparty risk, currency conversion, and other issues. The STM ledger must reliably track which transactions have been fully validated, even in the event of hardware failures, attacks, or natural disasters.
tx
The tx method retrieves information for a single transaction.
Example of request format:
{
"id": 1,
"command": "tx",
"transaction": "17CF128117A275D1E0F0638CE38DADD7DE4F978818F1E950C89CA5C62620E27D",
"binary": false
}{
"method": "tx",
"params": [
{
"transaction": "17CF128117A275D1E0F0638CE38DADD7DE4F978818F1E950C89CA5C62620E27D",
"binary": false
}
]
}#Syntax: tx transaction [binary] streamd tx 17CF128117A275D1E0F0638CE38DADD7DE4F978818F1E950C89CA5C62620E27D false
The request contains the following parameters:
Field | Type | Description |
|---|---|---|
transaction | String | 256-bit hash of the transaction, in hexadecimal. |
binary | Boolean | (optional, defaults to false) If true, return transaction data and metadata as hex strings instead of JSON |
An example of a successful response:
{
"id": 1,
"result": {
"Account": "vfq4sckDNcNcyfrDQed6FBqqDfEgTgsjtJ",
"Amount": "1000000",
"Destination": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Fee": "12",
"Flags": 2147483648,
"LastLedgerSequence": 155520,
"Memos": [{
"Memo": {
"MemoData": "68616861",
"MemoType": "6D656D6F"
}
}],
"Sequence": 77,
"SigningPubKey": "021ADD58CB32BFD8F3F24A027081CE3928CEE072E85692123DE4DF92EFCF2CE2BC",
"TransactionType": "Payment",
"TxnSignature": "304402200C8B73E45DD5C43D6C10ECF26BE1D0212BA121BC0EB090441B09AE21FAD2F17C02206143819F8B15F4C8C83A4735E56E971E7465A76C2116443092E8E7179B4A7AFD",
"date": 575694990,
"hash": "17CF128117A275D1E0F0638CE38DADD7DE4F978818F1E950C89CA5C62620E27D",
"inLedger": 155512,
"ledger_index": 155512,
"meta": {
"AffectedNodes": [{
"ModifiedNode": {
"FinalFields": {
"Account": "vfq4sckDNcNcyfrDQed6FBqqDfEgTgsjtJ",
"Balance": "21492361",
"Flags": 8388608,
"OwnerCount": 14,
"Sequence": 78
},
"LedgerEntryType": "AccountRoot",
"LedgerIndex": "ADEFE0B5A676E5431444ADA797634C65B963A00B9B79DBFA4821DA786DD6C8B4",
"PreviousFields": {
"Balance": "22492373",
"Sequence": 77
},
"PreviousTxnID": "BEE1FD0E440416A4CFD29663ADB2BAB5356CBE3FE2AF7659C69B4153612BBD52",
"PreviousTxnLgrSeq": 153524
}
}, {
"ModifiedNode": {
"FinalFields": {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Balance": "99999986730672448",
"Flags": 0,
"OwnerCount": 15,
"Sequence": 293
},
"LedgerEntryType": "AccountRoot",
"LedgerIndex": "C2FA6D77327E553B9D611CA7BE4CC0CB33817EE23919EC09C48D10E4C5653037",
"PreviousFields": {
"Balance": "99999986729672448"
},
"PreviousTxnID": "BEE1FD0E440416A4CFD29663ADB2BAB5356CBE3FE2AF7659C69B4153612BBD52",
"PreviousTxnLgrSeq": 153524
}
}],
"TransactionIndex": 0,
"TransactionResult": "tesSUCCESS",
"delivered_amount": "1000000"
},
"validated": true
},
"status": "success",
"type": "response"
}The response follows a standard format, with a successful result containing the fields of the Transaction object and the following additional fields:
Field | Type | Description |
|---|---|---|
hash | String | SHA-512 hash of transaction |
inLedger | Unsigned Integer | (Deprecated) Alias ledger_index. |
ledger_index | Unsigned Integer | The sequence number of the ledger containing this transaction. |
meta | Object | Various metadata about the transaction. |
validated | Boolean | True if this data comes from a verified version of the ledger; if omitted or set to false, this data is not final. |
| (Various) | (Various) | Other fields of Transaction object |
Possible errors:
- Any common error type.
invalidParams- One or more fields were specified incorrectly, or one or more required fields are missing.txnNotFound- The transaction does not exist, or it is part of an old version of the ledger that is not availablestreamd.
transaction_entry
The transaction_entry method retrieves information for a single transaction from a specific ledger version. (tx In contrast, this command will search all ledgers for the specified transaction, and we recommend using that method.)
Example of request format:
{
"id": 4,
"command": "transaction_entry",
"tx_hash": "17CF128117A275D1E0F0638CE38DADD7DE4F978818F1E950C89CA5C62620E27D",
"ledger_index": 155512
}{
"method": "transaction_entry",
"params": [
{
"tx_hash": "17CF128117A275D1E0F0638CE38DADD7DE4F978818F1E950C89CA5C62620E27D",
"ledger_index": 155512
}
]
}#Syntax: transaction_entry transaction_hash ledger_index|ledger_hash streamd transaction_entry 17CF128117A275D1E0F0638CE38DADD7DE4F978818F1E950C89CA5C62620E27D 155512
The request contains the following parameters:
Field | Type | Description |
|---|---|---|
ledger_hash | String | (Optional) A 20-byte hex string of the ledger version to use. (See Specifying Ledgers) |
ledger_index | String or Unsigned Integer | (Optional) The sequence number or shortcut string of the ledger to use automatically selects the ledger. (See Specifying Ledgers) |
tx_hash | String | The unique hash of the transaction you are looking for |
Note: This method does not support retrieving information from the currently ongoing ledger. You must specify a ledger version in
ledger_indexorledger_hash.
An example of a successful response:
{
"id": 4,
"result": {
"ledger_index": 155512,
"metadata": {
"AffectedNodes": [{
"ModifiedNode": {
"FinalFields": {
"Account": "vfq4sckDNcNcyfrDQed6FBqqDfEgTgsjtJ",
"Balance": "21492361",
"Flags": 8388608,
"OwnerCount": 14,
"Sequence": 78
},
"LedgerEntryType": "AccountRoot",
"LedgerIndex": "ADEFE0B5A676E5431444ADA797634C65B963A00B9B79DBFA4821DA786DD6C8B4",
"PreviousFields": {
"Balance": "22492373",
"Sequence": 77
},
"PreviousTxnID": "BEE1FD0E440416A4CFD29663ADB2BAB5356CBE3FE2AF7659C69B4153612BBD52",
"PreviousTxnLgrSeq": 153524
}
}, {
"ModifiedNode": {
"FinalFields": {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Balance": "99999986730672448",
"Flags": 0,
"OwnerCount": 15,
"Sequence": 293
},
"LedgerEntryType": "AccountRoot",
"LedgerIndex": "C2FA6D77327E553B9D611CA7BE4CC0CB33817EE23919EC09C48D10E4C5653037",
"PreviousFields": {
"Balance": "99999986729672448"
},
"PreviousTxnID": "BEE1FD0E440416A4CFD29663ADB2BAB5356CBE3FE2AF7659C69B4153612BBD52",
"PreviousTxnLgrSeq": 153524
}
}],
"TransactionIndex": 0,
"TransactionResult": "tesSUCCESS"
},
"tx_json": {
"Account": "vfq4sckDNcNcyfrDQed6FBqqDfEgTgsjtJ",
"Amount": "1000000",
"Destination": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Fee": "12",
"Flags": 2147483648,
"LastLedgerSequence": 155520,
"Memos": [{
"Memo": {
"MemoData": "68616861",
"MemoType": "6D656D6F"
}
}],
"Sequence": 77,
"SigningPubKey": "021ADD58CB32BFD8F3F24A027081CE3928CEE072E85692123DE4DF92EFCF2CE2BC",
"TransactionType": "Payment",
"TxnSignature": "304402200C8B73E45DD5C43D6C10ECF26BE1D0212BA121BC0EB090441B09AE21FAD2F17C02206143819F8B15F4C8C83A4735E56E971E7465A76C2116443092E8E7179B4A7AFD",
"hash": "17CF128117A275D1E0F0638CE38DADD7DE4F978818F1E950C89CA5C62620E27D",
"inLedger": 155512,
"ledger_index": 155512
},
"validated": false
},
"status": "success",
"type": "response"
}Responses follow a standard format, with successful results containing the following fields:
Field | Type | Description |
|---|---|---|
ledger_index | Unsigned Integer | The sequence number of the ledger version found in this transaction; this is the same as in the request. |
ledger_hash | String | (May be omitted) Discover the unique hash of the ledger version of this transaction; this is the same as in the request. |
metadata | Object | Various metadata about the transaction. |
tx_json | Object | JSON representation of Transaction object |
There are several possible reasons why the server may not be able to find the transaction:
- Transaction does not exist
- The transaction exists, but is not in the specified ledger version
- The server does not have the specified ledger version available. Another server with the correct version may respond differently.
Possible errors:
- Any common error type.
fieldNotFoundTransaction-tx_hashThis field is ignored in the requestnotYetImplemented- No ledger version specified in the request.lgrNotFound- A ledger created byledger_hashorledger_indexthat does not exist, or does exist but is not found by the server.transactionNotFound- The transaction specified in the request was not found in the specified ledger. (It may be in a different ledger version, or not available at all.)
tx_history
tx_history method retrieves some recent transactions.
Warning: This method is deprecated and may be removed without notice.Example of request format:
{
"id": 5,
"command": "tx_history",
"start": 0
}
{
"method": "tx_history",
"params": [
{
"start": 0
}
]
}
#Syntax: tx_history [start] streamd tx_history 0The request contains the following parameters:
Field |
Type | Description |
|---|---|---|
start |
Unsigned Integer | The number of transactions to skip. |
{
"id": 5,
"result": {
"index": 11,
"txs": [{
"Account": "vpiwZth4cjYpQzpUjHUiEbjiGkgexjU9v3",
"Fee": "12",
"Flags": 2148007936,
"LastLedgerSequence": 156205,
"Sequence": 10,
"SigningPubKey": "037BC8FBA834E60F92B2E084DD8937E871AEFFA63255EA12ED827C302C9E0217CB",
"TakerGets": "1000000",
"TakerPays": {
"currency": "CNY",
"issuer": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"value": "1"
},
"TransactionType": "OfferCreate",
"TxnSignature": "3045022100ED2C80534AB54D708D48C8E3CC51993159968B54E1AFB97AB4B8C9C07750A7300220449150763E9859B96A7C63D3CBF09FC944AE9E7C812476150B4ECB01023C4843",
"hash": "861E6F41746B753DAA4ED2D4AE11F967D6FB2F0097F86E8F22845B5BCE9F21CC",
"inLedger": 156197,
"ledger_index": 156197
}, {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Amount": {
"currency": "CNY",
"issuer": "vpiwZth4cjYpQzpUjHUiEbjiGkgexjU9v3",
"value": "1000"
},
"Destination": "vpiwZth4cjYpQzpUjHUiEbjiGkgexjU9v3",
"Fee": "12",
"Flags": 2147483648,
"LastLedgerSequence": 156197,
"SendMax": {
"currency": "CNY",
"issuer": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"value": "1010"
},
"Sequence": 300,
"SigningPubKey": "0338B02E376397CE1600D338500584CC79E54094C8544DE2400E01E7CE4447F2C6",
"TransactionType": "Payment",
"TxnSignature": "3045022100EF5BFE996389995EAD9BC6818BF1AA6364123F937E1167269CDEE73908683FD0022025A3E7EE9AE2C7FEFFAFC779914E9A53F84FDF29B8D1C27A28871CE335BA42E0",
"hash": "ADB6082D69DBFCBB062177EBFEECB5A63F637427301C5ADE12B133961FE46F86",
"inLedger": 156194,
"ledger_index": 156194
}]
},
"status": "success",
"type": "response"
}
200 OK
{
"result": {
"index": 11,
"txs": [{
"Account": "vpiwZth4cjYpQzpUjHUiEbjiGkgexjU9v3",
"Fee": "12",
"Flags": 2148007936,
"LastLedgerSequence": 156205,
"Sequence": 10,
"SigningPubKey": "037BC8FBA834E60F92B2E084DD8937E871AEFFA63255EA12ED827C302C9E0217CB",
"TakerGets": "1000000",
"TakerPays": {
"currency": "CNY",
"issuer": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"value": "1"
},
"TransactionType": "OfferCreate",
"TxnSignature": "3045022100ED2C80534AB54D708D48C8E3CC51993159968B54E1AFB97AB4B8C9C07750A7300220449150763E9859B96A7C63D3CBF09FC944AE9E7C812476150B4ECB01023C4843",
"hash": "861E6F41746B753DAA4ED2D4AE11F967D6FB2F0097F86E8F22845B5BCE9F21CC",
"inLedger": 156197,
"ledger_index": 156197
}, {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Amount": {
"currency": "CNY",
"issuer": "vpiwZth4cjYpQzpUjHUiEbjiGkgexjU9v3",
"value": "1000"
},
"Destination": "vpiwZth4cjYpQzpUjHUiEbjiGkgexjU9v3",
"Fee": "12",
"Flags": 2147483648,
"LastLedgerSequence": 156197,
"SendMax": {
"currency": "CNY",
"issuer": "vJqt7ir44V6RyWwxxEgD87sEfStdwCahZz",
"value": "1010"
},
"Sequence": 300,
"SigningPubKey": "0338B02E376397CE1600D338500584CC79E54094C8544DE2400E01E7CE4447F2C6",
"TransactionType": "Payment",
"TxnSignature": "3045022100EF5BFE996389995EAD9BC6818BF1AA6364123F937E1167269CDEE73908683FD0022025A3E7EE9AE2C7FEFFAFC779914E9A53F84FDF29B8D1C27A28871CE335BA42E0",
"hash": "ADB6082D69DBFCBB062177EBFEECB5A63F637427301C5ADE12B133961FE46F86",
"inLedger": 156194,
"ledger_index": 156194
}]
},
"status": "success",
"type": "response"
}
Responses follow a standard format, with successful results containing the following fields:
Field |
Type | Description |
|---|---|---|
index |
Unsigned Integer | The value used in the start request. |
txs |
Array | Array of transaction objects. |
- Any common error type.
invalidParams- One or more fields were specified incorrectly, or one or more required fields are missing.noPermission- The field specified bystartis greater than 10000, but you are not connected to the server as an administrator.
path_find
path_find method finds possible payment paths and sends periodic updates as those paths change. Payments made entirely in STM do not require a path, because STM can be sent directly to any account.
The path_find command has three modes, or subcommands. Choose one using the subcommand parameter:
create- Start sending pathfinding informationclose- Stop sending pathfinding informationstatus- Get information about the currently opened pathfinding request
streamd server attempts to find the cheapest path or combination of paths for payment, there is no guarantee that the path returned by this method is actually the best path. Due to server load, pathfinding may not find optimal results. Additionally, you should be careful with pathfinding results from untrusted servers. The server can be modified to return less operator revenue than the optimal path. If you don't have a server you can trust, then you should compare pathfinding results from multiple servers run by different parties to minimize the risk of a single server returning bad results. (Note: A server returning less than optimal results is not necessarily evidence of malicious behavior; it may also be a symptom of an overloaded server.)path_find: Create
create subcommand path_find creates a persistent request to find possible paths through which a payment transaction can be made from one specified account in order for another account to receive the required amount of a currency. The initial response contains the proposed path between the two addresses, which will result in receiving the required amount. Afterwards, the server will send an additional message "type": "path_find" and update the potential path. The frequency of updates is at the discretion of the server, but usually means there will be updates every few seconds when a new ledger version is available.
The client can only open one pathfinding request at a time. If another pathfinding request is already open on the same connection, the old request is automatically closed and replaced with the new one.
Example of request format:
{
"id": 8,
"command": "path_find",
"subcommand": "create",
"source_account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"destination_account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"destination_amount": {
"value": "0.001",
"currency": "USD",
"issuer": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV"
}
}
The request contains the following parameters:
Field |
Type | Description |
|---|---|---|
subcommand |
String | Use "create" to send the create command |
source_account |
String | The unique address of the source account from which to find a payment path. This is the account that sends the payment. |
destination_account |
String | The unique address of the destination account to which to find a payment path. This is the account that receives the payment. |
destination_amount |
String or Object | The monetary amount that the target account received in the transaction. Special case: You can specify "-1" (for STM) or provide -1 as the content of this value field (for non-STM currencies). This requires as many delivery paths as possible while spending no more than the amount specified by send_max (if provided). |
send_max |
String or Object | (Optional) The monetary amount that will be spent in the transaction. Not compatible with source_currencies |
paths |
Array | (Optional) Array of object arrays representing the payment paths to check. You can use this to keep yourself updated on changes to a specific path you're aware of, or to check the overall cost of paying along a specific path. |
source_currencies, bridges. These fields should be considered reserved for future use.
An example of a successful response:
{
"alternatives": [],
"destination_account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"destination_amount": {
"currency": "USD",
"issuer": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"value": "0.001"
},
"id": 8,
"source_account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"type": "path_find"
}
The initial response follows a standard format, with successful results containing the following fields:
Field |
Type | Description |
|---|---|---|
alternatives |
Array | An array of objects with suggested paths, as described below. If empty, the path connecting the source and target accounts will not be found. |
destination_account |
String | The unique address of the account that will receive the transaction |
destination_amount |
String or Object | The monetary amount received by the target in the transaction |
id |
(Various) | (WebSocket only) The ID provided in the WebSocket request is again included at this level. |
source_account |
String | The unique address to which the transaction will be sent |
full_reply |
Boolean | If false, this is the result of an incomplete search. Future replies may have better paths. If true, then this is the best path found. (Theoretically there might be a better path, but streamd won't find it.) Before closing the pathfinding request, streamd continues to send updates whenever a new ledger is closed. |
alternatives array is an object representing a path from one possible source currency (held by the initial account) to the target account and currency. The object has the following fields:
Field |
Type | Description |
|---|---|---|
paths_computed |
Array | Array of object arrays that define payment paths |
source_amount |
String or Object | The monetary amount that the source must send along this path in order for the destination to receive the required amount |
- Any common error type.
invalidParams- One or more fields were specified incorrectly, or one or more required fields are missing.noEvents- You are using a protocol that does not support asynchronous callbacks, such as JSON-RPC.
Asynchronous follow-up
In addition to the initial response, the server sends further messages in a similar format to keep the status of the payment path updated. These messages include theid of the original WebSocket request, so you know which requests prompted them, and the "type": "path_find" top-level field indicating that they were additional responses. The other fields are defined in the same way as the initial response.
If the follow-up includes "full_reply": true, then this is the best path to streamd the current ledger.
Here is an example of an asynchronous follow-up from a path_find create request:
{
"id": 1,
"type": "path_find",
"alternatives": [
/* paths omitted from this example; same format as the initial response */
],
"destination_account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"destination_amount": {
"currency": "USD",
"issuer": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"value": "0.001"
},
"source_account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV"
}path_find: Close
path_find subcommand close instructs the server to stop sending information about currently open pathfinding requests.
Example of request format:
{
"id": 57,
"command": "path_find",
"subcommand": "close"
}
The request contains the following parameters:
Field |
Type | Description |
|---|---|---|
subcommand |
String | Use "close" to send the close subcommand |
path_find create, plus the following fields:
Field |
Type | Description |
|---|---|---|
closed |
Boolean | The value true indicates that the reply is a response to the path_find close command. |
- Any common error type.
invalidParams- If any field is specified incorrectly, or any required field is missing.noEvents- If you are trying to use this method on a protocol that does not support asynchronous callbacks, such as JSON-RPC.noPathRequest- You are trying to turn off a pathfinding request when no request is open.
path_find: Status
path_find subcommand status for the client's currently open pathfinding request.
Example of request format:
{
"id": 58,
"command": "path_find",
"subcommand": "status"
}
The request contains the following parameters:
Field |
Type | Description |
|---|---|---|
subcommand |
String | Use "status" to send status |
path_find create, plus the following fields:
Field |
Type | Description |
|---|---|---|
status |
Boolean | The value true indicates that the reply is a response to the path_find status command. |
- Any common error type.
invalidParams- One or more fields were specified incorrectly, or one or more required fields are missing.noEvents- You are using a protocol that does not support asynchronous callbacks, such as JSON-RPC.noPathRequest- You are trying to check the status of a pathfinding request when no request has been opened.
vstream_path_find
The vstream_path_find method is a simplified version of path_find that can be used out of the box and provides a single response for the payment path. It is available in WebSocket and JSON-RPC APIs. However, over time, the results tend to become outdated. Rather than making multiple calls to keep things updated, you should use path_find whenever possible.
Although the streamd server attempts to find the cheapest path or combination of paths for payment, there is no guarantee that the path returned by this method is actually the best path.
Warning: Beware of path lookup results from untrusted servers. The server can be modified to return less operator revenue than the optimal path. The server may also return bad results when under heavy load. If you don't have a server you can trust, then you should compare pathfinding results from multiple servers run by different parties to minimize the risk of a single server returning bad results.
Example of request format:
{
"id": 8,
"command": "vstream_path_find",
"source_account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"source_currencies": [
{
"currency": "STM"
},
{
"currency": "USD"
}
],
"destination_account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"destination_amount": {
"value": "0.001",
"currency": "USD",
"issuer": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV"
}
}{
"method": "vstream_path_find",
"params": [
{
"destination_account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"destination_amount": {
"currency": "USD",
"issuer": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"value": "0.001"
},
"source_account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"source_currencies": [
{
"currency": "STM"
},
{
"currency": "USD"
}
]
}
]
}#Syntax vstream_path_find json ledger_index|ledger_hash
streamd vstream_path_find '{"source_account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV", "source_currencies": [ { "currency": "STM" }, { "currency": "USD" } ], "destination_account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV", "destination_amount": { "value": "0.001", "currency": "USD", "issuer": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV" } }'The request contains the following parameters:
Field | Type | Description |
|---|---|---|
source_account | String | The unique address of the account to which funds will be sent in the transaction |
destination_account | String | The unique address of the account that will be funded in the transaction |
destination_amount | String or Object | The monetary amount that the target account received in the transaction. Special case: You can specify "-1" (for STM) or provide -1 as the content of this value field (for non-STM currencies). This requires as many delivery paths as possible while spending no more than the amount specified by send_max (if provided). |
send_max | String or Object | (Optional) The currency amount that will be spent in the transaction. Cannot be used with source_currencies. |
source_currencies | Array | (Optional)An array of currencies that the source account may spend. Each entry in the array should be a JSON object with a required currency field and an optional issuer field, e.g. a way to specify a currency amount. Cannot contain more than 18 source currencies. By default, all source currencies available with up to 88 different currency/issuer pairs are used. |
ledger_hash | String | (Optional) A 20-byte hex string of the ledger version to use. (See Specifying Ledgers) |
ledger_index | String or Unsigned Integer | (Optional) The sequence number or shortcut string of the ledger to use automatically selects the ledger. (See Specifying Ledgers) |
An example of a successful response:
{
"id": 8,
"result": {
"alternatives": [],
"destination_account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"destination_currencies": ["ETH", "BTC", "CNY", "STM"]
},
"status": "success",
"type": "response"
}200 OK
{
"result": {
"alternatives": [],
"destination_account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"destination_currencies": ["ETH", "BTC", "CNY", "STM"]
},
"status": "success",
"type": "response"
}Responses follow a standard format, with successful results containing the following fields:
Field | Type | Description |
|---|---|---|
alternatives | Array | An array of objects with possible paths, as described below. If empty, there is no path connecting the source and target accounts. |
destination_account | String | The unique address of the account that will receive the payment transaction |
destination_currencies | Array | As an array of strings representing currencies accepted by the target, such as a 3-letter code "USD" or a 40-character hex, etc. "015841551A748AD2C1F76FF6ECB0CCCD00000000" |
Each element in the alternatives array is an object representing a path from one possible source currency (held by the initial account) to the target account and currency. The object has the following fields:
Field | Type | Description |
|---|---|---|
paths_computed | Array | Array of object arrays that define payment paths |
source_amount | String or Object | The monetary amount that the source must send along this path in order for the destination to receive the required amount |
The following fields are deprecated and may be ignored: paths_canonical, and paths_expanded. If they appear, you should ignore them.
Possible errors:
- Any common error type.
tooBusy- The server is under heavy load and cannot calculate the path. If you are connecting as an administrator, this will not be returned.invalidParams- One or more fields were specified incorrectly, or one or more required fields are missing.srcActMissing- This field is ignored insource_accountrequests.srcActMalformed- The field in thesource_accountrequest is not in the correct format.dstActMissing- This field is ignored indestination_accountrequests.dstActMalformed- The field in thedestination_accountrequest is not in the correct format.srcCurMalformed- Thesource_currenciesfield is not properly formatted.srcIsrMalformed-issuerOne or more fields of the currency object in the request are invalid.
sign
sign method takes a transaction and key in JSON format and returns a signed binary representation of the transaction. The result is always different, even if you provide the same transaction JSON and key. To contribute a signature to a multi-signature transaction, use the sign_for command instead.
Warning: Unless you
streamdrun the server yourself, you should use the StreamAPI to perform local signing instead of using this command. An untrusted server might alter a transaction before signing it, or use your key to sign additional arbitrary transactions as if they came from you.
Example of request format:
{
"id": 2,
"command": "sign",
"tx_json" : {
"TransactionType" : "Payment",
"Account" : "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Destination" : "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Amount" : {
"currency" : "USD",
"value" : "1",
"issuer" : "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV"
}
},
"secret" : "s████████████████████████████",
"offline": false,
"fee_mult_max": 1000
}{
"method": "sign",
"params": [
{
"offline": false,
"secret": "s████████████████████████████",
"tx_json": {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Amount": {
"currency": "USD",
"issuer": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"value": "1"
},
"Destination": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"TransactionType": "Payment"
},
"fee_mult_max": 1000
}
]
}#Syntax: sign secret tx_json [offline]
streamd sign s████████████████████████████ '{"TransactionType": "Payment", "Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV", "Destination": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV", "Amount": { "currency": "USD", "value": "1", "issuer" : "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV" }, "Sequence": 360, "Fee": "10000"}' offlineTo sign a transaction, you must provide a key that authorizes the transaction. You can do this in a few ways:
- Supply a
secretvalue and ignore thekey_typefield. The value can be formatted as a base58 seed, RFC-1751, hexadecimal or string password. (secp256k1 key only) - Supply a
key_typevalue and only one ofseed,seed_hexorpassphrase. Omit thesecretfield. (Not supported by command line syntax).
The request contains the following parameters:
Field | Type | Description |
|---|---|---|
tx_json | Object | Transaction definition in JSON format |
secret | String | (Optional) Provides the secret key of the account used to sign the transaction. Don't send your secrets to untrusted servers or over unsecured network connections. Cannot be used with key_type, seed, seed_hex, or passphrase. |
seed | String | (Optional) Provides the secret key of the account used to sign the transaction. Must be in base58 format. If provided, you must also specify key_type. Cannot be used with secret, seed_hex or passphrase. |
seed_hex | String | (Optional) Provides the secret key of the account used to sign the transaction. Must be in hexadecimal format. If provided, you must also specify key_type. Cannot be used with secret, seed or passphrase. |
passphrase | String | (Optional) Provides the key of the account used to sign the transaction, as a string password. If provided, you must also specify key_type. Cannot be used with secret, seed or seed_hex. |
key_type | String | (Optional)The type of encryption key provided in this request. Valid types are secp256k1 or ed25519. The default is secp256k1. Cannot be used with secret. Caution: Ed25519 support is experimental. |
offline | Boolean | (optional, defaults to false) If true, do not attempt to autofill or validate values when building a transaction. |
build_path | Boolean | (Optional) If provided for a payment type transaction, Paths automatically fills this field before signing. Warning: The server looks for the presence of this field, not its value. This behavior is subject to change. |
fee_mult_max | Integer | (Optional, default value is 10; recommended value is 1000) Limit the number of automatically provided Fee fields. rpcHIGH_FEEIf the current load multiplier on the transaction cost is greater than (fee_mult_max÷ fee_div_max), the signing fails with an error. Ignored if you specify the Fee transaction field (transaction cost). |
fee_div_max | Integer | (optional, default 1) rpcHIGH_FEE If the current load multiplier on the transaction cost is greater than (fee_mult_max÷fee_div_max), signing fails with an error. Ignored if you specify the Fee transaction field (transaction cost). |
Auto-Filled Fields
tx_json (the transaction object). The server provides the following fields before signing, unless the request specifies offline as true:
Sequence- The server automatically uses the next sequence number in the sender's account information.
- Warning: The account's next sequence number will not be incremented until this transaction is applied. If you sign multiple transactions without committing and waiting for a response on each transaction, you must manually provide the correct sequence number for each transaction after the first transaction.
Fee- If you omit theFeeparameter, the server will automatically try to fill in the appropriate transaction cost. In a production Stream ledger,rpcHIGH_FEEwill fail unless you provide an appropriatefee_mult_maxvalue.- The parameters
fee_mult_maxandfee_div_maxlimit how high the automatically provided transaction costs can be, based on the load scaling multiplier applied to the reference transaction cost. The default setting returns an error if the automatically provided value uses a multiplier greater than 10x. However, production Stream ledgers typically have a load multiplier of 1000x. - The command line syntax does not support
fee_mult_maxandfee_div_max. For production Stream ledgers, you must provide aFeevalue.
- Note: A malicious server can specify excessively high transaction costs, ignoring the values
fee_mult_maxandfee_div_max.
Paths- For transactions of type Payment (excluding STM to STM transfers), the Paths field can be auto-populated. Fill in only ifbuild_pathis provided.
{
"id": 2,
"result": {
"tx_blob": "1200002280000000240000013961D4838D7EA4C6800000000000000000000000000055534400000000008B17262A312E4FF5BE1138A85301428C74628BB868400000000000000A73210338B02E376397CE1600D338500584CC79E54094C8544DE2400E01E7CE4447F2C67446304402200167648A76219C3E1C6BE70B932468156F20377FC5559E4295490DFEAC1F6A1B022023BB17B6A0F2198C074839204462FA97C8B93173F8780DF5229A351BDAACD2EA81148B17262A312E4FF5BE1138A85301428C74628BB883148B17262A312E4FF5BE1138A85301428C74628BB8",
"tx_json": {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Amount": {
"currency": "USD",
"issuer": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"value": "1"
},
"Destination": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Fee": "10",
"Flags": 2147483648,
"Sequence": 313,
"SigningPubKey": "0338B02E376397CE1600D338500584CC79E54094C8544DE2400E01E7CE4447F2C6",
"TransactionType": "Payment",
"TxnSignature": "304402200167648A76219C3E1C6BE70B932468156F20377FC5559E4295490DFEAC1F6A1B022023BB17B6A0F2198C074839204462FA97C8B93173F8780DF5229A351BDAACD2EA",
"hash": "BD8CD7F28FA90A1336CBB6AA364009096A5222EC639F7D912C04E32D8ED10DBD"
}
},
"status": "success",
"type": "response"
}
200 OK
{
"result": {
"tx_blob": "1200002280000000240000013961D4838D7EA4C6800000000000000000000000000055534400000000008B17262A312E4FF5BE1138A85301428C74628BB868400000000000000A73210338B02E376397CE1600D338500584CC79E54094C8544DE2400E01E7CE4447F2C67446304402200167648A76219C3E1C6BE70B932468156F20377FC5559E4295490DFEAC1F6A1B022023BB17B6A0F2198C074839204462FA97C8B93173F8780DF5229A351BDAACD2EA81148B17262A312E4FF5BE1138A85301428C74628BB883148B17262A312E4FF5BE1138A85301428C74628BB8",
"tx_json": {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Amount": {
"currency": "USD",
"issuer": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"value": "1"
},
"Destination": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Fee": "10",
"Flags": 2147483648,
"Sequence": 313,
"SigningPubKey": "0338B02E376397CE1600D338500584CC79E54094C8544DE2400E01E7CE4447F2C6",
"TransactionType": "Payment",
"TxnSignature": "304402200167648A76219C3E1C6BE70B932468156F20377FC5559E4295490DFEAC1F6A1B022023BB17B6A0F2198C074839204462FA97C8B93173F8780DF5229A351BDAACD2EA",
"hash": "BD8CD7F28FA90A1336CBB6AA364009096A5222EC639F7D912C04E32D8ED10DBD"
}
},
"status": "success"
}
Loading: "/etc/rippled.cfg"
Connecting to 127.0.0.1:5005
{
"result": {
"tx_blob": "1200002280000000240000013961D4838D7EA4C6800000000000000000000000000055534400000000008B17262A312E4FF5BE1138A85301428C74628BB868400000000000000A73210338B02E376397CE1600D338500584CC79E54094C8544DE2400E01E7CE4447F2C67446304402200167648A76219C3E1C6BE70B932468156F20377FC5559E4295490DFEAC1F6A1B022023BB17B6A0F2198C074839204462FA97C8B93173F8780DF5229A351BDAACD2EA81148B17262A312E4FF5BE1138A85301428C74628BB883148B17262A312E4FF5BE1138A85301428C74628BB8",
"tx_json": {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Amount": {
"currency": "USD",
"issuer": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"value": "1"
},
"Destination": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Fee": "10",
"Flags": 2147483648,
"Sequence": 313,
"SigningPubKey": "0338B02E376397CE1600D338500584CC79E54094C8544DE2400E01E7CE4447F2C6",
"TransactionType": "Payment",
"TxnSignature": "304402200167648A76219C3E1C6BE70B932468156F20377FC5559E4295490DFEAC1F6A1B022023BB17B6A0F2198C074839204462FA97C8B93173F8780DF5229A351BDAACD2EA",
"hash": "BD8CD7F28FA90A1336CBB6AA364009096A5222EC639F7D912C04E32D8ED10DBD"
}
}
}
Responses follow a standard format, with successful results containing the following fields:
Field |
Type | Description |
|---|---|---|
tx_blob |
String | A fully qualified binary representation of the signed transaction, such as hexadecimal |
tx_json |
Object | The JSON specification of the complete transaction is signed, including all fields automatically populated |
Warning: If this command results in an error message, the message can contain the key from the request. Make sure these errors are not visible to others.
- Do not write this error to a log file that can be viewed by multiple people.
- Do not post this error into a public place for debugging.
- Don’t display error messages on your website, even by accident.
- Any common error type.
invalidParams- One or more fields were specified incorrectly, or one or more required fields are missing.highFee- The current load-based transaction cost multiplier exceeds the limit for automatically supplying a transaction cost. Specify a higherfee_mult_maxvalue (at least 1000), or manually set theFeefield intx_json.tooBusy- The transaction does not include a path, but the server is too busy to perform pathfinding now. If you connect as administrator, this won't happen.noPath- The transaction did not include a path, and the server was unable to find a path where this payment could occur.
submit
The submit method applies the transaction and sends it to the network for confirmation and inclusion in future ledgers.
This command has two modes:
- Commit-only mode takes the signed serialized transaction as a binary blob and submits it to the network as-is. Because signed transaction objects are immutable, no part of the transaction can be modified or automatically filled in after submission.
- The sign and commit mode takes a Transaction object in JSON format, completes and signs the transaction in the same way as the sign command, and then commits the signed transaction. We recommend using this mode only for testing and development.
To make sending transactions as robust as possible, you should sign pre-build it and keep it so that even after an outage you can still access submit it, then use it as a tx_blob. After committing, use the tx command to monitor the network to see if the transaction was successfully applied; if a restart or other problem occurs, you can safely resubmit the tx_blob transaction: since it has the same sequence number as the old transaction, it will not be applied twice.
Submit-Only Mode
The submission request contains the following parameters:
Field | Type | Description |
|---|---|---|
tx_blob | String | Submit the hexadecimal representation of the signed transaction. This can be a multi-signature transaction. |
fail_hard | Boolean | (optional, defaults to false) If true and the transaction fails locally, do not retry or relay the transaction to other servers |
Request format:
{
"id": 3,
"command": "submit",
"tx_blob": "1200002280000000240000013961D4838D7EA4C6800000000000000000000000000055534400000000008B17262A312E4FF5BE1138A85301428C74628BB868400000000000000A73210338B02E376397CE1600D338500584CC79E54094C8544DE2400E01E7CE4447F2C67446304402200167648A76219C3E1C6BE70B932468156F20377FC5559E4295490DFEAC1F6A1B022023BB17B6A0F2198C074839204462FA97C8B93173F8780DF5229A351BDAACD2EA81148B17262A312E4FF5BE1138A85301428C74628BB883148B17262A312E4FF5BE1138A85301428C74628BB8"
}{
"method": "submit",
"params": [
{
"tx_blob": "1200002280000000240000013961D4838D7EA4C6800000000000000000000000000055534400000000008B17262A312E4FF5BE1138A85301428C74628BB868400000000000000A73210338B02E376397CE1600D338500584CC79E54094C8544DE2400E01E7CE4447F2C67446304402200167648A76219C3E1C6BE70B932468156F20377FC5559E4295490DFEAC1F6A1B022023BB17B6A0F2198C074839204462FA97C8B93173F8780DF5229A351BDAACD2EA81148B17262A312E4FF5BE1138A85301428C74628BB883148B17262A312E4FF5BE1138A85301428C74628BB8"
}
]
}#Syntax: submit tx_blob submit 1200002280000000240000013961D4838D7EA4C6800000000000000000000000000055534400000000008B17262A312E4FF5BE1138A85301428C74628BB868400000000000000A73210338B02E376397CE1600D338500584CC79E54094C8544DE2400E01E7CE4447F2C67446304402200167648A76219C3E1C6BE70B932468156F20377FC5559E4295490DFEAC1F6A1B022023BB17B6A0F2198C074839204462FA97C8B93173F8780DF5229A351BDAACD2EA81148B17262A312E4FF5BE1138A85301428C74628BB883148B17262A312E4FF5BE1138A85301428C74628BB8
Sign-and-Submit Mode
- Supply a
secretvalue and ignore thekey_typefield. The value can be formatted as a base58 seed, RFC-1751, hexadecimal or string password. (secp256k1 key only) - Supply a
key_typevalue and only one ofseed,seed_hexorpassphrase. Omit thesecretfield. (Not supported by command line syntax).
Field |
Type | Description |
|---|---|---|
tx_json |
Object | Transaction definition in JSON format, optionally omitting any autofillable fields. |
secret |
String | (Optional) Provides the secret key of the account used to sign the transaction. Don't send your secrets to untrusted servers or over unsecured network connections. Cannot be used with key_type, seed, seed_hex, or passphrase. |
seed |
String | (Optional) Provides the secret key of the account used to sign the transaction. Must be in base58 format. If provided, you must also specify key_type. Cannot be used with secret, seed_hex or passphrase. |
seed_hex |
String | (Optional) Provides the secret key of the account used to sign the transaction. Must be in hexadecimal format. If provided, you must also specify key_type. Cannot be used with secret, seed or passphrase. |
passphrase |
String | (Optional) Provides the key of the account used to sign the transaction, as a string password. If provided, you must also specify key_type. Cannot be used with secret, seed or seed_hex. |
key_type |
String | (Optional) The type of encryption key provided in this request. Valid types are secp256k1 or ed25519. The default is secp256k1. Cannot be used with secret. NOTE: Ed25519 support is experimental. |
fail_hard |
Boolean | (optional, defaults to false) If true and the transaction fails locally, do not retry or relay the transaction to other servers |
offline |
Boolean | (optional, defaults to false) If true, do not attempt to autofill or validate values when building a transaction. |
build_path |
Boolean | (Optional) If provided for a payment type transaction, Paths automatically fills this field before signing. If the transaction is a direct STM to STM transfer, this field must be omitted. Warning: The server looks for the presence of this field, not its value. This behavior is subject to change. |
fee_mult_max |
Integer | (optional, default value is 10, recommended value is 1000) If Fee omits this parameter, this field limits the automatically provided Fee value to be less than or equal to the long-term basic transaction cost multiplied by this value. |
fee_div_max |
Integer | (optional, default 1) is used to fee_mult_max to create a fractional multiplier for the limit. Specifically, the server multiplies its base transaction cost by fee_mult_max and then divides that value (rounded to an integer) to obtain the limit. If the automatically provided Fee value exceeds the limit, the submit command fails. |
{
"id": 2,
"command": "submit",
"tx_json" : {
"TransactionType" : "Payment",
"Account" : "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Destination" : "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Amount" : {
"currency" : "USD",
"value" : "1",
"issuer" : "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV"
}
},
"secret" : "s████████████████████████████",
"offline": false,
"fee_mult_max": 1000
}
{
"method": "submit",
"params": [
{
"offline": false,
"secret": "s████████████████████████████",
"tx_json": {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Amount": {
"currency": "USD",
"issuer": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"value": "1"
},
"Destination": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"TransactionType": "Payment"
},
"fee_mult_max": 1000
}
]
}
#Syntax: submit secret json [offline]
streamd submit s████████████████████████████ '{"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV", "Amount": { "currency": "USD", "issuer": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV", "value": "1" }, "Destination": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV", "TransactionType": "Payment", "Fee": "10000"}'
An example of a successful response:
{
"id": 2,
"result": {
"engine_result": "temREDUNDANT",
"engine_result_code": -275,
"engine_result_message": "Sends same currency to self.",
"tx_blob": "1200002280000000240000013961D4838D7EA4C6800000000000000000000000000055534400000000008B17262A312E4FF5BE1138A85301428C74628BB868400000000000000A73210338B02E376397CE1600D338500584CC79E54094C8544DE2400E01E7CE4447F2C674473045022100E9DBF1323A39E65C5E6085CD12C49383059365A9F664466327742E0ACB975339022069CF3C84706C19419B31FD182816598BABE5410F72C3728AEA9B933C11660FF281148B17262A312E4FF5BE1138A85301428C74628BB883148B17262A312E4FF5BE1138A85301428C74628BB8",
"tx_json": {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Amount": {
"currency": "USD",
"issuer": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"value": "1"
},
"Destination": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Fee": "10",
"Flags": 2147483648,
"Sequence": 313,
"SigningPubKey": "0338B02E376397CE1600D338500584CC79E54094C8544DE2400E01E7CE4447F2C6",
"TransactionType": "Payment",
"TxnSignature": "3045022100E9DBF1323A39E65C5E6085CD12C49383059365A9F664466327742E0ACB975339022069CF3C84706C19419B31FD182816598BABE5410F72C3728AEA9B933C11660FF2",
"hash": "A9F6F788C0576969648738CECA450FD8AC82CAF0CF32540A3D2F1C7A13CBF98E"
}
},
"status": "success",
"type": "response"
}
{
"result": {
"engine_result": "temREDUNDANT",
"engine_result_code": -275,
"engine_result_message": "Sends same currency to self.",
"tx_blob": "1200002280000000240000013961D4838D7EA4C6800000000000000000000000000055534400000000008B17262A312E4FF5BE1138A85301428C74628BB868400000000000000A73210338B02E376397CE1600D338500584CC79E54094C8544DE2400E01E7CE4447F2C674473045022100E9DBF1323A39E65C5E6085CD12C49383059365A9F664466327742E0ACB975339022069CF3C84706C19419B31FD182816598BABE5410F72C3728AEA9B933C11660FF281148B17262A312E4FF5BE1138A85301428C74628BB883148B17262A312E4FF5BE1138A85301428C74628BB8",
"tx_json": {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Amount": {
"currency": "USD",
"issuer": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"value": "1"
},
"Destination": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Fee": "10",
"Flags": 2147483648,
"Sequence": 313,
"SigningPubKey": "0338B02E376397CE1600D338500584CC79E54094C8544DE2400E01E7CE4447F2C6",
"TransactionType": "Payment",
"TxnSignature": "3045022100E9DBF1323A39E65C5E6085CD12C49383059365A9F664466327742E0ACB975339022069CF3C84706C19419B31FD182816598BABE5410F72C3728AEA9B933C11660FF2",
"hash": "A9F6F788C0576969648738CECA450FD8AC82CAF0CF32540A3D2F1C7A13CBF98E"
}
}
}
Loading: "/etc/streamd.cfg"
Connecting to 127.0.0.1:5005
{
"result": {
"engine_result": "temREDUNDANT",
"engine_result_code": -275,
"engine_result_message": "Sends same currency to self.",
"tx_blob": "1200002280000000240000013961D4838D7EA4C6800000000000000000000000000055534400000000008B17262A312E4FF5BE1138A85301428C74628BB868400000000000000A73210338B02E376397CE1600D338500584CC79E54094C8544DE2400E01E7CE4447F2C674473045022100E9DBF1323A39E65C5E6085CD12C49383059365A9F664466327742E0ACB975339022069CF3C84706C19419B31FD182816598BABE5410F72C3728AEA9B933C11660FF281148B17262A312E4FF5BE1138A85301428C74628BB883148B17262A312E4FF5BE1138A85301428C74628BB8",
"tx_json": {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Amount": {
"currency": "USD",
"issuer": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"value": "1"
},
"Destination": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Fee": "10",
"Flags": 2147483648,
"Sequence": 313,
"SigningPubKey": "0338B02E376397CE1600D338500584CC79E54094C8544DE2400E01E7CE4447F2C6",
"TransactionType": "Payment",
"TxnSignature": "3045022100E9DBF1323A39E65C5E6085CD12C49383059365A9F664466327742E0ACB975339022069CF3C84706C19419B31FD182816598BABE5410F72C3728AEA9B933C11660FF2",
"hash": "A9F6F788C0576969648738CECA450FD8AC82CAF0CF32540A3D2F1C7A13CBF98E"
}
}
}
Responses follow a standard format, with successful results containing the following fields:
Field |
Type | Description |
|---|---|---|
engine_result |
String | For example, the code indicating the preliminary result of the transaction tesSUCCESS |
engine_result_code |
Integer | A numeric code indicating the preliminary result of the transaction, directly related to engine_result |
engine_result_message |
String | Human-readable explanation of preliminary transaction results |
tx_blob |
String | Complete transaction in hexadecimal string format |
tx_json |
Object | Complete transaction in JSON format |
Warning: Even though a WebSocket response has "status":"success", which indicates that the command was successfully received, it does indicate that the transaction was successfully executed. Many circumstances may prevent a transaction from being successfully processed, such as a missing trust line connecting the two accounts in the payment, or a change in account status since the transaction was constructed. Even if there are no errors, it may take several seconds to close and verify the version of the ledger containing the transaction. See the full list of transaction responses for details, and do not consider the results of a transaction final until they appear in a verified version of the ledger.
Warning: If this command results in an error message, the message can contain the key from the request. (This is not a problem if the request contains a signed tx_blob.) Make sure these errors are not visible to others.
- Do not write errors, including keys, to a log file visible to multiple people.
- Do not paste bugs including keys into a public place for debugging.
- Do not display error messages containing your key on websites, even accidentally.
- Any common error type.
amendmentBlocked- The transaction could not be submitted to the network because thestreamdserver was blocked by modification.highFee- Thefee_mult_maxparameter was specified, but the server's current fee multiplier exceeds the specified value. (Sign and Commit modes only)internalJson- An internal error occurred while serializing the transaction to JSON. This can be caused by many aspects of the transaction, including incorrect signatures or malformed fields.internalSubmit- An internal error occurred while submitting the transaction. This can be caused by many aspects of the transaction, including incorrect signatures or malformed fields.internalTransaction- An internal error occurred while processing the transaction. This can be caused by many aspects of the transaction, including incorrect signatures or malformed fields.invalidParams- One or more fields were specified incorrectly, or one or more required fields are missing.invalidTransaction- The transaction format is incorrect or invalid.noPath- The transaction does not include a path, and the server cannot find a path where this payment can occur. (Sign and Commit modes only)tooBusy- The transaction does not include a path, but the server is too busy to perform pathfinding now. If you connect as administrator, this won't happen. (Sign and Commit modes only)
book_offers
{
"id": 4,
"command": "book_offers",
"taker": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"taker_gets": {
"currency": "STM"
},
"taker_pays": {
"currency": "USD",
"issuer": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV"
},
"limit": 10
}
{
"method": "book_offers",
"params": [
{
"taker": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"taker_gets": {
"currency": "STM"
},
"taker_pays": {
"currency": "USD",
"issuer": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
},
"limit": 10
}
]
}
#Syntax: book_offers taker_pays taker_gets [taker [ledger [limit] ] ] streamd book_offers 'USD/vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV' 'EUR/vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV'The request contains the following parameters:
Field |
Type | Description |
|---|---|---|
ledger_hash |
String | (Optional) A 20-byte hex string of the ledger version to use. (See Specifying Ledgers) |
ledger_index |
String or Unsigned Integer | (Optional) The sequence number or shortcut string of the ledger to use automatically selects the ledger. (See Specifying Ledgers) |
limit |
Unsigned Integer | (Optional) If provided, the server will not serve more than this number of offers in the results. The total number of results returned may be less than the limit because the server ignores unfunded offers. |
marker |
(Not Specified) | (optional)The value from the previous paginated response. Continue to recover data if this response stops. |
taker |
String | (Optional)The address of the account to use as the perspective. The response always includes unfunded offers placed by this account. (You can use this to find your own commands to cancel them.) |
taker_gets |
Object | Specifies in which currency the account receiving the offer will receive the offer as an object with the currency and issuer fields (omitting the issuer of the STM), such as the currency amount. |
taker_pays |
Object | Specify in which currency the account accepting the offer will be paid as an object with currency and issuer fields (omitting the issuer of the STM), such as the currency amount. |
{
"id": 4,
"result": {
"ledger_current_index": 168798,
"offers": [],
"validated": false
},
"status": "success",
"type": "response"
}
200 OK
{
"result": {
"ledger_current_index": 168798,
"offers": [],
"validated": false
},
"status": "success",
"type": "response"
}
Responses follow a standard format, with successful results containing the following fields:
Field |
Type | Description |
|---|---|---|
ledger_current_index |
Integer | (Omitted if ledger version is provided) The ordinal number of the ledger version to use when retrieving this data. |
ledger_index |
Integer | (Omitted if ledger_current_index is provided instead) The sequence number provided in the request, which version of the ledger to use when retrieving this data. |
ledger_hash |
String | (can be omitted) The version of the ledger used when retrieving this data from the Hex hash provided in the request. |
marker |
(Not Specified) | (can be omitted) Server-defined value indicating that the response is paginated. Pass this to the next call to resume where this call left off. Omit if there is no information page after this. |
offers |
Array | An array of offer objects, each of which has a field for the OfferCreate transaction |
offers array members:
Field |
Type | Description |
|---|---|---|
owner_funds |
String | The currency amount of TakerGets of the quoter can be traded. (STM is expressed as a down; any other currency is expressed as a decimal value.) If a trader has multiple instruments in the same book, only the highest-ranked instrument contains this field. |
taker_gets_funded |
String (STM) or Object (non-STM) | (Included in partially funded offers only) The maximum amount available to a recipient given the funding status of the offer. |
taker_pays_funded |
String (STM) or Object (non-STM) | (Included in partially funded offers only) The maximum monetary amount that the recipient will pay, taking into account the funding status of the offer. |
quality |
Number | Exchange rate, the ratio of taker_pays divided by taker_gets. In the interest of fairness, offers of the same quality will automatically be placed on a first-in, first-out basis. (In other words, if multiple people offer to exchange currencies at the same exchange rate, the oldest offer will be used first.) |
- Any common error type.
invalidParams- One or more fields were specified incorrectly, or one or more required fields are missing.lgrNotFound- A ledger created byledger_hashorledger_indexthat does not exist, or does exist but is not found by the server.srcCurMalformed- The field in thetaker_paysrequest is not in the correct format.dstAmtMalformed- The field in thetaker_getsrequest is not in the correct format.srcIsrMalformed- Theissuerfield intaker_paysis invalid.dstIsrMalformed- Theissuerfield intaker_getsis invalid.badMarket- the required order does not exist; for example, exchange currency for yourself.
Subscriptions
When using subscriptions, you can have the server push updates to the client when various events occur so that you can know and react immediately. Subscriptions are only supported in the WebSocket API, you can receive other responses in the same channel.
JSON-RPC support for subscription callbacks is deprecated and may not work as expected.
subscribe
{
"id": "Example watch Bitstamp's hot wallet",
"command": "subscribe",
"accounts": ["vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV"]
}
{
"id": "Example subscribe to STM/GateHub USD order book",
"command": "subscribe",
"books": [
{
"taker_pays": {
"currency": "STM"
},
"taker_gets": {
"currency": "USD",
"issuer": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV"
},
"snapshot": true
}
]
}
{
"id": "Example watch for new validated ledgers",
"command": "subscribe",
"streams": ["ledger"]
}
The request contains the following parameters:
Field |
Type | Description |
|---|---|---|
streams |
Array | (Optional)Array of string names of generic streams to subscribe to, as described below |
accounts |
Array | (Optional) Array of accounts with unique base58 addresses used to monitor verified transactions. The server sends notifications for any transaction that affects at least one of the accounts. |
accounts_proposed |
Array | (optional) Like accounts, but includes transactions that have not yet been finalized. |
books |
Array | (Optional) Define an Order to monitor an updated array of objects, as described below. |
url |
String | (Optional for WebSocket; required otherwise) The server sends the URL of the JSON-RPC callback for each event. Admins only. |
url_username |
String | (Optional) Provide the username for Basic Authentication at the callback URL. |
url_password |
String | (Optional) Provide a password for Basic Authentication at the callback URL. |
user, password, rt_accounts.
The streams parameter provides access to the following default streams:
server- Sends a message whenever thestreamdserver's status (e.g. network connection) changesledger- Sends a message whenever the consensus process declares a new validated ledgertransactions- Sends a message whenever a transaction is included in a closed ledgertransactions_proposed- Message sent whenever a transaction is included in the closed ledger, and for some transactions that are not yet included in the validating ledger, and may never be. Not all proposed transactions appear before verification Note: Even some unsuccessful transactions are included in the verified ledger as they are subject to anti-spam transaction fees.validations- Message sent whenever the server receives a validation message from a server it trusts. (streamdPersonal claims validate the ledger when the server receives a quorum of validation messages from at least one trusted validator.)peer_status- (Admin only) Information about the connected peerstreamdserver, specifically about the consensus process.
books array (if provided) is an object containing the following fields:
Field |
Type | Description |
|---|---|---|
taker_gets |
Object | Specifies which currency the account receiving the quote will receive as a currency object without an amount. |
taker_pays |
Object | As a currency object without an amount, specifies in which currency the account accepting the offer will be paid. |
taker |
String | Unique base58 account address used as perspective for viewing offers. (This affects funding status and offer fees.) |
snapshot |
Boolean | (optional, defaults to false) If true, returns the current state when subscribing to the order before sending updates |
both |
Boolean | (optional, defaults to false) If true, returns both sides of the order. |
{
"id": "Example watch Bitstamp's hot wallet",
"status": "success",
"type": "response",
"result": {}
}
Responses follow a standard format. The fields included in the response depend on the subscription content included in the request.
accountsandaccounts_proposed- no field returned- Stream: Server - Information about the status of the server, such as
load_base(the current load level of the server),random(randomly generated value), etc., may change. - Stream: transactions, Stream: transactions_proposed and Stream: validation - no fields returned
- Stream: Ledger - Information about the ledger and the current fee schedule, such as
fee_base(current base fee for STM transactions),fee_ref(current base fee for fee unit transactions),ledger_hash(hash of the latest verified ledger),reserve_base(minimum reserve for the account), etc. books- No fields are returned by default. If"snapshot": trueis set in the request, returnoffers(an array of item definition objects defining the order book)
- Any universal error type.
invalidParams- One or more fields were specified incorrectly, or one or more required fields are missing.noPermission- Include theurlfield in the request, but do not connect as an administrator.unknownStream- One or more members of thestreamsrequest field are not valid stream names.malformedStream-streamsThe requested field format is incorrect.malformedAccount- One of the addresses in the request'saccountsoraccounts_proposedfields is not a properly formatted STM ledger address. (Note: You can subscribe to the stream of an address that does not yet have an entry in the global ledger to receive a message when that address is funded.)srcCurMalformed- One or moretaker_paysfields in the requestedbooksare malformed.dstAmtMalformed- One or moretaker_getsfields in the requestedbooksare malformed.srcIsrMalformed- Theissuerin one or moretaker_paysfields in the requestedbooksis invalid.dstIsrMalformed- Theissuerin one or moretaker_getsfields in the requestedbooksis invalid.badMarket-booksThere is no required order for one or more books on site; for example, exchanging currency for yourself.
Ledger Stream
The ledger flow only sends ledgerClosed messages when the consensus process declares a new valid ledger. This message identifies the ledger and provides some information about its contents.
{
"type": "ledgerClosed",
"fee_base": 10,
"fee_ref": 10,
"ledger_hash": "687F604EF6B2F67319E8DCC8C66EF49D84D18A1E18F948421FC24D2C7C3DB464",
"ledger_index": 7125358,
"ledger_time": 455751310,
"reserve_base": 20000000,
"reserve_inc": 5000000,
"txn_count": 7,
"validated_ledgers": "32570-7125358"
}The fields in the ledger flow message are as follows:
Field | Type | Description |
|---|---|---|
type | String | ledgerClosed indicates that this is from the ledger flow |
fee_base | Unsigned Integer | STM falling 'reference transaction' cost. (See Transaction Costs. If a ledger contains a SetFee pseudo-transaction, the new transaction costs will be applied to all transactions after this ledger. |
fee_ref | Unsigned Integer | The cost of the "reference transaction" in the "cost unit". |
ledger_hash | String | Unique hash of ledger as hex closure |
ledger_index | Unsigned Integer | Serial number of closed ledger |
ledger_time | Unsigned Integer | The time of this ledger is closed within seconds after the Stream Epoch |
reserve_base | Unsigned Integer | The minimum reserve required for the account, in STM. If the ledger contains a fake SetFee transaction, the new base reserve is applied after this ledger. |
reserve_inc | Unsigned Integer | The account reserve increases for each item (such as an offer or credit line) the account has. If the ledger contains a SetFee pseudo-transaction, the new owner reservation is applied after this ledger. |
txn_count | Unsigned Integer | Number of new transactions included in this ledger |
validated_ledgers | String | (can be omitted) The range of ledgers available to the server. This may be discontinuous. This field will not be returned if the server is not connected to the network, or if it is connected but has not yet obtained the ledger from the network. |
Transaction Streams
Many subscriptions result in messages about transactions, including the following:
- The
transactionsflow - The
transactions_proposedflow accountsSubscriptionaccounts_proposedSubscriptionbook(order book) subscription
The transactions_proposed stream is, strictly speaking, a superset of the transactions stream: it includes all validated transactions, as well as some proposed transactions that have not yet been incorporated into a valid ledger and may never be included. You can identify these "in progress" transactions by their fields:
- The
validatedfield is missing or has the valuefalse. - No
metaormetadatafield. - Instead of the
ledger_hashandledger_indexfields specifying the ledger version in which transactions were completed, there is aledger_current_indexfield specifying the ledger version in which they are currently presented.
Otherwise, messages in the transactions_proposed stream are the same as messages in the transactions stream.
Since the only thing that can modify an account or order is a transaction, these messages are sent as a result of a specific subscription, accounts or books are also in the form of transaction messages, the same as those in the transactions stream. The only difference is that you only receive messages for transactions that affect the account or order you are watching.
The accounts_proposed subscription works the same way, but it also includes unconfirmed transactions, such as the transactions_proposed stream, for the account you are watching.
{
"status": "closed",
"type": "transaction",
"engine_result": "tesSUCCESS",
"engine_result_code": 0,
"engine_result_message": "The transaction was applied.",
"ledger_hash": "989AFBFD65D820C6BD85301B740F5D592F060668A90EEF5EC1815EBA27D58FE8",
"ledger_index": 7125442,
"meta": {
"AffectedNodes": [
{
"ModifiedNode": {
"FinalFields": {
"Flags": 0,
"IndexPrevious": "0000000000000000",
"Owner": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"RootIndex": "ABD8CE2D1205D0C062876E9E1F3CBDC902ED8EF4E8D3D071B962C7ED0E113E68"
},
"LedgerEntryType": "DirectoryNode",
"LedgerIndex": "0BBDEE7D0BE120F7BF27640B5245EBFE0C5FD5281988BA823C44477A70262A4D"
}
},
{
"DeletedNode": {
"FinalFields": {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"BookDirectory": "892E892DC63D8F70DCF5C9ECF29394FF7DD3DC6F47DB8EB34A03920BFC5E99BE",
"BookNode": "0000000000000000",
"Flags": 0,
"OwnerNode": "000000000000006E",
"PreviousTxnID": "58A17D95770F8D07E08B81A85896F4032A328B6C2BDCDEC0A00F3EF3914DCF0A",
"PreviousTxnLgrSeq": 7125330,
"Sequence": 540691,
"TakerGets": "4401967683",
"TakerPays": {
"currency": "BTC",
"issuer": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"value": "0.04424"
}
},
"LedgerEntryType": "Offer",
"LedgerIndex": "386B7803A9210747941B0D079BB408F31ACB1CB98832184D0287A1CBF4FE6D00"
}
},
{
"DeletedNode": {
"FinalFields": {
"ExchangeRate": "4A03920BFC5E99BE",
"Flags": 0,
"RootIndex": "892E892DC63D8F70DCF5C9ECF29394FF7DD3DC6F47DB8EB34A03920BFC5E99BE",
"TakerGetsCurrency": "0000000000000000000000000000000000000000",
"TakerGetsIssuer": "0000000000000000000000000000000000000000",
"TakerPaysCurrency": "0000000000000000000000004254430000000000",
"TakerPaysIssuer": "92D705968936C419CE614BF264B5EEB1CEA47FF4"
},
"LedgerEntryType": "DirectoryNode",
"LedgerIndex": "892E892DC63D8F70DCF5C9ECF29394FF7DD3DC6F47DB8EB34A03920BFC5E99BE"
}
},
{
"ModifiedNode": {
"FinalFields": {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Balance": "11133297300",
"Flags": 0,
"OwnerCount": 9,
"Sequence": 540706
},
"LedgerEntryType": "AccountRoot",
"LedgerIndex": "A6C2532E1008A513B3F822A92B8E5214BD0D413DC20AD3631C1A39AD6B36CD07",
"PreviousFields": {
"Balance": "11133297310",
"OwnerCount": 10,
"Sequence": 540705
},
"PreviousTxnID": "484D57DFC4E446DA83B4540305F0CE836D4E007361542EC12CC0FFB5F0A1BE3A",
"PreviousTxnLgrSeq": 7125358
}
}
],
"TransactionIndex": 1,
"TransactionResult": "tesSUCCESS"
},
"transaction": {
"Account": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV",
"Fee": "10",
"Flags": 2147483648,
"OfferSequence": 540691,
"Sequence": 540705,
"SigningPubKey": "030BB49C591C9CD65C945D4B78332F27633D7771E6CF4D4B942D26BA40748BB8B4",
"TransactionType": "OfferCancel",
"TxnSignature": "30450221008223604A383F3AED25D53CE7C874700619893A6EEE4336508312217850A9722302205E0614366E174F2DFF78B879F310DB0B3F6DA1967E52A32F65E25DCEC622CD68",
"date": 455751680,
"hash": "94CF924C774DFDBE474A2A7E40AEA70E7E15D130C8CBEF8AF1D2BE97A8269F14"
},
"validated": true
}Transaction flow messages have the following fields:
Field | Type | Description |
|---|---|---|
type | String | transaction indicates that this is a transaction notification, which may come from multiple possible streams. |
engine_result | String | String transaction result code |
engine_result_code | Number | Numeric transaction response code (if applicable). |
engine_result_message | String | Human-readable explanation of transaction response |
ledger_current_index | Unsigned Integer | (Omitted for verified transactions) The sequence number of the current ledger version currently submitting this transaction |
ledger_hash | String | (Omitted for unverified transactions) Contains a unique hash of the ledger version of this transaction, as hex |
ledger_index | Unsigned Integer | (Omitted for unverified transactions) Contains the sequence number of the ledger version of this transaction |
meta | Object | (Omitted for unvalidated transactions) Various metadata about the transaction, including the ledger entries it affects |
transaction | Object | Definition of the transaction in JSON format |
validated | Boolean | If true, this transaction is included in the verified ledger. transaction should always validate responses from streams. |
Peer Status Stream
The administrator-only peer_status stream reports a wealth of information about streamd the activity of other servers to which this server is connected, especially their status in the consensus process.
Example of peer status flow message:
{
"action": "CLOSING_LEDGER",
"date": 508546525,
"ledger_hash": "4D4CD9CD543F0C1EF023CC457F5BEFEA59EEF73E4552542D40E7C4FA08D3C320",
"ledger_index": 18853106,
"ledger_index_max": 18853106,
"ledger_index_min": 18852082,
"type": "peerStatusChange"
}Peer status stream messages represent events that change the status of a peer streamd server. The messages are JSON objects with the following fields:
Field | Value | Description |
|---|---|---|
type | String | peerStatusChange indicates that this comes from the peer status stream. |
action | String | Indicates the event type of this message. View peer status events for possible values. |
date | Number | The time this event occurred, the number of seconds since the Stream Epoch. |
ledger_hash | String | (can be omitted) Identification hash of the ledger version to which the message belongs. |
ledger_index | Number | (May be omitted) The ledger index of the ledger version to which this message belongs. |
ledger_index_max | Number | (May be omitted) The largest ledger index currently available to the peer. |
ledger_index_min | Number | (can be omitted) The smallest ledger index currently available to the peer. |
actionThe fields of the peer status flow message can have the following values:
Value | Meaning |
|---|---|
CLOSING_LEDGER | A peer has closed a ledger version with this ledger index, which usually means it is about to start reaching consensus. |
ACCEPTED_LEDGER | Peers established this ledger as a result of a consensus round. NOTE: This ledger is still not guaranteed to be immutably verified. |
SWITCHED_LEDGER | Peers concluded that it was not following the rest of the network in switching to a different ledger version. |
LOST_SYNC | Peers track which ledger versions are validated and reaching consensus behind other parts of the network. |
unsubscribe
unsubscribe command tells the server to stop sending messages for a specific subscription or set of subscriptions.
Example of request format:
{
"id": "Unsubscribe a lot of stuff",
"command": "unsubscribe",
"streams": ["ledger","server","transactions","transactions_proposed"],
"accounts": ["vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV"],
"accounts_proposed": ["vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV"],
"books": [
{
"taker_pays": {
"currency": "STM"
},
"taker_gets": {
"currency": "USD",
"issuer": "vDgSCaGS3iih9iKvfvRULrK7gurJjdDnUV"
},
"both": true
}
]
}
The parameters in the request are almost identical to the subscribe parameters, except that they are used to define the subscription to end. The parameters are:
Field |
Type | Description |
|---|---|---|
streams |
Array | (Optional) An array of string names for common streams to follow, including unsubscribe from ledger, server, transactions, and transactions_proposed. |
accounts |
Array | (Optional) An array of unique Base58 account addresses used to stop receiving updates. (These emails will only be stopped if you have previously subscribed specifically to these accounts. You cannot use this feature to filter accounts from the normal transaction flow.) |
accounts_proposed |
Array | (optional) Like accounts, but for accounts_proposed subscriptions that contain transactions that have not yet been verified. |
books |
Array | (Optional) Defines an array of objects to unsubscribe from, as described below. |
rt_accounts and url parameters, as well as the rt_transactions stream name, are deprecated and may be removed without further notice.
The definition of objects in the books array is almost the same as the objects in the subscription, except that they do not have all the fields. Their fields are as follows:
Field |
Type | Description |
|---|---|---|
taker_gets |
Object | Specifies in which currency the account receiving the offer will receive the offer as an object with the currency and issuer fields (omitting the issuer of the STM), such as the currency amount. |
taker_pays |
Object | Specify in which currency the account accepting the offer will be paid as an object with currency and issuer fields (omitting the issuer of the STM), such as the currency amount. |
both |
Boolean | (optional, default false) If true, deletes subscriptions on both sides of the order. |
{
"id": "Unsubscribe a lot of stuff",
"result": {},
"status": "success",
"type": "response"
}
Responses follow a standard format and successful results contain no fields.
Possible errors:
- Any common error type.
invalidParams- One or more fields were specified incorrectly, or one or more required fields are missing.noPermission- Include theurlfield in the request, but do not connect as an administrator.malformedStream-streamsThe requested field format is incorrect.malformedAccount- One of the addresses in the request'saccountsoraccounts_proposedfields is not a properly formatted STM ledger address.
- Note: You can subscribe to the stream for addresses that have not yet been entered in the global ledger to receive messages when an address is funded.
srcCurMalformed- One or moretaker_paysfields in the requestedbooksare malformed.dstAmtMalformed- One or moretaker_getsfields in the requestedbooksare malformed.srcIsrMalformed- Theissuerin one or moretaker_paysfields in the requestedbooksis invalid.dstIsrMalformed- Theissuerin one or moretaker_getsfields in the requestedbooksis invalid.badMarket-booksThere is no required order for one or more books on site; for example, exchanging currency for yourself.
Server Information
There are also commands that can retrieve information about the current status of the server. These may be useful for monitoring the health of the server or preparing to make additional API methods. For example, you can query the current fee schedule before sending a transaction, or you can see which ledger versions are available before digging into the ledger history for a specific record.
server_info
server_info command requests a human-readable version of various information from the server about the streamd server being queried.
Example of request format:
{
"id": 1,
"command": "server_info"
}
{
"method": "server_info",
"params": [
{}
]
}
#Syntax: server_info streamd server_infoThe request does not contain any parameters. An example of a successful response:
{
"id": 1,
"result": {
"info": {
"build_version": "0.1.0",
"complete_ledgers": "2-168922",
"hostid": "MOS",
"io_latency_ms": 1,
"last_close": {
"converge_time_s": 2.001,
"proposers": 2
},
"load_factor": 1,
"peers": 2,
"pubkey_node": "n9KeFY9ZAmhuk2CDdKthcMhcZLhhaBrCFKSNAc1ondhFZNQgfR5e",
"server_state": "proposing",
"validated_ledger": {
"age": 12,
"base_fee_stm": 1e-05,
"hash": "5BED1224009D5FC996B41A5E95041286596346D96DD8F6B4DF18DDD4FC65F54C",
"reserve_base_stm": 1,
"reserve_inc_stm": 0.1,
"seq": 168922
},
"validation_quorum": 2
}
},
"status": "success",
"type": "response"
}
200 OK
{
"result": {
"info": {
"build_version": "0.1.0",
"complete_ledgers": "2-168922",
"hostid": "MOS",
"io_latency_ms": 1,
"last_close": {
"converge_time_s": 2.001,
"proposers": 2
},
"load_factor": 1,
"peers": 2,
"pubkey_node": "n9KeFY9ZAmhuk2CDdKthcMhcZLhhaBrCFKSNAc1ondhFZNQgfR5e",
"server_state": "proposing",
"validated_ledger": {
"age": 12,
"base_fee_stm": 1e-05,
"hash": "5BED1224009D5FC996B41A5E95041286596346D96DD8F6B4DF18DDD4FC65F54C",
"reserve_base_stm": 1,
"reserve_inc_stm": 0.1,
"seq": 168922
},
"validation_quorum": 2
}
},
"status": "success",
"type": "response"
}
The response follows a standard format, with successful results containing an info object as the only field.
The info object may have the following fields:
Field |
Type | Description |
|---|---|---|
build_version |
String | The version number of the running streamd version. |
closed_ledger |
Object | (May be omitted) Information for recently closed ledgers has not yet been confirmed by consensus. If a recently validated ledger is available, the reply omits this field and contains validated_ledger. Member fields are the same as validated_ledger fields. |
complete_ledgers |
String | The range expression indicates the sequence number of the locally fluctuated ledger version in the database. For example, this might be a disjoint sequence 24900901-24900984,24901116-24901158. |
hostid |
String | On management requests, returns the hostname of the server running this streamd instance; otherwise, returns a unique four-letter word. |
io_latency_ms |
Number | The time spent waiting for I/O operations, in milliseconds. If this number is not very, very low, then the streamd server may have serious load problems. |
last_close |
Object | Information about the last time the server closed the ledger, including the time it took to reach consensus and the number of trusted validators participating. |
load |
Object | (Admin only)Details about the current load status of the server |
load.job_types |
Array | (Administrator only) Information about the rate at which different types of jobs are being performed by the server and how much time each job takes. |
load.threads |
Number | (Administrator only)The number of threads in the server's main job pool. |
load_factor_local |
Number | (May be omitted) The current multiplier by which this transaction cost is multiplied, based on the load of this server. |
load_factor_net |
Number | (optional) The current multiplier for transaction costs used by the rest of the network (estimated based on load values reported by other servers). |
load_factor_cluster |
Number | (May be omitted) The current multiplier for transaction costs based on server load in this cluster. |
peers |
Number | streamdHow many other servers this server is currently connected to. |
pubkey_node |
String | The public key used to authenticate this server for peer-to-peer communication. This key is automatically generated when the server starts for the first time. (If deleted, the server can create a new pair of keys.) |
pubkey_validator |
String | (Administrator only) The public key used by this node to sign ledger verification. |
server_state |
String | A string indicating the extent to which the server participates in the network. For more information, see Possible Server Status |
state_accounting |
Object | A map of various server statuses, containing information about how long the server spent each time. This can be used to track the long-term health of your server and network connections. |
state_accounting.*.duration_us |
String | The number of microseconds the server spent in this state. (Updated every time the server transitions to another state.) |
state_accounting.*.transitions |
Number | The number of times the server transitioned to this state. |
uptime |
Number | The number of consecutive seconds the server has been running. |
validated_ledger |
Object | (May be omitted) Information about the most recent fully verified ledger. If the most recently verified ledger is not available, the reply omits this field and contains closed_ledger. |
validated_ledger.age |
Number | The time in seconds since the ledger was closed. |
validated_ledger.base_fee_stm |
Number | Basic fee, at STM. This can be expressed in scientific notation, such as 1e-050.00005. |
validated_ledger.hash |
String | Unique hash of the ledger, as hex |
validated_ledger.reserve_base_stm |
Unsigned Integer | Minimum STM amount that needs to be retained in each account (as opposed to falling) |
validated_ledger.reserve_inc_stm |
Unsigned Integer | The amount of STM added to the account reserve for each object the account owns in the ledger (not discarded) |
validated_ledger.seq |
Number - Ledger Index | Ledger index of the latest verified ledger |
validation_quorum |
Number | The minimum number of trusted verifications required to verify a version of the ledger. Some situations may cause the server to require more verification. |
Note: If thePossible errors:closed_ledgerfield is present and theseqvalue is small (less than 8 bits), it indicates thatstreamddoes not currently have a copy of the verified ledger from the peer network. This probably means your server is still syncing. Typically, network synchronization takes approximately 5 minutes, depending on connection speed and hardware specifications.
- Any common error type.
server_state
The server_state command asks the server for various machine-readable information about the streamd server's current state. The result is almost the sameserver_info, but in units that are easier to handle than easier to read. (For example, STM values are given in integer decimals, not scientific notation or decimal values, and times are in milliseconds, not seconds.)
Example of request format:
{
"id": 2,
"command": "server_state"
}{
"method": "server_state",
"params": [
{}
]
}#Syntax: server_state streamd server_state
This request does not require any parameters.
An example of a successful response:
{
"id": 2,
"result": {
"state": {
"build_version": "0.1.0",
"complete_ledgers": "2-168954",
"io_latency_ms": 1,
"last_close": {
"converge_time": 2001,
"proposers": 2
},
"load_base": 256,
"load_factor": 256,
"peers": 2,
"pubkey_node": "n9KiKNomfCpaMgocLawVjQv7VvvBbDTw1Kcy8YMTNJJBdoQM4sGZ",
"server_state": "proposing",
"validated_ledger": {
"base_fee": 10,
"close_time": 575963230,
"hash": "16388D25CD429747F753DF68438FC8C0173AAF4F971870C4B0A4625530C178F8",
"reserve_base": 1000000,
"reserve_inc": 100000,
"seq": 168954
},
"validation_quorum": 2
}
},
"status": "success",
"type": "response"
}200 OK
{
"result": {
"state": {
"build_version": "0.1.0",
"complete_ledgers": "2-168954",
"io_latency_ms": 1,
"last_close": {
"converge_time": 2001,
"proposers": 2
},
"load_base": 256,
"load_factor": 256,
"peers": 2,
"pubkey_node": "n9KiKNomfCpaMgocLawVjQv7VvvBbDTw1Kcy8YMTNJJBdoQM4sGZ",
"server_state": "proposing",
"validated_ledger": {
"base_fee": 10,
"close_time": 575963230,
"hash": "16388D25CD429747F753DF68438FC8C0173AAF4F971870C4B0A4625530C178F8",
"reserve_base": 1000000,
"reserve_inc": 100000,
"seq": 168954
},
"validation_quorum": 2
}
},
"status": "success",
"type": "response"
}Responses follow a standard format, with successful results containing a state object as the only field.
The state object may have the following fields:
Field | Type | Description |
|---|---|---|
build_version | String | The version number of the running streamd version. |
complete_ledgers | String | The range expression represents the sequence number of the ledger version in the local streamd database. May be disjoint sequences, such as "2500-5000,32570-7695432". |
closed_ledger | Object | (May be omitted) Information for recently closed ledgers has not yet been confirmed by consensus. If a recently validated ledger is available, the reply omits this field and contains validated_ledger. Member fields are the same as validated_ledger fields. |
io_latency_ms | Number | The time spent waiting for I/O operations, in milliseconds. If this number is not very, very low, then the streamd server may have serious load problems. |
load | Object | (Admin only)Details about the current load status of the server |
load.job_types | Array | (Administrator only) Information about the rate at which different types of jobs are being performed by the server and how much time each job takes. |
load.threads | Number | (Administrator only)The number of threads in the server's main job pool. |
load_base | Integer | This is the baseline amount of server load used in transaction cost calculations. If load_factor is equal to load_base then only the base transaction cost is performed. If the load_factor value is higher than the load_base value, the transaction cost is multiplied by the ratio between them. For example, if load_factor is twice load_base, then the transaction cost will be doubled. |
peers | Number | streamdHow many other servers this server is currently connected to. |
pubkey_node | String | The public key used to authenticate this server for peer-to-peer communication. This key pair is automatically generated when the server is started for the first time. (If deleted, the server can create a new pair of keys.) |
pubkey_validator | String | (Admin only) The public key of the key pair used by this server to sign proposed ledgers for verification. |
server_state | String | A string indicating the extent to which the server participates in the network. For more information, see Possible Server Status |
state_accounting | Object | Various maps of server states, containing information about how much time the server spent each time. This can be used to track the long-term health of your server and network connections. |
state_accounting.*.duration_us | String | The number of microseconds the server spent in this state. (Updated every time the server transitions to another state.) |
state_accounting.*.transitions | Number | The number of times the server transitioned to this state. |
uptime | Number | The number of consecutive seconds the server has been running. |
validated_ledger | Object | (May be omitted) Information about the most recent fully verified ledger. If the most recently verified ledger is not available, the reply omits this field and contains closed_ledger. |
validated_ledger.base_fee | Unsigned Integer | The base fee, in STM, used to propagate transactions to the network. |
validated_ledger.close_time | Number | The amount of time this ledger has been closed since the Stream Epoch |
validated_ledger.hash | String | A unique hash of this ledger version, as hex |
validated_ledger.reserve_base | Unsigned Integer | The minimum amount required to be retained in each account, in STM |
validated_ledger.reserve_inc | Unsigned Integer | The amount, in STM, added to the account reserve for each item the account owns in the ledger. |
validated_ledger.seq | Unsigned Integer | The unique serial number of this ledger |
validation_quorum | Number | The minimum number of trusted verifications required to verify a version of the ledger. Some situations may cause the server to require more verification. |
Possible errors:
- Any common error type.
can_delete
With the online_delete and advisory_delete configuration options enabled, the can_delete method notifies the ripple server of the latest ledger that may have been deleted.
The can_delete method is an administrator command that cannot be run by unprivileged users.
Example of request format:
{
"id": 2,
"command": "can_delete",
"can_delete": 11320417
}{
"method": "can_delete",
"params": [
{
"can_delete": 11320417
}
]
}#Syntax can_delete [<ledger_index>|<ledger_hash>|now|always|never] streamd can_delete 11320417
The request contains the following optional parameters:
Field | Type | Description |
|---|---|---|
can_delete | String or Integer | Maximum ledger allowed to be deleted. For ledger_index or ledger_hash see Specifying a Ledger. never sets this value to 0, effectively disabling online deletion until another can_delete is called appropriately. alwaysSets this value to the largest possible ledger (4294967295), with online deletions occurring at each configured online_delete interval. now triggers an online deletion in the next verified ledger when the configured online_delete interval is reached or exceeded, but with no further limit. |
If no parameters are specified, no changes are made.
Responses follow the standard format, with successful results containing the following fields:
Field | Type | Description |
|---|---|---|
can_delete | Integer | The largest ledger index that can be deleted via the online delete routine. |
Use this command without parameters to query existing can_delete settings.
Possible errors:
- Any common error type.
notEnabled- Not enabled in configuration.notReady- Not ready to handle this request.lgrNotFound- ledger not found.invalidParams- Invalid parameters.
consensus_info
consensus_info command provides information about the consensus process for debugging purposes.
The consensus_info method is an administrator command that cannot be run by unprivileged users.
Example of request format:
{
"id": 99,
"command": "consensus_info"
}
{
"method": "consensus_info",
"params": [
{}
]
}
#Syntax: consensus_info streamd consensus_infoThis request has no parameters. An example of a successful response:
{
"result" : {
"info" : {
"acquired" : {
"4BC2CE596CBD1321775320E2067F9C06D3862826212C16EF42ABB6A2B0414306" : "acquired"
},
"close_granularity" : 10,
"close_percent" : 50,
"close_resolution" : 10,
"close_times" : {
"486082972" : 1,
"486082973" : 4
},
"current_ms" : 1003,
"have_time_consensus" : false,
"ledger_seq" : 13701086,
"our_position" : {
"close_time" : 486082973,
"previous_ledger" : "0BB01379B51234BAAF501A71C7AB147F595460B689BB9E8252A0B87B5A483623",
"propose_seq" : 0,
"transaction_hash" : "4BC2CE596CBD1321775320E2067F9C06D3862826212C16EF42ABB6A2B0414306"
},
"peer_positions" : {
"5C29005CF4FB479FC49EEFB4A5B075C86DD963CC" : {
"close_time" : 486082973,
"peer_id" : "n9L81uNCaPgtUJfaHh89gmdvXKAmSt5Gdsw2g1iPWaPkAHW5Nm4C",
"previous_ledger" : "0BB01379B51234BAAF501A71C7AB147F595460B689BB9E8252A0B87B5A483623",
"propose_seq" : 0,
"transaction_hash" : "4BC2CE596CBD1321775320E2067F9C06D3862826212C16EF42ABB6A2B0414306"
},
"EFC49EB648E557CC50A72D715249B80E071F7705" : {
"close_time" : 486082973,
"peer_id" : "n949f75evCHwgyP4fPVgaHqNHxUVN15PsJEZ3B3HnXPcPjcZAoy7",
"previous_ledger" : "0BB01379B51234BAAF501A71C7AB147F595460B689BB9E8252A0B87B5A483623",
"propose_seq" : 0,
"transaction_hash" : "4BC2CE596CBD1321775320E2067F9C06D3862826212C16EF42ABB6A2B0414306"
}
},
"previous_mseconds" : 2005,
"previous_proposers" : 5,
"proposers" : 5,
"proposing" : false,
"state" : "consensus",
"synched" : true,
"validating" : false
},
"status" : "success"
}
}
Loading: "/etc/streamd.cfg"
Connecting to 127.0.0.1:5005
{
"result" : {
"info" : {
"acquired" : {
"4BC2CE596CBD1321775320E2067F9C06D3862826212C16EF42ABB6A2B0414306" : "acquired"
},
"close_granularity" : 10,
"close_percent" : 50,
"close_resolution" : 10,
"close_times" : {
"486082972" : 1,
"486082973" : 4
},
"current_ms" : 1003,
"have_time_consensus" : false,
"ledger_seq" : 13701086,
"our_position" : {
"close_time" : 486082973,
"previous_ledger" : "0BB01379B51234BAAF501A71C7AB147F595460B689BB9E8252A0B87B5A483623",
"propose_seq" : 0,
"transaction_hash" : "4BC2CE596CBD1321775320E2067F9C06D3862826212C16EF42ABB6A2B0414306"
},
"peer_positions" : {
"5C29005CF4FB479FC49EEFB4A5B075C86DD963CC" : {
"close_time" : 486082973,
"peer_id" : "n9L81uNCaPgtUJfaHh89gmdvXKAmSt5Gdsw2g1iPWaPkAHW5Nm4C",
"previous_ledger" : "0BB01379B51234BAAF501A71C7AB147F595460B689BB9E8252A0B87B5A483623",
"propose_seq" : 0,
"transaction_hash" : "4BC2CE596CBD1321775320E2067F9C06D3862826212C16EF42ABB6A2B0414306"
},
"EFC49EB648E557CC50A72D715249B80E071F7705" : {
"close_time" : 486082973,
"peer_id" : "n949f75evCHwgyP4fPVgaHqNHxUVN15PsJEZ3B3HnXPcPjcZAoy7",
"previous_ledger" : "0BB01379B51234BAAF501A71C7AB147F595460B689BB9E8252A0B87B5A483623",
"propose_seq" : 0,
"transaction_hash" : "4BC2CE596CBD1321775320E2067F9C06D3862826212C16EF42ABB6A2B0414306"
}
},
"previous_mseconds" : 2005,
"previous_proposers" : 5,
"proposers" : 5,
"proposing" : false,
"state" : "consensus",
"synched" : true,
"validating" : false
},
"status" : "success"
}
}
Responses follow a standard format, with successful results containing the following fields:
Field |
Type | Description |
|---|---|---|
info |
Object | Information that may be useful for debugging consensus. This output is subject to change without notice. |
info object:
Field |
Type | Description |
|---|---|---|
ledger_seq |
Number | The sequence number of the ledger currently in the consensus process |
our_position |
Object | What this server expects from the ledger during the consensus process. |
peer_positions |
Object | During the consensus process, peers’ maps and their proposed versions of the ledger. |
proposers |
Number | The number of trusted validators participating in this consensus process. Which validators are trusted depends on the configuration of this server. |
synched |
Boolean | Whether this server considers itself to be in sync with the network. |
state |
String | What section is currently progressing in the consensus process: open, consensus, finished, or accepted. |
info contains only "consensus": "none" is also normal. It indicates that the server is between consensus rounds.
The results of consensus_info can change substantially between calls, even when those calls are only a short time apart.
Possible errors:
- Any common error type.
fetch_info
fetch_info command returns information about the objects this server is currently fetching from the network, and how many peers have that information. It can also be used to reset the current extraction.
The fetch_info method is an admin command that cannot be run by unprivileged users.
Example of request format:
{
"id": 91,
"command": "fetch_info",
"clear": false
}
{
"method": "fetch_info",
"params": [
{
"clear": false
}
]
}
#Syntax: fetch_info [clear] streamd fetch_infoThe request contains the following parameters:
Field |
Type | Description |
|---|---|---|
clear |
Boolean | If true, resets the current extraction. Otherwise, only the status of the in-progress extraction will be obtained. |
{
"result" : {
"info" : {
"348928" : {
"hash" : "C26D432B06F84861BCACD7942EDC3FE0B2E1DEB966A9E516A0FD275A375C2010",
"have_header" : true,
"have_state" : false,
"have_transactions" : true,
"needed_state_hashes" : [
"BF8DC6B1E10D1D3565BF0649075D22EBFD34F751AFCC0E53E81D74786BC88922",
"34E37A71CB51A12C73A435250E6A6349F7884C7EEBA6B88FA31F0244E967E88F",
"BFB7D3008A7D61FD6A0538D1C2E70CFB94CE8DC66606319C372F278A48629765",
"41C0C61D701FB1EA586F0EF1FC7A91FEC476D979589DA60507F05C13F7C21975",
"6DDE8840A2C3C7FF05E5FFEE4D06408694C16A8357338FE0C4581DC3D8A00BBA",
"6C69D833B582C849917806FA009518832BB50E900E43716FD7CC1966428DD0CF",
"1EDC020CFC4AF19B625C52E20B66D6AE672821CCC461E8A9C457A3B2955657F7",
"FC0616A66A2B0589CA513F3341D4EA51E782C4601E5072308478E3CC19264640",
"19FC607B5DE1B64681A676EC1ED5507B9555B0E098CD9D898320297DE1A64033",
"5E128D3FC990074E35687387A14AA12D9FD287E5AB57CB9B2FD83DE635DF5CA9",
"DE72820F3981770F2AA8770BC233B80661F1A452819D8529008875FF8DED87A9",
"3ACB84BEE2C45556351FF60FD787D235C9CF5623FB8A35B01446B773598E7CC0",
"0DD3A8DF69874148057F1F2BF305442FF2E89A76A08B4CC8C051E2ED69B874F3",
"4AE9A9C4F12A5BD0355037DA40A0B145420A2168A9FEDE43E643BD13062F8ECE",
"08CBF8CFFEC207F5AC4E4F24BC447011FD8C79D25B344281FBFB4732D7058ED4",
"779B2577C5C4BAED6657421448EA506BBF50F86BE363E0924127C4EA17A58BBE"
],
"peers" : 2,
"timeouts" : 0
}
},
"status" : "success"
}
}
Loading: "/etc/streamd.cfg"
Connecting to 127.0.0.1:5005
{
"result" : {
"info" : {
"348928" : {
"hash" : "C26D432B06F84861BCACD7942EDC3FE0B2E1DEB966A9E516A0FD275A375C2010",
"have_header" : true,
"have_state" : false,
"have_transactions" : true,
"needed_state_hashes" : [
"BF8DC6B1E10D1D3565BF0649075D22EBFD34F751AFCC0E53E81D74786BC88922",
"34E37A71CB51A12C73A435250E6A6349F7884C7EEBA6B88FA31F0244E967E88F",
"BFB7D3008A7D61FD6A0538D1C2E70CFB94CE8DC66606319C372F278A48629765",
"41C0C61D701FB1EA586F0EF1FC7A91FEC476D979589DA60507F05C13F7C21975",
"6DDE8840A2C3C7FF05E5FFEE4D06408694C16A8357338FE0C4581DC3D8A00BBA",
"6C69D833B582C849917806FA009518832BB50E900E43716FD7CC1966428DD0CF",
"1EDC020CFC4AF19B625C52E20B66D6AE672821CCC461E8A9C457A3B2955657F7",
"FC0616A66A2B0589CA513F3341D4EA51E782C4601E5072308478E3CC19264640",
"19FC607B5DE1B64681A676EC1ED5507B9555B0E098CD9D898320297DE1A64033",
"5E128D3FC990074E35687387A14AA12D9FD287E5AB57CB9B2FD83DE635DF5CA9",
"DE72820F3981770F2AA8770BC233B80661F1A452819D8529008875FF8DED87A9",
"3ACB84BEE2C45556351FF60FD787D235C9CF5623FB8A35B01446B773598E7CC0",
"0DD3A8DF69874148057F1F2BF305442FF2E89A76A08B4CC8C051E2ED69B874F3",
"4AE9A9C4F12A5BD0355037DA40A0B145420A2168A9FEDE43E643BD13062F8ECE",
"08CBF8CFFEC207F5AC4E4F24BC447011FD8C79D25B344281FBFB4732D7058ED4",
"779B2577C5C4BAED6657421448EA506BBF50F86BE363E0924127C4EA17A58BBE"
],
"peers" : 2,
"timeouts" : 0
}
},
"status" : "success"
}
}
Responses follow a standard format, with successful results containing the following fields:
Field |
Type | Description |
|---|---|---|
info |
Object | A map of the objects being extracted and the status of the objects being extracted. The ledger being extracted can be identified by its serial number; ledgers and other objects being extracted can also be identified by their hashes. |
Field |
Type | Description |
|---|---|---|
hash |
String | The hash of the item being fetched. |
have_header |
Boolean | For ledgers, whether this server has obtained the header portion of the ledger. |
have_transactions |
Boolean | For ledgers, whether this server has obtained the transaction portion of the ledger. |
needed_state_hashes |
Array of (Hash) Strings | This project still requires a hash of the state object. If more than 16 are required, the response only contains the first 16. |
peers |
Number | The number of peers who own this product. |
timeouts |
Number | The number of times this item was retrieved resulted in a timeout (2.5 seconds). |
- Any common error type.
feature
feature command returns information about the modifications that the server is aware of, including whether they are enabled and whether the server voted for those modifications during the modification process.
You can use the feature command to temporarily configure the server to vote against or in favor of amendments. This change will not persist if you restart the server. To make persistent changes to a modification vote, use the streamd.cfg file. For more information, see Configuring Remediation Voting.
The feature method is an administrator command that cannot be run by unprivileged users.
Example of request format:
{
"id": "list_all_features",
"command": "feature"
}
{
"id": "reject_multi_sign",
"command": "feature",
"feature": "4C97EBA926031A7CF7D7B36FDE3ED66DDA5421192D63DE53FFB46E43B9DC8373",
"vetoed": true
}
{
"method": "feature",
"params": [
{
"feature": "4C97EBA926031A7CF7D7B36FDE3ED66DDA5421192D63DE53FFB46E43B9DC8373",
"vetoed": false
}
]
}
#Syntax: feature [<feature_id> [accept|reject]] streamd feature 4C97EBA926031A7CF7D7B36FDE3ED66DDA5421192D63DE53FFB46E43B9DC8373 acceptThe request contains the following parameters:
Field |
Type | Description |
|---|---|---|
feature |
String | (Optional) A unique identifier of the amendment, such as hexadecimal; or the abbreviation of the amendment. If provided, limit responses to an amendment. Otherwise, the reply will list all amendments. |
vetoed |
Boolean | (Optional; ignored unless otherwise specified by feature) If true, instructs the server to vote for modifications specified by feature. If false, instructs the server to vote for the modification. |
Note: You can configure the server to support a new amendment by specifying its ID in theAn example of a successful response:featurefield, even if the server does not yet know how to apply it. For example, you may want to do this if you plan to upgrade soon to astreamdversion that supports the amendment.
{
"id": "list_all_features",
"status": "success",
"type": "response",
"result": {
"features": {
"42426C4D4F1009EE67080A9B7965B44656D7714D104A72F9B4369F97ABF044EE": {
"enabled": false,
"name": "FeeEscalation",
"supported": true,
"vetoed": false
},
"4C97EBA926031A7CF7D7B36FDE3ED66DDA5421192D63DE53FFB46E43B9DC8373": {
"enabled": false,
"name": "MultiSign",
"supported": true,
"vetoed": false
},
"6781F8368C4771B83E8B821D88F580202BCB4228075297B19E4FDC5233F1EFDC": {
"enabled": false,
"name": "TrustSetAuth",
"supported": true,
"vetoed": false
}
}
}
}
{
"id": "reject_multi_sign",
"status": "success",
"type": "response",
"result": {
"features": {
"4C97EBA926031A7CF7D7B36FDE3ED66DDA5421192D63DE53FFB46E43B9DC8373": {
"enabled": false,
"name": "MultiSign",
"supported": true,
"vetoed": true
}
}
}
}
200 OK
{
"result": {
"4C97EBA926031A7CF7D7B36FDE3ED66DDA5421192D63DE53FFB46E43B9DC8373": {
"enabled": false,
"name": "MultiSign",
"supported": true,
"vetoed": false
},
"status": "success"
}
}
Loading: "/etc/streamd.cfg"
Connecting to 127.0.0.1:5005
{
"result": {
"4C97EBA926031A7CF7D7B36FDE3ED66DDA5421192D63DE53FFB46E43B9DC8373": {
"enabled": false,
"name": "MultiSign",
"supported": true,
"vetoed": false
},
"status": "success"
}
}
The response follows a standard format, and successful results contain the revision map as a JSON object. The object's key is the modification ID. The value of each key is the modification object, and the ID is used to describe the status of the revision. If the request specifies a feature, after any changes in the request are applied, the map contains only the requested modified objects. Each modification object has the following fields:
Field |
Type | Description |
|---|---|---|
enabled |
Boolean | Whether this amendment is currently enabled in the latest ledger. |
name |
String | (May be ignored) if the human-readable name of this amendment is known. |
supported |
Boolean | Whether the server knows how to apply this fix. If this field is set to false (the server does not know how to apply this revision) and enabled is set to true (this revision is enabled in the latest ledger), this revision may cause your server to be modified blocked. |
vetoed |
Boolean | Whether the server is instructed to vote against the amendment. |
Note: The name of an amendment does not strictly indicate what the amendment does. The name is not guaranteed to be unique or consistent between servers.
Possible errors:
- Any universal error type.
badFeature- The format specified byfeatureis invalid, or the server does not know a revision with that name.
get_counts
get_counts command provides various statistics about the health of the server, mainly the number of objects of different types currently held in memory.
The get_counts method is an admin command that cannot be run by non-privileged users.
Example of request format:
{
"id": 90,
"command": "get_counts",
"min_count": 100
}
{
"method": "get_counts",
"params": [
{
"min_count": 100
}
]
}
#Syntax: get_counts [min_count] streamd get_counts 100The request contains the following parameters:
Field |
Type | Description |
|---|---|---|
min_count |
Number (Unsigned Integer) | Only return fields with at least the highest value. |
{
"result" : {
"AL_hit_rate" : 48.36725616455078,
"HashRouterEntry" : 3048,
"Ledger" : 46,
"NodeObject" : 10417,
"SLE_hit_rate" : 64.62035369873047,
"STArray" : 1299,
"STLedgerEntry" : 646,
"STObject" : 6987,
"STTx" : 4104,
"STValidation" : 610,
"Transaction" : 4069,
"dbKBLedger" : 10733,
"dbKBTotal" : 39069,
"dbKBTransaction" : 26982,
"fullbelow_size" : 0,
"historical_perminute" : 0,
"ledger_hit_rate" : 71.0565185546875,
"node_hit_rate" : 3.808214902877808,
"node_read_bytes" : 393611911,
"node_reads_hit" : 1283098,
"node_reads_total" : 679410,
"node_writes" : 1744285,
"node_written_bytes" : 794368909,
"status" : "success",
"treenode_cache_size" : 6650,
"treenode_track_size" : 598631,
"uptime" : "3 hours, 50 minutes, 27 seconds",
"write_load" : 0
}
}
Loading: "/etc/streamd.cfg"
Connecting to 127.0.0.1:5005
{
"result" : {
"AL_hit_rate" : 48.36725616455078,
"HashRouterEntry" : 3048,
"Ledger" : 46,
"NodeObject" : 10417,
"SLE_hit_rate" : 64.62035369873047,
"STArray" : 1299,
"STLedgerEntry" : 646,
"STObject" : 6987,
"STTx" : 4104,
"STValidation" : 610,
"Transaction" : 4069,
"dbKBLedger" : 10733,
"dbKBTotal" : 39069,
"dbKBTransaction" : 26982,
"fullbelow_size" : 0,
"historical_perminute" : 0,
"ledger_hit_rate" : 71.0565185546875,
"node_hit_rate" : 3.808214902877808,
"node_read_bytes" : 393611911,
"node_reads_hit" : 1283098,
"node_reads_total" : 679410,
"node_writes" : 1744285,
"node_written_bytes" : 794368909,
"status" : "success",
"treenode_cache_size" : 6650,
"treenode_track_size" : 598631,
"uptime" : "3 hours, 50 minutes, 27 seconds",
"write_load" : 0
}
}
Responses follow a standard format. The list of fields included in the results is subject to change without notice, but may include any of the following (among others):
Field |
Type | Description |
|---|---|---|
Transaction |
Number | TransactionNumber of objects in memory |
Ledger |
Number | Number of ledgers in memory |
uptime |
String | This server runs uninterrupted. |
- Any common error type.
invalidParams- One or more fields were specified incorrectly, or one or more required fields are missing.
ledger_cleaner
The ledger_cleaner command controls the Ledger Cleaner, an asynchronous maintenance process that finds and repairs corruption in the streamd ledger database.
The ledger_cleaner method is an administrator command that cannot be run by unprivileged users.
Example of request format:
{
"command": "ledger_cleaner",
"max_ledger": 13818756,
"min_ledger": 13818000,
"stop": false
}The request contains the following parameters:
Field | Type | Description |
|---|---|---|
ledger | Number (Ledger Sequence Number) | (Optional) If provided, review and correct only this specific ledger. |
max_ledger | Number (Ledger Sequence Number) | (Optional) Configure the ledger clearer to check for ledgers with sequence numbers equal to or lower than this. |
min_ledger | Number (Ledger Sequence Number) | (Optional) Configure the ledger cleaner to check for ledgers with sequence numbers equal to or higher than this number. |
full | Boolean | (Optional) If true, the ledger status objects and transfers are revised in the specified ledger. Default is false. Automatically set to true if ledger is provided. |
fix_txns | Boolean | (Optional) If true, make the correct transaction in the specified ledger. Override, full if provided. |
check_nodes | Boolean | (Optional) If true in specified ledger, the correct ledger status object. Override, full if provided. |
stop | Boolean | (optional) If true, disable the book cleaner. |
An example of a successful response:
200 OK
{
"result" : {
"message" : "Cleaner configured",
"status" : "success"
}
}
Responses follow a standard format, with successful results containing the following fields:
Field | Type | Description |
|---|---|---|
message | String | Cleaner configured succeeded. |
Possible errors:
- Any common error type.
internalIf a parameter is specified incorrectly. (This is an error; the expected error code isinvalidParams.)
log_level
log_level command changes the logging verbosity of the streamd server, or returns the current logging level for each category of log messages (called a partition).
The log_level method is an administrator command that cannot be run by unprivileged users.
Example of request format:
{
"id": "ll1",
"command": "log_level",
"severity": "debug",
"partition": "PathRequest"
}
#Syntax: log_level [[partition] severity] streamd log_level PathRequest debugThe request contains the following parameters:
Field |
Type | Description |
|---|---|---|
severity |
String | (Optional) Set the logging verbosity level. Valid values are, in order from least to most verbose: fatal, error, warn, info, debug, and trace. If omitted, returns the current log verbosity for all categories. |
partition |
String | (optional) Ignored unless provided by severity. Which logging category to modify. If omitted, or if the value base is provided, sets the logging level for all categories. |
Loading: "/etc/streamd.cfg"
Connecting to 127.0.0.1:5005
{
"result" : {
"status" : "success"
}
}
Loading: "/etc/streamd.cfg"
Connecting to 127.0.0.1:5005
{
"result" : {
"levels" : {
"AmendmentTable" : "Error",
"Application" : "Error",
"CancelOffer" : "Error",
"Collector" : "Error",
"CreateOffer" : "Error",
"DeferredCredits" : "Error",
"FeeVote" : "Error",
"InboundLedger" : "Error",
"JobQueue" : "Error",
"Ledger" : "Error",
"LedgerCleaner" : "Error",
"LedgerConsensus" : "Error",
"LedgerEntrySet" : "Error",
"LedgerMaster" : "Error",
"LedgerTiming" : "Error",
"LoadManager" : "Error",
"LoadMonitor" : "Error",
"NetworkOPs" : "Error",
"NodeObject" : "Error",
"OrderBookDB" : "Error",
"Overlay" : "Error",
"PathRequest" : "Debug",
"Payment" : "Error",
"Peer" : "Error",
"PeerFinder" : "Error",
"Protocol" : "Error",
"RPC" : "Error",
"RPCErr" : "Error",
"RPCHandler" : "Error",
"RPCManager" : "Error",
"Resolver" : "Error",
"Resource" : "Error",
"StreamCalc" : "Error",
"SHAMap" : "Error",
"SHAMapStore" : "Error",
"SNTPClient" : "Error",
"STAmount" : "Error",
"SerializedLedger" : "Error",
"Server" : "Error",
"SetAccount" : "Error",
"SetTrust" : "Error",
"TaggedCache" : "Error",
"TransactionAcquire" : "Error",
"TransactionEngine" : "Error",
"UVL" : "Error",
"UniqueNodeList" : "Error",
"Validations" : "Error",
"WALCheckpointer" : "Error",
"WebSocket" : "Trace",
"base" : "Error"
},
"status" : "success"
}
}
Responses follow the standard format. The response format depends on whether the request specified severity. If it is, the log level is changed and the successful result contains no additional fields.
Otherwise, the request contains the following fields:
Field |
Type | Description |
|---|---|---|
level |
Object | The current log level for each category. This category list is subject to change without notice. You can use the field name as the value of the partition request for this command. |
- Any common error type.
invalidParams- One or more fields were specified incorrectly, or one or more required fields are missing.
validation_create
validation_create command to generate the Streamd validator key. Similar to the wallet_propose command, this command does not make actual changes but only generates a set of appropriately formatted keys.
The validation_create method is an administrator command that cannot be run by unprivileged users.
Example of request format:
{
"id": 0,
"command": "validation_create",
"secret": "BAWL MAN JADE MOON DOVE GEM SON NOW HAD ADEN GLOW TIRE"
}
{
"method": "validation_create",
"params": [
{
"secret": "BAWL MAN JADE MOON DOVE GEM SON NOW HAD ADEN GLOW TIRE"
}
]
}
#Syntax: validation_create [secret] streamd validation_create "BAWL MAN JADE MOON DOVE GEM SON NOW HAD ADEN GLOW TIRE"The request contains the following parameters:
Field |
Type | Description |
|---|---|---|
secret |
String | (Optional) Use this value as a seed to generate credentials. The same secret always generates the same credentials. You can provide a seed in RFC-1751 format or in Stream's base58 format. If omitted, a random seed is generated. |
Note: The security of the validator depends on the entropy of your seed. Do not use secret values for practical business purposes unless generating strong randomness. Stream recommends that secret be omitted when generating new credentials for the first time.
An example of a successful response:
{
"result" : {
"status" : "success",
"validation_key" : "FAWN JAVA JADE HEAL VARY HER REEL SHAW GAIL ARCH BEN IRMA",
"validation_public_key" : "n9Mxf6qD4J55XeLSCEpqaePW4GjoCR5U1ZeGZGJUCNe3bQa4yQbG",
"validation_seed" : "ssZkdwURFMBXenJPbrpE14b6noJSu"
}
}
Loading: "/etc/streamd.cfg"
Connecting to 127.0.0.1:5005
{
"result" : {
"status" : "success",
"validation_key" : "FAWN JAVA JADE HEAL VARY HER REEL SHAW GAIL ARCH BEN IRMA",
"validation_public_key" : "n9Mxf6qD4J55XeLSCEpqaePW4GjoCR5U1ZeGZGJUCNe3bQa4yQbG",
"validation_seed" : "ssZkdwURFMBXenJPbrpE14b6noJSu"
}
}
Responses follow a standard format, with successful results containing the following fields:
Field |
Type | Description |
|---|---|---|
validation_key |
String | These keys for verifying credentials, in RFC-1751 format. |
validation_public_key |
String | The public key of these verification credentials, in Stream's base58 encoded string format. |
validation_seed |
String | The secret key for these verification credentials, in Stream's base58 encoded string format. |
- Any common error type.
badSeed- The request provided an invalid seed value. This usually means that the seed value appears to be a valid string in a different format, such as an account address or a verification public key.
logrotate
The logrotate command closes and reopens the log file. This is intended to aid log rotation on Linux file systems.
The logrotate method is an admin command that cannot be run by non-privileged users.
Example of request format:
{
"id": "lr1",
"command": "logrotate"
}streamd logrotate
The request does not contain parameters.
An example of a successful response:
200 OK
{
"result" : {
"message" : "The log file was closed and reopened.",
"status" : "success"
}
}
Loading: "/etc/streamd.cfg"
Connecting to 127.0.0.1:5005
{
"result" : {
"message" : "The log file was closed and reopened.",
"status" : "success"
}
}
Responses follow a standard format, with successful results containing the following fields:
Field | Type | Description |
|---|---|---|
message | String | When successful, include this message The log file was closed and reopened. |
Possible errors:
- Any common error type.
validation_seed
The validation_seed command temporarily sets the secret value used by streamd for sign verification. When the server is restarted, this value will be reset according to the configuration file.
This validation_seed request is an admin command that cannot be run by an unprivileged user!
Example of request format:
{
"id": "set_seed_1",
"command": "validation_seed",
"secret": "BAWL MAN JADE MOON DOVE GEM SON NOW HAD ADEN GLOW TIRE"
}#Syntax: validation_seed [secret] streamd validation_seed 'BAWL MAN JADE MOON DOVE GEM SON NOW HAD ADEN GLOW TIRE'
The request contains the following parameters:
Field | Type | Description |
|---|---|---|
secret | String | (Optional) If present, use this value as the secret value for the authentication key pair. Valid formats include base58, RFC-1751 or as a password. If omitted, authentication to the network is prohibited. |
An example of a successful response:
200 OK
{
"result" : {
"status" : "success",
"validation_key" : "BAWL MAN JADE MOON DOVE GEM SON NOW HAD ADEN GLOW TIRE",
"validation_public_key" : "n9Jx6RS6zSgqsgnuWJifNA9EqgjTKAywqYNReK5NRd1yLBbfC3ng",
"validation_seed" : "snjJkyBGogTem5dFGbcRaThKq2Rt3"
}
}Loading: "/etc/streamd.cfg"
Connecting to 127.0.0.1:5005
{
"result" : {
"status" : "success",
"validation_key" : "BAWL MAN JADE MOON DOVE GEM SON NOW HAD ADEN GLOW TIRE",
"validation_public_key" : "n9Jx6RS6zSgqsgnuWJifNA9EqgjTKAywqYNReK5NRd1yLBbfC3ng",
"validation_seed" : "snjJkyBGogTem5dFGbcRaThKq2Rt3"
}
}Responses follow a standard format, with successful results containing the following fields:
Field | Type | Description |
|---|---|---|
validation_key | String | (Omitted if proposed to be disabled) Key for these verification credentials, in RFC-1751 format. |
validation_public_key | String | (Omitted if disabled is recommended) The public key for these verification credentials, in Stream's base58 encoded string format. |
validation_seed | String | (Omitted if disabled by proposal) The secret key for these verification credentials, in Stream's base58 encoded string format. |
Possible errors:
- Any common error type.
badSeed- The request provided an invalid secret value. This usually means that the secret value appears to be a valid string in a different format, such as an account address or a verification public key.
peers
peers command returns streamd a list of all other servers currently connected to this server, including information about their connection and synchronization status.
The peers request is an administrative command that cannot be run by an unprivileged user!
Example of request format:
{
"id": 2,
"command": "peers"
}
streamd peersThe request contains no other parameters. An example of a successful response:
{
"id": 2,
"status": "success",
"type": "response",
"result": {
"cluster": {},
"peers": [
{
"address": "1.1.1.1:51235",
"complete_ledgers": "18828845 - 18828973",
"latency": 99,
"ledger": "50A2577CE6EB8A92847C443BDA45F5C5F0A22B9C6F4B47DBA0C12BDA75001D01",
"load": 60,
"public_key": "n9LDBRoqPYY7RdkNXbX1dqZXVtUKcSqzs2CZPhTH7ymA9X7Xzmpj",
"uptime": 99625,
"version": "streamd-0.30.1-rc4"
}
]
}
}
{
"result" : {
"cluster" : {},
"peers" : [
{
"address" : "1.1.1.1:51235",
"complete_ledgers" : "18828830 - 18828957",
"latency" : 137,
"ledger" : "9447480E351221123B1A454356435A66C188D9794B0197A060637E19F074B421",
"load" : 54,
"public_key" : "n9LDBRoqPYY7RdkNXbX1dqZXVtUKcSqzs2CZPhTH7ymA9X7Xzmpj",
"uptime" : 99566,
"version" : "streamd-0.30.1-rc4"
}
],
"status" : "success"
}
}
Loading: "/etc/streamd.cfg"
Connecting to 127.0.0.1:5005
{
"result" : {
"cluster" : {},
"peers" : [
{
"address" : "5.1.1.1:51235",
"complete_ledgers" : "18850253 - 18851277",
"latency" : 63,
"ledger" : "592C723DDBB1C5119F0D8288894060C83C8C2975A061D7C9971427D6798098F5",
"load" : 36,
"public_key" : "n9MT5EjnV912KGuBUqPs4tpdhzMPGcnDBrTuWkD9sWQHJ1kDcUcz",
"uptime" : 51,
"version" : "streamd-0.30.1"
}
],
"status" : "success"
}
}
The response follows a standard format, with successful results containing a JSON object with the following fields:
Field |
Type | Description |
|---|---|---|
cluster |
Object | streamdIf configured as a cluster, a summary of other servers in the same cluster. |
peers |
Array | Array of sibling objects. |
cluster object is the public key of the identity key pair for this streamd server. (This is the same value returned by the server pubkey_node in the server_info command.) The contents of this field are an object containing the following fields:
Field |
Type | Description |
|---|---|---|
tag |
String | The display name of this cluster member as defined in the configuration file. |
fee |
Number | (can be omitted) The load multiplier applied to transaction costs for this cluster member |
age |
Number | The number of seconds since the last cluster report for this cluster member. |
peers array is a peer object with the following fields:
Field |
Type | Description |
|---|---|---|
address |
String | The IP address and port to which the peer is connected |
cluster |
Boolean | (can be omitted) if true the current server and the peer server are part of the same streamd cluster. |
name |
String | (can be omitted) If the peer is part of the same cluster, this is the display name of this server as defined in this configuration file. |
complete_ledgers |
String | A range expression indicating the sequence number of the ledger version available to the peer streamd |
inbound |
Boolean | (can be omitted) If true, the peer is connecting to the local server. |
latency |
Number | Network latency of the node in milliseconds |
ledger |
String | Hash of the node’s most recently closed ledger |
load |
Number | Measures the load placed on the local server by the node server. Higher numbers represent more load. (The units of load measurement are not formally defined.) |
protocol |
String | (May be ignored) The protocol version the node is using, if different from the local server. |
public_key |
String | (can be omitted) The public key that can be used to verify the integrity of the node's messages. This is different from the key used for verification, but it follows the same format. |
sanity |
String | (can be omitted) Whether this peer follows the same rules and ledger order as the current server. The value insane may indicate that the peer is part of a parallel network. The value unknown indicates that the current server is not sure whether the peer is compatible. |
status |
String | (May be omitted) Latest status message from the node. May be connecting, connected, monitoring, validating, or shutting. |
uptime |
Number | The number of seconds your streamd server has been continuously connected to this peer |
version |
string | (may be omitted) streamdThe version number of the node server |
- Any common error type.
print command returns the current status of various internal subsystems, including peers, category cleaners, and resource managers.
The print request is an administrative command that cannot be run by an unprivileged user!
Example of request format:
{
"id": "print_req_1",
"command": "print"
}
streamd printThe request contains no parameters. An example of a successful response:
Loading: "/etc/streamd.cfg"
Connecting to 127.0.0.1:5005
{
"result" : {
"app" : {
"ledgercleaner" : {
"status" : "idle"
},
"peers" : {
"peerfinder" : {
"bootcache" : {
"entries" : 109
},
"config" : {
"auto_connect" : "true",
"features" : "",
"max_peers" : 21,
"out_peers" : 10,
"port" : 51235,
"want_incoming" : "true"
},
"counts" : {
"accept" : 0,
"close" : 0,
"cluster" : "0",
"connect" : 0,
"fixed" : "0",
"in" : "0/11",
"out" : "10/10",
"total" : "10"
},
"fixed" : 0,
"livecache" : {
"entries" : [
{
"address" : "1.1.1.1:51235",
"expires" : "30000000000 nanoseconds",
"hops" : 2
}
],
"hist" : "0, 10, 74, 10, 0, 0, 0, 0",
"size" : "94"
},
"peers" : [
{
"local_address" : "10.1.10.78:48923",
"remote_address" : "2.2.2.3:51235",
"state" : "active"
}
]
}
},
"resource" : {
"admin" : [
{
"balance" : 0,
"count" : 1,
"name" : "\"127.0.0.1\""
}
],
"inactive" : [],
"inbound" : [],
"outbound" : [
{
"balance" : 23,
"count" : 1,
"name" : "1.1.1.1:51235"
}
]
},
"server" : {
"active" : "2",
"hist" : "16",
"history" : [
{
"bytes_in" : "214",
"bytes_out" : "11688",
"elapsed" : "0 seconds",
"id" : "16",
"requests" : 1,
"when" : "2017-Jun-16 16:33:50"
}
]
},
"validators" : {}
},
"status" : "success"
}
}
Responses follow a standard format. Other fields in the result depend on the internal state of the streamd server. The results of this order are subject to change without notice.
Possible errors:
- Any common error type.
Utility Methods
streamdThe server also provides some commands purely for convenience.
ping
ping command returns a confirmation so that clients can test connection status and latency.
Example of request format:
{
"id": 1,
"command": "ping"
}
{
"method": "ping",
"params": [
{}
]
}
#Syntax: ping streamd pingThe request contains no parameters. An example of a successful response:
{
"id": 1,
"result": {},
"status": "success",
"type": "response"
}
200 OK
{
"result": {
"status": "success"
}
}
Responses follow a standard format and successful results contain no fields. Clients can measure the round trip time from request to response as latency.
Possible errors
- Any common error type.
random
The random command provides a random number that is used as a source of entropy for client-generated random numbers.
Example of request format:
{
"id": 1,
"command": "random"
}{
"method": "random",
"params": [
{}
]
}#Syntax: random streamd random
The request does not contain parameters.
An example of a successful response:
{
"id": 1,
"result": {
"random": "02869CBC0E17C3039944B24FD1932E65B8E0A4B99F80CBCDC39AE79A2356CEF9"
},
"status": "success",
"type": "response"
}200 OK
{
"result": {
"random": "02869CBC0E17C3039944B24FD1932E65B8E0A4B99F80CBCDC39AE79A2356CEF9"
},
"status": "success"
}Responses follow a standard format, with successful results containing the following fields:
Field | Type | Description |
|---|---|---|
random | String | Random 256-bit hexadecimal value. |
Possible errors:
- Any common error type.
internal- Some internal error occurred, possibly related to the random number generator.
json
The json method is a proxy for running other commands and accepts the parameters of that command as JSON values. It is exclusive to the Commandline client and is used when the command line syntax for specifying parameters is insufficient or undesirable.
Example of request format:
# Syntax: json method json_stanza
streamd -q json ledger_closed '{}'An example of a successful response:
{
"result" : {
"ledger_hash" : "8047C3ECF1FA66326C1E57694F6814A1C32867C04D3D68A851367EE2F89BBEF3",
"ledger_index" : 390308,
"status" : "success"
}
}Responses follow a standard format, regardless of which fields are appropriate for the type of command being executed.
connect
connect command forces the streamd server to connect to a specific peer streamd server.
The connect request is an administrative command that cannot be run by an unprivileged user!
Example of request format:
{
"command": "connect",
"ip": "192.168.145.88",
"port": 51235
}
{
"method": "connect",
"params": [
{
"ip": "192.168.145.88",
"port": 51235
}
]
}
#Syntax: connect ip [port] streamd connect 192.168.145.88 51235The request contains the following parameters:
Field |
Type | Description |
|---|---|---|
ip |
String | IP address of the server to connect |
port |
Number | (Optional) The port number to use when connecting. The default is 6561. |
{
"result" : {
"message" : "connecting",
"status" : "success"
}
}
Loading: "/etc/streamd.cfg"
Connecting to 127.0.0.1:5005
{
"result" : {
"message" : "connecting",
"status" : "success"
}
}
Responses follow a standard format, with successful results containing the following fields:
Field |
Type | Description |
|---|---|---|
message |
String | Value connecting if the command was successful. |
- Any common error type.
invalidParams- One or more fields were specified incorrectly, or one or more required fields are missing.- Unable to connect in standalone mode - Network-related commands are disabled in standalone mode.
stop
Gracefully shut down the server.
This stop request is an administrative command that cannot be run by an unprivileged user!
Example of request format:
{
"id": 0,
"command": "stop"
}{
"method": "stop",
"params": [
{}
]
}streamd stop
The request does not contain parameters.
An example of a successful response:
{
"result" : {
"message" : "stream server stopping",
"status" : "success"
}
}Loading: "/etc/streamd.cfg"
Connecting to 127.0.0.1:5005
{
"result" : {
"message" : "stream server stopping",
"status" : "success"
}
}Responses follow a standard format, with successful results containing the following fields:
Field | Type | Description |
|---|---|---|
message | String | stream server stopping succeeded. |
Possible errors:
- Any common error type.
