Skip to content

Wallet RPC

daniel dabek edited this page Dec 8, 2021 · 1 revision

Safex Wallet RPC Documentation

This is list of safex-wallet-rpc calls. Each item has input and output explained, with examples of each. The app safex-wallet-rpc is standalone program.

All safex-wallet-rpc methods use the same JSON RPC interface.

IP=127.0.0.1
PORT=17402
METHOD="make_integrated_address"
PARAMS="{\"payment_id\":\"1234567890123456789012345678900012345678901234567890123456789000\"}"
curl \
    -X POST http://$IP:$PORT/json_rpc \
    -d '{"jsonrpc":"2.0","id":"0","method":"'$METHOD'","params":'"$PARAMS"'}' \
    -H 'Content-Type: application/json'

If the safex-wallet-rp was executed with --rpc-login argument as username:password, then follow this example:


IP=127.0.0.1
PORT=17402
METHOD="make_integrated_address"
PARAMS="{\"payment_id\":\"1234567890123456789012345678900012345678901234567890123456789000\"}"
curl \
    -u username:password --digest \
    -X POST http://$IP:$PORT/json_rpc \
    -d '{"jsonrpc":"2.0","id":"0","method":"'$METHOD'","params":'"$PARAMS"'}' \
    -H 'Content-Type: application/json'

Note: Safex blockchain has two currency allowed within. Safex Cash (Safex) and Safex Token (SFT). Safex Cash is divisible up to 10 decimal places. Every value is rendered in atomic units. Atomic unit refer to smallest fraction of 1 Safex coin.

NOTE2: Safex Tokens are not divisible but value is still expressed in atomic units.

Index of JSON RPC Methods:

refresh

Refresh a wallet after openning.

Alias: None.

Inputs:

  • start_height - unsigned int; (Optional) The block height from which to start refreshing.

Outputs:

  • blocks_fetched - unsigned int; Number of new blocks scanned.

Example:

$ curl http://localhost:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"refresh","params":{"start_height":50}}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "blocks_fetched": 1700,
  }
}

get_balance

Return the wallet's balance.

Alias: getbalance.

Inputs:

  • account_index - unsigned int; Return balance for this account.
  • address_indices - array of unsigned int; (Optional) Return balance detail for those subaddresses.

Outputs:

  • balance - unsigned int; The total balance of the current safex-wallet-rpc in session.
  • unlocked_balance - unsigned int; Unlocked funds are those funds that are sufficiently deep enough in the Safex blockchain to be considered safe to spend.
  • multisig_import_needed - boolean; True if importing multisig data is needed for returning a correct balance.
  • per_subaddress - array of subaddress information; Balance information for each subaddress in an account.
    • address_index - unsigned int; Index of the subaddress in the account.
    • address - string; Address at this index. Base58 representation of the public keys.
    • balance - unsigned int; Balance for the subaddress (locked or unlocked).
    • unlocked_balance - unsigned int; Unlocked balance for the subaddress.
    • label - string; Label for the subaddress.
    • num_unspent_outputs - unsigned int; Number of unspent outputs available for the subaddress.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_balance","params":{"account_index":0,"address_indices":[0,1]}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "balance": 2149284707144814,
        "multisig_import_needed": false,
        "per_subaddress": [
            {
                "address": "Safex5ztEZcNUScmGWJYEsPHaBPXbenyXaigRJrvrnEX6CUQjuEkgcgBomBp3cseeNLurzSzdzcThDdC7xFjPFuU2PjNFLfJH6J1E",
                "address_index": 0,
                "balance": 2149284707144814,
                "label": "Primary account",
                "num_unspent_outputs": 4383,
                "num_unspent_token_outputs": 1272,
                "token_balance": 304780000000000,
                "unlocked_balance": 2149284707144814,
                "unlocked_token_balance": 304780000000000
            }
        ],
        "token_balance": 304780000000000,
        "unlocked_balance": 2149284707144814,
        "unlocked_token_balance": 304780000000000
    }
}

get_address

Return the wallet's addresses for an account. Optionally filter for specific set of subaddresses.

NOTE: Subaddresses are currently not supported in Safex blockchain (v2).

Alias: getaddress.

Inputs:

  • account_index - unsigned int; Return subaddresses for this account.
  • address_index - array of unsigned int; (Optional) List of subaddresses to return from an account.

Outputs:

  • address - string; The 95-character hex address string of the safex-wallet-rpc in session.
  • addresses array of addresses informations
    • address string; The 95-character hex (sub)address string.
    • label string; Label of the (sub)address
    • address_index unsigned int; index of the subaddress
    • used boolean; states if the (sub)address has already received funds

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_address","params":{"account_index":0,"address_index":[0,1,4]}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "address": "Safex5ztEZcNUScmGWJYEsPHaBPXbenyXaigRJrvrnEX6CUQjuEkgcgBomBp3cseeNLurzSzdzcThDdC7xFjPFuU2PjNFLfJH6J1E",
        "addresses": [
            {
                "address": "Safex5ztEZcNUScmGWJYEsPHaBPXbenyXaigRJrvrnEX6CUQjuEkgcgBomBp3cseeNLurzSzdzcThDdC7xFjPFuU2PjNFLfJH6J1E",
                "address_index": 0,
                "label": "Primary account",
                "used": true
            },
            {
                "address": "SafextsyrrJLcHfQf2AGg2BwAVYKFJwJvm2KE3CT9RzY45M1aiaLs52rbMLJMs8hhcJMh8V7auFHVXR6GjcKxf8gSzcHE6oauQq6S31",
                "address_index": 1,
                "label": "",
                "used": false
            },
            {
                "address": "SafextsyrhUhEUR4dM3o7Pn97nEFiiGNfbcXiekBzMD8Qp7hFcJX2VRjkGPdFmoX9VS8KJ71dasMTiRjbQhYabqKS8dpaYXkmT6BM4T",
                "address_index": 4,
                "label": "",
                "used": false
            }
        ]
    }
}

create_address

Create a new address for an account. Optionally, label the new address.

Alias: None.

Inputs:

  • account_index - unsigned int; Create a new address for this account.
  • label - string; (Optional) Label for the new address.

Outputs:

  • address - string; Newly created address. Base58 representation of the public keys.
  • address_index - unsigned int; Index of the new address under the input account.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"create_address","params":{"account_index":0,"label":"new-sub"}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "address": "SafextsyrprLt5sRkU4Y1gXgAfo9ijSkmZ3M6nmKc8dFRqFg1GbRsNQW3MGPiBSYRrhDE5UqDGzGVkKe2GNJVeuf9E4Rurfj5UzPM54",
        "address_index": 3
    }
}

label_address

Label an address.

Alias: None.

Inputs:

  • index - subaddress index; JSON Object containing the major & minor address index:
    • major - unsigned int; Account index for the subaddress.
    • minor - unsigned int; Index of the subaddress in the account.
  • label - string; Label for the address.

Outputs: None.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"label_address","params":{"index":{"major":0,"minor":3},"label":"myLabel"}}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
  }
}

get_accounts

Get all accounts for a wallet. Optionally filter accounts by tag.

Alias: None.

Inputs:

  • tag - string; (Optional) Tag for filtering accounts.

Outputs:

  • subaddress_accounts - array of subaddress account information:
    • account_index - unsigned int; Index of the account.
    • balance - unsigned int; Balance of the account (locked or unlocked).
    • base_address - string; Base64 representation of the first subaddress in the account.
    • label - string; (Optional) Label of the account.
    • tag - string; (Optional) Tag for filtering accounts.
    • unlocked_balance - unsigned int; Unlocked balance for the account.
  • total_balance - unsigned int; Total balance of the selected accounts (locked or unlocked).
  • total_unlocked_balance - unsigned int; Total unlocked balance of the selected accounts.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_accounts","params":{"tag":"myTag"}}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "subaddress_accounts": [{
      "account_index": 0,
      "balance": 157663195572433688,
      "base_address": "55LTR8KniP4LQGJSPtbYDacR7dz8RBFnsfAKMaMuwUNYX6aQbBcovzDPyrQF9KXF9tVU6Xk3K8no1BywnJX6GvZX8yJsXvt",
      "label": "Primary account",
      "tag": "myTag",
      "unlocked_balance": 157443303037455077
    },{
      "account_index": 1,
      "balance": 0,
      "base_address": "77Vx9cs1VPicFndSVgYUvTdLCJEZw9h81hXLMYsjBCXSJfUehLa9TDW3Ffh45SQa7xb6dUs18mpNxfUhQGqfwXPSMrvKhVp",
      "label": "Secondary account",
      "tag": "myTag",
      "unlocked_balance": 0
    }],
    "total_balance": 157663195572433688,
    "total_unlocked_balance": 157443303037455077
  }
}

create_account

Create a new account with an optional label.

Alias: None.

Inputs:

  • label - string; (Optional) Label for the account.

Outputs:

  • account_index - unsigned int; Index of the new account.
  • address - string; Address for this account. Base58 representation of the public keys.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"create_account","params":{"label":"Secondary account"}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "account_index": 1,
        "address": "Safextsyqq9qC6TDVq1CXKEvccGmbLYJZq7JWZJM6VbePgSAsGPFGnkwSjmfp5WUN5KmBfFQtuSCbJF9CSp2S96Y7hdu6xujzePg71G"
    }
}

label_account

Label an account.

Alias: None.

Inputs:

  • account_index - unsigned int; Apply label to account at this index.
  • label - string; Label for the account.

Outputs: None.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"label_account","params":{"account_index":0,"label":"Primary account"}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {}
}

get_account_tags

Get a list of user-defined account tags.

Alias: None.

Inputs: None.

Outputs:

  • account_tags - array of account tag information:
    • tag - string; Filter tag.
    • label - string; Label for the tag.
    • accounts - array of int; List of tagged account indices.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_account_tags","params":""}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "account_tags": [{
      "accounts": [0],
      "label": "Test tag",
      "tag": "myTag"
    }]
  }
}

tag_accounts

Apply a filtering tag to a list of accounts.

Alias: None.

Inputs:

  • tag - string; Tag for the accounts.
  • accounts - array of unsigned int; Tag this list of accounts.

Outputs: None.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"tag_accounts","params":{"tag":"myTag","accounts":[0,1]}}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
  }
}

untag_accounts

Remove filtering tag from a list of accounts.

Alias: None.

Inputs:

  • accounts - array of unsigned int; Remove tag from this list of accounts.

Outputs: None.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"untag_accounts","params":{"accounts":[1]}}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
  }
}

set_account_tag_description

Set description for an account tag.

Alias: None.

Inputs:

  • tag - string; Set a description for this tag.
  • description - string; Description for the tag.

Outputs: None.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"set_account_tag_description","params":{"tag":"myTag","description":"Test tag"}}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
  }
}

get_height

Returns the wallet's current block height.

Alias: getheight.

Inputs: None.

Outputs:

  • height - unsigned int; The current safex-wallet-rpc's blockchain height. If the wallet has been offline for a long time, it may need to catch up with the daemon.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_height"}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "height": 68776
    }
}

transfer

Send Safex Cash to a number of recipients.

Alias: None.

Inputs:

  • destinations - array of destinations to receive Safex:
    • amount - unsigned int; Amount to send to each destination, in atomic units.
    • address - string; Destination public address.
  • account_index - unsigned int; (Optional) Transfer from this account index. (Defaults to 0)
  • subaddr_indices - array of unsigned int; (Optional) Transfer from this set of subaddresses. (Defaults to 0)
  • priority - unsigned int; Set a priority for the transaction. Accepted Values are: 0-3 for: default, unimportant, normal, elevated, priority.
  • mixin - unsigned int; Number of outputs from the blockchain to mix with (0 means no mixing).
  • ring_size - unsigned int; Number of outputs to mix in the transaction (this output + N decoys from the blockchain).
  • unlock_time - unsigned int; Number of blocks before the safex coins can be spent (0 to not add a lock).
  • payment_id - string; (Optional) Random 32-byte/64-character hex string to identify a transaction.
  • get_tx_key - boolean; (Optional) Return the transaction key after sending.
  • do_not_relay - boolean; (Optional) If true, the newly created transaction will not be relayed to the safex network. (Defaults to false)
  • get_tx_hex - boolean; Return the transaction as hex string after sending (Defaults to false)
  • get_tx_metadata - boolean; Return the metadata needed to relay the transaction. (Defaults to false)

Outputs:

  • amount - Amount transferred for the transaction.
  • fee - Integer value of the fee charged for the txn.
  • multisig_txset - Set of multisig transactions in the process of being signed (empty for non-multisig).
  • tx_blob - Raw transaction represented as hex string, if get_tx_hex is true.
  • tx_hash - String for the publically searchable transaction hash.
  • tx_key - String for the transaction key if get_tx_key is true, otherwise, blank string.
  • tx_metadata - Set of transaction metadata needed to relay this transfer later, if get_tx_metadata is true.
  • unsigned_txset - String. Set of unsigned tx for cold-signing purposes.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"transfer","params":{
"destinations":[{"amount":100000000000,"address":"SafextzWm72eF3ViP6tk3L14KqmRc59rPg2MzSfSh8Y8JnHfKXQ2pgbM38iqZZfLkY13FdpQJxdw5WXXJDw1iPh8b3cDNjU7ha5yu"}],"account_index":0,"priority":0,"ring_size":7,"get_tx_key": true}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "amount": 100000000000,
        "fee": 300400050,
        "multisig_txset": "",
        "tx_blob": "",
        "tx_hash": "2aff75d5165d869db109288f11fc617736d60b008d3d3f91e12af37c338c043f",
        "tx_key": "145123f2575db42cb32165664d6e9ca73e099a71ccf8f4f317e193ab620cd605",
        "tx_metadata": ""
    }
}

transfer_token

Send Safex Token to a number of recipients.

Alias: None.

Inputs:

  • destinations - array of destinations to receive SFT:
    • amount - unsigned int; Amount to send to each destination, in atomic units.
    • address - string; Destination public address.
  • account_index - unsigned int; (Optional) Transfer from this account index. (Defaults to 0)
  • subaddr_indices - array of unsigned int; (Optional) Transfer from this set of subaddresses. (Defaults to 0)
  • priority - unsigned int; Set a priority for the transaction. Accepted Values are: 0-3 for: default, unimportant, normal, elevated, priority.
  • mixin - unsigned int; Number of outputs from the blockchain to mix with (0 means no mixing).
  • ring_size - unsigned int; Number of outputs to mix in the transaction (this output + N decoys from the blockchain).
  • unlock_time - unsigned int; Number of blocks before the safex coins can be spent (0 to not add a lock).
  • payment_id - string; (Optional) Random 32-byte/64-character hex string to identify a transaction.
  • get_tx_key - boolean; (Optional) Return the transaction key after sending.
  • do_not_relay - boolean; (Optional) If true, the newly created transaction will not be relayed to the safex network. (Defaults to false)
  • get_tx_hex - boolean; Return the transaction as hex string after sending (Defaults to false)
  • get_tx_metadata - boolean; Return the metadata needed to relay the transaction. (Defaults to false)

Outputs:

  • token_amount - Amount transferred for the transaction.
  • fee - Integer value of the fee charged for the txn.
  • multisig_txset - Set of multisig transactions in the process of being signed (empty for non-multisig).
  • tx_blob - Raw transaction represented as hex string, if get_tx_hex is true.
  • tx_hash - String for the publically searchable transaction hash.
  • tx_key - String for the transaction key if get_tx_key is true, otherwise, blank string.
  • tx_metadata - Set of transaction metadata needed to relay this transfer later, if get_tx_metadata is true.
  • unsigned_txset - String. Set of unsigned tx for cold-signing purposes.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"transfer_token","params":{
"destinations":[{"amount":20000000000,"address":"SafextzWm72eF3ViP6tk3L14KqmRc59rPg2MzSfSh8Y8JnHfKXQ2pgbM38iqZZfLkY13FdpQJxdw5WXXJDw1iPh8b3cDNjU7ha5yu"}],"account_index":0,"priority":0,"ring_size":7,"get_tx_key": true}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "fee": 200000000,
        "multisig_txset": "",
        "token_amount": 20000000000,
        "tx_blob": "",
        "tx_hash": "f1ffde76add463360f474dbce7ae7a69d90b732d5a7e6ea663a289087048bb2e",
        "tx_key": "f101c2065ee7401692a670a3cd06fbd99b92d640028b295496dfa209ee1b4904",
        "tx_metadata": ""
    }
}

transfer_split

Same as transfer, but can split into more than one tx if necessary.

Alias: None.

Inputs:

  • destinations - array of destinations to receive Safex:
    • amount - unsigned int; Amount to send to each destination, in atomic units.
    • address - string; Destination public address.
  • account_index - unsigned int; (Optional) Transfer from this account index. (Defaults to 0)
  • subaddr_indices - array of unsigned int; (Optional) Transfer from this set of subaddresses. (Defaults to 0)
  • mixin - unsigned int; Number of outputs from the blockchain to mix with (0 means no mixing).
  • ring_size - unsigned int; Sets ringsize to n (mixin + 1).
  • unlock_time - unsigned int; Number of blocks before the safex coins can be spent (0 to not add a lock).
  • payment_id - string; (Optional) Random 32-byte/64-character hex string to identify a transaction.
  • get_tx_keys - boolean; (Optional) Return the transaction keys after sending.
  • priority - unsigned int; Set a priority for the transactions. Accepted Values are: 0-3 for: default, unimportant, normal, elevated, priority.
  • do_not_relay - boolean; (Optional) If true, the newly created transaction will not be relayed to the safex network. (Defaults to false)
  • get_tx_hex - boolean; Return the transactions as hex string after sending
  • new_algorithm - boolean; True to use the new transaction construction algorithm, defaults to false.
  • get_tx_metadata - boolean; Return list of transaction metadata needed to relay the transfer later.

Outputs:

  • tx_hash_list - array of: string. The tx hashes of every transaction.
  • tx_key_list - array of: string. The transaction keys for every transaction.
  • amount_list - array of: integer. The amount transferred for every transaction.
  • fee_list - array of: integer. The amount of fees paid for every transaction.
  • tx_blob_list - array of: string. The tx as hex string for every transaction.
  • tx_metadata_list - array of: string. List of transaction metadata needed to relay the transactions later.
  • multisig_txset - string. The set of signing keys used in a multisig transaction (empty for non-multisig).
  • unsigned_txset - string. Set of unsigned tx for cold-signing purposes.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"transfer_split","params":{
"destinations":[{"amount":100000000000,"address":"SafextzWm72eF3ViP6tk3L14KqmRc59rPg2MzSfSh8Y8JnHfKXQ2pgbM38iqZZfLkY13FdpQJxdw5WXXJDw1iPh8b3cDNjU7ha5yu"}],"account_index":0, "subaddr_indices":[1],"priority":0,"ring_size":7,"get_tx_key": true}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "amount_list": [
            100000000000
        ],
        "fee_list": [
            200000000
        ],
        "multisig_txset": "",
        "tx_hash_list": [
            "8095b1fd410796e3c517330bed05421a71d161e17e52e12d19bb25ad8e94c0f4"
        ]
    }
}

transfer_token_split

Same as transfer, but can split into more than one tx if necessary.

Alias: None.

Inputs:

  • destinations - array of destinations to receive SFT:
    • amount - unsigned int; Amount to send to each destination, in atomic units.
    • address - string; Destination public address.
  • account_index - unsigned int; (Optional) Transfer from this account index. (Defaults to 0)
  • subaddr_indices - array of unsigned int; (Optional) Transfer from this set of subaddresses. (Defaults to 0)
  • mixin - unsigned int; Number of outputs from the blockchain to mix with (0 means no mixing).
  • ring_size - unsigned int; Sets ringsize to n (mixin + 1).
  • unlock_time - unsigned int; Number of blocks before the safex coins can be spent (0 to not add a lock).
  • payment_id - string; (Optional) Random 32-byte/64-character hex string to identify a transaction.
  • get_tx_keys - boolean; (Optional) Return the transaction keys after sending.
  • priority - unsigned int; Set a priority for the transactions. Accepted Values are: 0-3 for: default, unimportant, normal, elevated, priority.
  • do_not_relay - boolean; (Optional) If true, the newly created transaction will not be relayed to the safex network. (Defaults to false)
  • get_tx_hex - boolean; Return the transactions as hex string after sending
  • new_algorithm - boolean; True to use the new transaction construction algorithm, defaults to false.
  • get_tx_metadata - boolean; Return list of transaction metadata needed to relay the transfer later.

Outputs:

  • tx_hash_list - array of: string. The tx hashes of every transaction.
  • tx_key_list - array of: string. The transaction keys for every transaction.
  • token_amount_list - array of: integer. The amount transferred for every transaction.
  • fee_list - array of: integer. The amount of fees paid for every transaction.
  • tx_blob_list - array of: string. The tx as hex string for every transaction.
  • tx_metadata_list - array of: string. List of transaction metadata needed to relay the transactions later.
  • multisig_txset - string. The set of signing keys used in a multisig transaction (empty for non-multisig).
  • unsigned_txset - string. Set of unsigned tx for cold-signing purposes.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"transfer_token_split","params":{
"destinations":[{"amount":100000000000,"address":"SafextzWm72eF3ViP6tk3L14KqmRc59rPg2MzSfSh8Y8JnHfKXQ2pgbM38iqZZfLkY13FdpQJxdw5WXXJDw1iPh8b3cDNjU7ha5yu"}],"account_index":0, "priority":0,"ring_size":7,"get_tx_key": true}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "fee_list": [
            405009016
        ],
        "multisig_txset": "",
        "token_amount_list": [
            10000000000
        ],
        "tx_hash_list": [
            "c6f58e54f787f7ac8d05600cea3c5045731ba3c0ba68f38d455407ebf1841151"
        ]
    }
}

sweep_dust

Send all dust outputs back to the wallet's, to make them easier to spend (and mix).

Alias: sweep_unmixable.

Inputs:

  • get_tx_keys - boolean; (Optional) Return the transaction keys after sending.
  • do_not_relay - boolean; (Optional) If true, the newly created transaction will not be relayed to the safex network. (Defaults to false)
  • get_tx_hex - boolean; (Optional) Return the transactions as hex string after sending. (Defaults to false)
  • get_tx_metadata - boolean; (Optional) Return list of transaction metadata needed to relay the transfer later. (Defaults to false)

Outputs:

  • tx_hash_list - array of: string. The tx hashes of every transaction.
  • tx_key_list - array of: string. The transaction keys for every transaction.
  • amount_list - array of: integer. The amount transferred for every transaction.
  • fee_list - array of: integer. The amount of fees paid for every transaction.
  • tx_blob_list - array of: string. The tx as hex string for every transaction.
  • tx_metadata_list - array of: string. List of transaction metadata needed to relay the transactions later.
  • multisig_txset - string. The set of signing keys used in a multisig transaction (empty for non-multisig).
  • unsigned_txset - string. Set of unsigned tx for cold-signing purposes.

Example (In this example, sweep_dust returns nothing because there are no funds to sweep):

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"sweep_dust","params":{"get_tx_keys":true}}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "multisig_txset": "",
    "unsigned_txset": ""
  }
}

sweep_all

Send all unlocked balance to an address.

Alias: None.

Inputs:

  • address - string; Destination public address.
  • account_index - unsigned int; Sweep transactions from this account.
  • subaddr_indices - array of unsigned int; (Optional) Sweep from this set of subaddresses in the account.
  • priority - unsigned int; (Optional) Priority for sending the sweep transfer, partially determines fee.
  • mixin - unsigned int; Number of outputs from the blockchain to mix with (0 means no mixing).
  • ring_size - unsigned int; Sets ringsize to n (mixin + 1).
  • unlock_time - unsigned int; Number of blocks before the safex coins can be spent (0 to not add a lock).
  • payment_id - string; (Optional) Random 32-byte/64-character hex string to identify a transaction.
  • get_tx_keys - boolean; (Optional) Return the transaction keys after sending.
  • below_amount - unsigned int; (Optional) Include outputs below this amount.
  • do_not_relay - boolean; (Optional) If true, do not relay this sweep transfer. (Defaults to false)
  • get_tx_hex - boolean; (Optional) return the transactions as hex encoded string. (Defaults to false)
  • get_tx_metadata - boolean; (Optional) return the transaction metadata as a string. (Defaults to false)

Outputs:

  • tx_hash_list - array of: string. The tx hashes of every transaction.
  • tx_key_list - array of: string. The transaction keys for every transaction.
  • amount_list - array of: integer. The amount transferred for every transaction.
  • fee_list - array of: integer. The amount of fees paid for every transaction.
  • tx_blob_list - array of: string. The tx as hex string for every transaction.
  • tx_metadata_list - array of: string. List of transaction metadata needed to relay the transactions later.
  • multisig_txset - string. The set of signing keys used in a multisig transaction (empty for non-multisig).
  • unsigned_txset - string. Set of unsigned tx for cold-signing purposes.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"sweep_all","params":{"address":"Safex5ztEZcNUScmGWJYEsPHaBPXbenyXaigRJrvrnEX6CUQjuEkgcgBomBp3cseeNLurzSzdzcThDdC7xFjPFuU2PjNFLfJH6J1E","ring_size":7,"unlock_time":0,"get_tx_keys":true}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "amount_list": [
            99900000000
        ],
        "fee_list": [
            100000000
        ],
        "multisig_txset": "",
        "tx_hash_list": [
            "c72376ff6ad2a2b336d233d9b2dfcfea2aa9bc1d3af0e29f43005acf6862d9a2"
        ],
        "tx_key_list": [
            "fabc53fecac3052f68c378093e9f087035f9e09c938132ecea46f48a0d971c0c"
        ]
    }
}

sweep_single

Send all of a specific unlocked output to an address.

Alias: None.

Inputs:

  • address - string; Destination public address.
  • account_index - unsigned int; Sweep transactions from this account.
  • subaddr_indices - array of unsigned int; (Optional) Sweep from this set of subaddresses in the account.
  • priority - unsigned int; (Optional) Priority for sending the sweep transfer, partially determines fee.
  • mixin - unsigned int; Number of outputs from the blockchain to mix with (0 means no mixing).
  • ring_size - unsigned int; Sets ringsize to n (mixin + 1).
  • unlock_time - unsigned int; Number of blocks before the safex can be spent (0 to not add a lock).
  • payment_id - string; (Optional) Random 32-byte/64-character hex string to identify a transaction.
  • get_tx_keys - boolean; (Optional) Return the transaction keys after sending.
  • key_image - string; Key image of specific output to sweep.
  • below_amount - unsigned int; (Optional) Include outputs below this amount.
  • do_not_relay - boolean; (Optional) If true, do not relay this sweep transfer. (Defaults to false)
  • get_tx_hex - boolean; (Optional) return the transactions as hex encoded string. (Defaults to false)
  • get_tx_metadata - boolean; (Optional) return the transaction metadata as a string. (Defaults to false)

Outputs:

  • tx_hash_list - array of: string. The tx hashes of every transaction.
  • tx_key_list - array of: string. The transaction keys for every transaction.
  • amount_list - array of: integer. The amount transferred for every transaction.
  • fee_list - array of: integer. The amount of fees paid for every transaction.
  • tx_blob_list - array of: string. The tx as hex string for every transaction.
  • tx_metadata_list - array of: string. List of transaction metadata needed to relay the transactions later.
  • multisig_txset - string. The set of signing keys used in a multisig transaction (empty for non-multisig).
  • unsigned_txset - string. Set of unsigned tx for cold-signing purposes.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"sweep_single","params":{"address":"Safex5ztEZcNUScmGWJYEsPHaBPXbenyXaigRJrvrnEX6CUQjuEkgcgBomBp3cseeNLurzSzdzcThDdC7xFjPFuU2PjNFLfJH6J1E","ring_size":7,"unlock_time":0,,"get_tx_keys":true}}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "amount": 27126892247503,
    "fee": 14111630000,
    "multisig_txset": "",
    "tx_blob": "",
    "tx_hash": "c72376ff6ad2a2b336d233d9b2dfcfea2aa9bc1d3af0e29f43005acf6862d9a2",
    "tx_key": "",
    "tx_metadata": "",
    "unsigned_txset": ""
  }
}

relay_tx

Relay a transaction previously created with "do_not_relay":true.

Alias: None.

Inputs:

  • hex - string; transaction metadata returned from a transfer method with get_tx_metadata set to true.

Outputs:

  • tx_hash - String for the publically searchable transaction hash.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"relay_tx","params":{"hex":"...tx_metadata..."}}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "tx_hash": "1c42dcc5672bb09bccf33fb1e9ab4a498af59a6dbd33b3d0cfb289b9e0e25fa5"
  }
}

store

Save the wallet file.

Alias: None.

Inputs: None.

Outputs: None.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"store"}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
  }
}

get_payments

Get a list of incoming payments using a given payment id.

Alias: None.

Inputs:

  • payment_id - string; Payment ID used to find the payments (16 characters hex).

Outputs:

  • payments - list of:
    • payment_id - string; Payment ID matching the input parameter.
    • tx_hash - string; Transaction hash used as the transaction ID.
    • amount - unsigned int; Amount for this payment.
    • block_height - unsigned int; Height of the block that first confirmed this payment.
    • unlock_time - unsigned int; Time (in block height) until this payment is safe to spend.
    • subaddr_index - subaddress index:
      • major - unsigned int; Account index for the subaddress.
      • minor - unsigned int; Index of the subaddress in the account.
    • address - string; Address receiving the payment; Base58 representation of the public keys.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_payments","params":{"payment_id":"a1b2c3d4e5f61234"}}' -H 'Content-Type: application/json'
{
  "id": 0,
  "jsonrpc": "2.0",
  "result": {
    "payments": [
      {
        "address": "SafextzWd5wWCRhgUEU4FVJjBkNS9sarNpbexP6YfZgDYv3bcSVwCZtm9PWnpkoRiifC3uMQJS9ihFmNTbUXr2eWgY7LUMiPBHFgq",
        "amount": 1500000000000,
        "block_height": 41108,
        "payment_id": "a1b2c3d4e5f61234",
        "subaddr_index": {
          "major": 0,
          "minor": 0
        },
        "token_amount": 0,
        "token_transaction": false,
        "tx_hash": "0b2c5b715d5089b052789b53185721605bd2c336d6a2c011a120089b648b22b6",
        "unlock_time": 0
      }
    ]
  }
}

get_bulk_payments

Get a list of incoming payments using a given payment id, or a list of payments ids, from a given height. This method is the preferred method over get_payments because it has the same functionality but is more extendable. Either is fine for looking up transactions by a single payment ID.

Alias: None.

Inputs:

  • payment_ids - array of: string; Payment IDs used to find the payments (16 characters hex).
  • min_block_height - unsigned int; The block height at which to start looking for payments.

Outputs:

  • payments - list of:
    • payment_id - string; Payment ID matching one of the input IDs.
    • tx_hash - string; Transaction hash used as the transaction ID.
    • amount - unsigned int; Amount for this payment.
    • token_amount - unsigned int; Token amount for this payment.
    • token_transaction - bool; Does transaction contains tokens.
    • block_height - unsigned int; Height of the block that first confirmed this payment.
    • unlock_time - unsigned int; Time (in block height) until this payment is safe to spend.
    • subaddr_index - subaddress index:
      • major - unsigned int; Account index for the subaddress.
      • minor - unsigned int; Index of the subaddress in the account.
    • address - string; Address receiving the payment; Base58 representation of the public keys.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_bulk_payments","params":{"payment_ids":["52cf9717af42a7002a40e9ed09c383248fce78da9c6652fc9f28a5ddac9c0069"],"min_block_height":"120000"}}' -H 'Content-Type: application/json'
{
  "id": 0,
  "jsonrpc": "2.0",
  "result": {
    "payments": [
      {
        "address": "SafextzWd5wWCRhgUEU4FVJjBkNS9sarNpbexP6YfZgDYv3bcSVwCZtm9PWnpkoRiifC3uMQJS9ihFmNTbUXr2eWgY7LUMiPBHFgq",
        "amount": 500000000000,
        "block_height": 41104,
        "payment_id": "52cf9717af42a7002a40e9ed09c383248fce78da9c6652fc9f28a5ddac9c0069",
        "subaddr_index": {
          "major": 0,
          "minor": 0
        },
        "token_amount": 0,
        "token_transaction": false,
        "tx_hash": "f387b9de42801795061113e072cc9be2c41af3f88141588b432c9473ab70617f",
        "unlock_time": 0
      },
      {
        "address": "SafextzWd5wWCRhgUEU4FVJjBkNS9sarNpbexP6YfZgDYv3bcSVwCZtm9PWnpkoRiifC3uMQJS9ihFmNTbUXr2eWgY7LUMiPBHFgq",
        "amount": 250000000000,
        "block_height": 41104,
        "payment_id": "52cf9717af42a7002a40e9ed09c383248fce78da9c6652fc9f28a5ddac9c0069",
        "subaddr_index": {
          "major": 0,
          "minor": 0
        },
        "token_amount": 0,
        "token_transaction": false,
        "tx_hash": "3db35a20cdbc215af901087258a7f14d361731ace99d5f927e89fdf87b96c8a2",
        "unlock_time": 0
      }
    ]
  }
}

incoming_transfers

Return a list of incoming transfers to the wallet.

Inputs:

  • transfer_type - string; "all": all the transfers, "available": only transfers which are not yet spent, OR "unavailable": only transfers which are already spent.
  • account_index - unsigned int; (Optional) Return transfers for this account. (defaults to 0)
  • subaddr_indices - array of unsigned int; (Optional) Return transfers sent to these subaddresses.
  • verbose - boolean; (Optional) Enable verbose output, return key image if true.

Outputs:

  • transfers - list of:
    • amount - unsigned int; Amount of this transfer.
    • global_index - unsigned int; Mostly internal use, can be ignored by most users.
    • key_image - string; Key image for the incoming transfer's unspent output (empty unless verbose is true).
    • spent - boolean; Indicates if this transfer has been spent.
    • subaddr_index - unsigned int; Subaddress index for incoming transfer.
    • tx_hash - string; Several incoming transfers may share the same hash if they were in the same transaction.
    • tx_size - unsigned int; Size of transaction in bytes.

Example, get available transfers:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"incoming_transfers","params":{"transfer_type":"available","account_index":0,"subaddr_indices":[3],"verbose":true}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "transfers": [
            {
                "amount": 100000000000,
                "global_index": 9094,
                "key_image": "34dba56b1f92950fe2d84b7e8c8d1503f7bd2e6ede19ba615d393f867d6f994f",
                "spent": true,
                "subaddr_index": 1,
                "token_amount": 0,
                "token_transaction": false,
                "tx_hash": "34c013a842c68050491a2805b9ef71ab84e8beb33a7f9823d145e8871bc9b869",
                "tx_size": 394
            },
            {
                "amount": 0,
                "global_index": 1887,
                "key_image": "8e9f102d74344fa287a21440e8ec326536af17460f3a47bdcbdc867f5530dec9",
                "spent": false,
                "subaddr_index": 1,
                "token_amount": 100000000000,
                "token_transaction": true,
                "tx_hash": "7831d09265def2c467dfe577dafa497abbb09de192e481cb075ed9f1458031b9",
                "tx_size": 464
            },
            {
                "amount": 900000000,
                "global_index": 9976,
                "key_image": "62f44a71a42b1617fe432cc266036338999008e623ec80b879e94f3054d38f45",
                "spent": false,
                "subaddr_index": 0,
                "token_amount": 0,
                "token_transaction": false,
                "tx_hash": "f2b4a63c1cac5259e4ddedbc76ff98198979b2dd9f282d6ab39fee6cb2bb238b",
                "tx_size": 206
            }
        ]
    }
}

query_key

Return the spend or view private key.

Alias: None.

Inputs:

  • key_type - string; Which key to retrieve: "mnemonic" - the mnemonic seed (older wallets do not have one) OR "view_key" - the view key

Outputs:

  • key - string; The view key will be hex encoded, while the mnemonic will be a string of words.

Example (Query view key):

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"query_key","params":{"key_type":"view_key"}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "key": "e432a28a3dd8eff21fbc935d4048a66e9d995537abb12ed79b523fa0e39e260c"
    }
}

Example (Query mnemonic key):

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"query_key","params":{"key_type":"mnemonic"}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "key": "neutral virtual shackles imbalance quick library camp ...."
    }
}

make_integrated_address

Make an integrated address from the wallet address and a payment id.

Alias: None.

Inputs:

  • standard_address - string; (Optional, defaults to primary address) Destination public address.
  • payment_id - string; (Optional, defaults to a random ID) 16 characters hex encoded.

Outputs:

  • integrated_address - string
  • payment_id - string; hex encoded;

Example (Payment ID is empty, use a random ID):

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"make_integrated_address","params":{"standard_address":"Safex5ytKP518TZ4rv3bqoVvapwHdcAsoKjQv1uSBnAuCKUeFtokCgZEiY9zDrBKC3PTbnYdZkUUnMQGSgod3BUoeDoU6ddWXhz3M"}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "integrated_address": "Safexizb4NCZ7fqg16S8Fhcud2UH7SvHUN9btteJVpfiWpPTzRYyNbdisRQLRLJNoNJV25RVLr8MwQzuGrCuoNKFCX7qwgpPDGF8DYekmzH4oTC88",
        "payment_id": "39642b24ba78c1ad"
    }
}

split_integrated_address

Retrieve the standard address and payment id corresponding to an integrated address.

Alias: None.

Inputs:

  • integrated_address - string

Outputs:

  • is_subaddress - boolean; States if the address is a subaddress
  • payment - string; hex encoded
  • standard_address - string

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"split_integrated_address","params":{"integrated_address": "Safexizb4NCZ7fqg16S8Fhcud2UH7SvHUN9btteJVpfiWpPTzRYyNbdisRQLRLJNoNJV25RVLr8MwQzuGrCuoNKFCX7qwgpPDGF8DYekmzH4oTC88"}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "is_subaddress": false,
        "payment_id": "39642b24ba78c1ad",
        "standard_address": "Safex5ytKP518TZ4rv3bqoVvapwHdcAsoKjQv1uSBnAuCKUeFtokCgZEiY9zDrBKC3PTbnYdZkUUnMQGSgod3BUoeDoU6ddWXhz3M"
    }
}

stop_wallet

Stops the wallet, storing the current state.

Alias: None.

Inputs: None.

Outputs: None.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"stop_wallet"}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
  }
}

rescan_blockchain

Rescan the blockchain from scratch, losing any information which can not be recovered from the blockchain itself.
This includes destination addresses, tx secret keys, tx notes, etc.

Alias: None.

Inputs: None.

Outputs: None.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"rescan_blockchain"}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
  }
}

set_tx_notes

Set arbitrary string notes for transactions.

Alias: None.

Inputs:

  • txids - array of string; transaction ids
  • notes - array of string; notes for the transactions

Outputs: None.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"set_tx_notes","params":{"txids":["53ef80bee59294f86618b85421c321a7841272cf6e5ab01e111fa3bf8a6f55a8"],"notes":["This is an example"]}}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
  }
}

get_tx_notes

Get string notes for transactions.

Alias: None.

Inputs:

  • txids - array of string; transaction ids

Outputs:

  • notes - array of string; notes for the transactions

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_tx_notes","params":{"txids":["53ef80bee59294f86618b85421c321a7841272cf6e5ab01e111fa3bf8a6f55a8"]}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "notes": [
            "This is an example"
        ]
    }
}

set_attribute

Set arbitrary attribute.

Alias: None.

Inputs:

  • key - string; attribute name
  • value - string; attribute value

Outputs: None.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"set_attribute","params":{"key":"my_attribute","value":"my_value"}}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
  }
}

get_attribute

Get attribute value by name.

Alias: None.

Inputs:

  • key - string; attribute name

Outputs:

  • value - string; attribute value

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_attribute","params":{"key":"my_attribute"}}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "value": "my_value"
  }
}

get_tx_key

Get transaction secret key from transaction id.

Alias: None.

Inputs:

  • txid - string; transaction id.

Outputs:

  • tx_key - string; transaction secret key.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_tx_key","params":{"txid":"370ae37b41755fa34cf88ad79b39ab4bd6ebe75f215223d6e32842cdbf791624"}}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "tx_key": "ddb82198ddd90ad4fea752c588f0da462b801522919c88774870b37b0899d205"
  }
}

check_tx_key

Check a transaction in the blockchain with its secret key.

NOTE: Response will often have Safex cash value even if transaction is token transaction. Safex cash value is linked with fee.

Alias: None.

Inputs:

  • txid - string; transaction id.
  • tx_key - string; transaction secret key.
  • address - string; destination public address of the transaction.

Outputs:

  • confirmations - unsigned int; Number of block mined after the one with the transaction.
  • in_pool - boolean; States if the transaction is still in pool or has been added to a block.
  • received - unsigned int; Amount of Safex the transaction.
  • received_tokens - unsigned int; Amount SFT of the transaction.
  • token_transaction - bool; Is token transaction.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"check_tx_key","params":{"txid":"19d5089f9469db3d90aca9024dfcb17ce94b948300101c8345a5e9f7257353be","tx_key":"feba662cf8fb6d0d0da18fc9b70ab28e01cc76311278fdd7fe7ab16360762b06","address":"7BnERTpvL5MbCLtj5n9No7J5oE5hHiB3tVCK5cjSvCsYWD2WRJLFuWeKTLiXo5QJqt2ZwUaLy2Vh1Ad51K7FNgqcHgjW85o"}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "confirmations": 695,
        "in_pool": false,
        "received": 99800000000,
        "received_tokens": 890000000000,
        "token_transaction": true
    }
}

get_tx_proof

Get transaction signature to prove it.

Alias: None.

Inputs:

  • txid - string; transaction id.
  • address - string; destination public address of the transaction.
  • message - string; (Optional) add a message to the signature to further authenticate the prooving process.

Outputs:

  • signature - string; transaction signature.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_tx_proof","params":{"txid":"6fe3d7f2713aaeaaedf82a9ed91b3185d75642c88c6fc733d5b13022d1cbf4b2","address":"SafextzUTFwxzj4MGL6Ah496ihRo7AUuJfgdBewqeK5D6PC6LrJF5DbdJJ9nc39eSS3GD7Tk7sL5gYnHX6MJDrMJJYPRxePoCU62P"}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "signature": "OutProofV1hZvSzZtRTPZBJkSfgUuhwoAvpECgHjbbpbJrmmA28ZCQ4VdfLhhzWZ3NuvqqS6EKDyAmWVeKciYscjGD73iYU6EUDoUEqLW9ZKGNzRnSeTksuRHQpD4GBAEviTfG1kDp8f2v"
    }
}

check_tx_proof

Prove a transaction by checking its signature.

Alias: None.

Inputs:

  • txid - string; transaction id.
  • address - string; destination public address of the transaction.
  • message - string; (Optional) Should be the same message used in get_tx_proof.
  • signature - string; transaction signature to confirm.

Outputs:

  • confirmations - unsigned int; Number of block mined after the one with the transaction.
  • good - boolean; States if the inputs proves the transaction.
  • in_pool - boolean; States if the transaction is still in pool or has been added to a block.
  • received - unsigned int; Amount of the transaction.
  • token_received - unsigned int; Amount of the transaction.

In the example below, the transaction has been proven:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"check_tx_proof","params":{"txid":"6fe3d7f2713aaeaaedf82a9ed91b3185d75642c88c6fc733d5b13022d1cbf4b2","address":"SafextzUTFwxzj4MGL6Ah496ihRo7AUuJfgdBewqeK5D6PC6LrJF5DbdJJ9nc39eSS3GD7Tk7sL5gYnHX6MJDrMJJYPRxePoCU62P","message":"this is my transaction","signature":"OutProofV1hZvSzZtRTPZBJkSfgUuhwoAvpECgHjbbpbJrmmA28ZCQC2VDtD6EntH5j2r1ysUPJ96cUyUBUDQXcfgxjDdBeWPA5DhWNfo2oiU7Mwhdin23bV9nmocQwdZudGaejH5sNaoJ"}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "confirmations": 724,
        "good": true,
        "in_pool": false,
        "received": 0,
        "received_tokens": 100000000000,
        "token_transaction": true
    }
}

get_spend_proof

Generate a signature to prove a spend. Unlike proving a transaction, it does not requires the destination public address.

Alias: None.

Inputs:

  • txid - string; transaction id.
  • message - string; (Optional) add a message to the signature to further authenticate the prooving process.

Outputs:

  • signature - string; spend signature.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_spend_proof","params":{"txid":"6fe3d7f2713aaeaaedf82a9ed91b3185d75642c88c6fc733d5b13022d1cbf4b2"}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "signature": "SpendProofV13r7B7u6TrjWVzaDkT3p6KEM1cfHYwb4GoMUoyvT5i8uaLJxu1LNSFPHXNcFg4jwCmiARd2kc1SUnP5GSCcfSim9L7KjZRE3TXKdF58z3cH8NYM29mhxeNS8BFFJchnWDpabxDez92mJLH4N5MFwvnA5JbEBM4RsMdaVJHUPfG17Z2n6gQXSLGQLQc3oJwxV9N3T9TieGFtVPkPiX5GetEYQaCk7yVKMhXVww3Bt9jQEig3nBEBaPM3n6dH41F94bDKKKRnAHP9gP9fUja8W94bJCoXyVvoin5kTZSA8Pm1FSGr8UHJUva6ghewJoJi9Q4ZBNJt5QHEU72eHG9oDBw6CT2uUJ3yicCZDi2XxL3fcZpshDvXeCbEgcGTZCaf8BYJGa3xrrzyyWh98VdX83wpaQX2nz7nVWGM9GCL6E76B4sCnMyLYkReFXgfvSBPNvSmkZcC48hDvaxwQsi28QemUirMwxsPDpvZUnKXAnGzYX1H5M4zFZvEKgUgKHh4H1TpnfEV4uXf2Zvfw9"
    }
}
}

check_spend_proof

Prove a spend using a signature. Unlike proving a transaction, it does not requires the destination public address.

Alias: None.

Inputs:

  • txid - string; transaction id.
  • message - string; (Optional) Should be the same message used in get_spend_proof.
  • signature - string; spend signature to confirm.

Outputs:

  • good - boolean; States if the inputs proves the spend.

In the example below, the spend has been proven:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"check_spend_proof","params":{"txid":"6fe3d7f2713aaeaaedf82a9ed91b3185d75642c88c6fc733d5b13022d1cbf4b2"."signature":"SpendProofV13r7B7u6TrjWVzaDkT3p6KEM1cfHYwb4GoMUoyvT5i8uaLJxu1LNSFPHXNcFg4jwCmiARd2kc1SUnP5GSCcfSim9L7KjZRE3TXKdF58z3cH8NYM29mhxeNS8BFFJchnWDpabxDez92mJLH4N5MFwvnA5JbEBM4RsMdaVJHUPfG17Z2n6gQXSLGQLQc3oJwxV9N3T9TieGFtVPkPiX5GetEYQaCk7yVKMhXVww3Bt9jQEig3nBEBaPM3n6dH41F94bDKKKRnAHP9gP9fUja8W94bJCoXyVvoin5kTZSA8Pm1FSGr8UHJUva6ghewJoJi9Q4ZBNJt5QHEU72eHG9oDBw6CT2uUJ3yicCZDi2XxL3fcZpshDvXeCbEgcGTZCaf8BYJGa3xrrzyyWh98VdX83wpaQX2nz7nVWGM9GCL6E76B4sCnMyLYkReFXgfvSBPNvSmkZcC48hDvaxwQsi28QemUirMwxsPDpvZUnKXAnGzYX1H5M4zFZvEKgUgKHh4H1TpnfEV4uXf2Zvfw9"}}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "good": true
  }
}

In the example below, the wrong message is used, avoiding the spend to be proved:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"check_spend_proof","params":{"txid":"6fe3d7f2713aaeaaedf82a9ed91b3185d75642c88c6fc733d5b13022d1cbf4b2","message":"wrong message","signature":"SpendProofV13r7B7u6TrjWVzaDkT3p6KEM1cfHYwb4GoMUoyvT5i8uaLJxu1LNSFPHXNcFg4jwCmiARd2kc1SUnP5GSCcfSim9L7KjZRE3TXKdF58z3cH8NYM29mhxeNS8BFFJchnWDpabxDez92mJLH4N5MFwvnA5JbEBM4RsMdaVJHUPfG17Z2n6gQXSLGQLQc3oJwxV9N3T9TieGFtVPkPiX5GetEYQaCk7yVKMhXVww3Bt9jQEig3nBEBaPM3n6dH41F94bDKKKRnAHP9gP9fUja8W94bJCoXyVvoin5kTZSA8Pm1FSGr8UHJUva6ghewJoJi9Q4ZBNJt5QHEU72eHG9oDBw6CT2uUJ3yicCZDi2XxL3fcZpshDvXeCbEgcGTZCaf8BYJGa3xrrzyyWh98VdX83wpaQX2nz7nVWGM9GCL6E76B4sCnMyLYkReFXgfvSBPNvSmkZcC48hDvaxwQsi28QemUirMwxsPDpvZUnKXAnGzYX1H5M4zFZvEKgUgKHh4H1TpnfEV4uXf2Zvfw9"}}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "good": false
  }
}

get_reserve_proof

Generate a signature to prove of an available amount in a wallet.

Alias: None.

Inputs:

  • all - boolean; Proves all wallet balance to be disposable.
  • account_index - unsigned int; Specify the account from witch to prove reserve. (ignored if all is set to true)
  • amount - unsigned int; Amount in atomic units to prove the account has for reserve. (ignored if all is set to true)
  • token - bool; Is reserve proof refering to token or cash amount
  • message - string; (Optional) add a message to the signature to further authenticate the prooving process.

Outputs:

  • signature - string; reserve signature.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_reserve_proof","params":{"all":false,"account_index":0,"amount":1000000000000, "token":false}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "signature": "ReserveProofV11BZ23sBt9sZJeGccf84mzyAmNCP3KzYbE1111112VKmH111118P3RrxB9rdmEoxmFLEgDxAsSZykvhngF5aGAQywCyiqoThmPWw1BveKxXPPpzA75QwyZUAX4R3UFCQnNSX2QP7Rvd6CrshS6qGFt1hiFu6wt8UdPPRsDZFTCkghNKZXLB6pYjgpjHfKbMQV7TGa1d1D9YuokXZ7YiNYe1YA7ETg3MuwuDwh2cdA4mHv9XVRqcgeV1GiKUKwxdWUBpjbVJwr86DZ3yrkxMi6HfSLtDD9YeN5SALd3hiBcUHwwhZv9uTbP2dSmm4BqachDWeFqfty2mGjw3wBJT7DE5bs79rM59yePUChFyYoYqjZ7Yfp3z4RYU4dweuR6ayUC1Bw4fcHMQWe89s7qCQVdmY5YcWVLk1TrnYMgeLP21c18PAuiDTqybu3L3HkUpbEYFMWzD5LcAQqUfaFT8PFUUv68Wqea4d9HvSuc5BSqbGod7Dh2vgLZQyZfPZDDAVY9KHVp4boT1o"
    }
}

check_reserve_proof

Proves a wallet has a disposable reserve using a signature.

Alias: None.

Inputs:

  • address - string; Public address of the wallet.
  • message - string; (Optional) Should be the same message used in get_reserve_proof.
  • signature - string; reserve signature to confirm.

Outputs:

  • good - boolean; States if the inputs proves the reserve.
  • total - unsigned int; Total cash inputs reserved.
  • spent - unsigned int; Spent cash inputs.
  • token_total - unsigned int; Total token inputs reserved.
  • token_spent - unsigned int; Spent token inputs reserved.

In the example below, the reserve has been proven:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"check_reserve_proof","params":{"address":"Safex5ztEZcNUScmGWJYEsPHaBPXbenyXaigRJrvrnEX6CUQjuEkgcgBomBp3cseeNLurzSzdzcThDdC7xFjPFuU2PjNFLfJH6J1E","signature":"ReserveProofV11BZ23sBt9sZJeGccf84mzyAmNCP3KzYbE1111112VKmH111118P3RrxB9rdmEoxmFLEgDxAsSZykvhngF5aGAQywCyiqoThmPWw1BveKxXPPpzA75QwyZUAX4R3UFCQnNSX2QP7Rvd6CrshS6qGFt1hiFu6wt8UdPPRsDZFTCkghNKZXLB6pYjgpjHfKbMQV7TGa1d1DARjjhyTzc5UKvgYeqrisVZRqyJyHksyXdiRE4TJyiRhpBx4vGuPMKRvndKwBS1vxZJe75DVHAyu3uQ8P5v3dkWfoxTDW8hg2aPfXD7Qfjt7yX7DWWKsB9mXjUvyXCc1dqM6rnFGaUQMu84B7aBB8992bXM1o3o77X3NHrXpwrw8xozZFf3pLN6B4t1Bw4fcHMQWe89s7qCQVdmY5YcWVLk1TrnYMgeLP21c18PAuiDSPNMHsgW8N7y8b72j4VtqUdiY1xX8vzXCm6tkgJDMrTHvXdWxTBtdXsmbHPTugn4AsGVqeKNcniXSEujsYu6orDy7"}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "good": true,
        "spent": 0,
        "token_spent": 0,
        "token_total": 0,
        "total": 1000000000000
    }
}

get_transfers

Returns a list of transfers.

Alias: None.

Inputs:

  • in - boolean; (Optional) Include incoming transfers.
  • out - boolean; (Optional) Include outgoing transfers.
  • pending - boolean; (Optional) Include pending transfers.
  • failed - boolean; (Optional) Include failed transfers.
  • pool - boolean; (Optional) Include transfers from the daemon's transaction pool.
  • filter_by_height - boolean; (Optional) Filter transfers by block height.
  • min_height - unsigned int; (Optional) Minimum block height to scan for transfers, if filtering by height is enabled.
  • max_height - unsigned int; (Opional) Maximum block height to scan for transfers, if filtering by height is enabled (defaults to max block height).
  • account_index - unsigned int; (Optional) Index of the account to query for transfers. (defaults to 0)
  • subaddr_indices - array of unsigned int; (Optional) List of subaddress indices to query for transfers. (defaults to 0)

Outputs:

  • in array of transfers:
    • address - string; Public address of the transfer.
    • amount - unsigned int; Cash amount transferred.
    • token_amount - unsigned int; Token amount transferred.
    • token_transaction - boolean; Indicating if transaction has any tokens included.
    • confirmations - unsigned int; Number of block mined since the block containing this transaction (or block height at which the transaction should be added to a block if not yet confirmed).
    • double_spend_seen - boolean; True if the key image(s) for the transfer have been seen before.
    • fee - unsigned int; Transaction fee for this transfer.
    • height - unsigned int; Height of the first block that confirmed this transfer (0 if not mined yet).
    • note - string; Note about this transfer.
    • payment_id - string; Payment ID for this transfer.
    • subaddr_index - JSON object containing the major & minor subaddress index:
      • major - unsigned int; Account index for the subaddress.
      • minor - unsigned int; Index of the subaddress under the account.
    • suggested_confirmations_threshold - unsigned int; Estimation of the confirmations needed for the transaction to be included in a block.
    • timestamp - unsigned int; POSIX timestamp for when this transfer was first confirmed in a block (or timestamp submission if not mined yet).
    • txid - string; Transaction ID for this transfer.
    • type - string; Transfer type: "in"
    • unlock_time - unsigned int; Number of blocks until transfer is safely spendable.
  • out array of transfers (see above).
  • pending array of transfers (see above).
  • failed array of transfers (see above).
  • pool array of transfers (see above).

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_transfers","params":{"in":true,"account_index":1}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": 
    {
        "in": 
        [
            {
                "address": "Safex5ztEZcNUScmGWJYEsPHaBPXbenyXaigRJrvrnEX6CUQjuEkgcgBomBp3cseeNLurzSzdzcThDdC7xFjPFuU2PjNFLfJH6J1E",
                "amount": 0,
                "double_spend_seen": false,
                "fee": 18446743473909551616,
                "height": 68002,
                "note": "",
                "payment_id": "a25cc40d8d06aaa7ca0e505809f2d7cf562808565e251e1851f9893754ac5cda",
                "subaddr_index": {
                    "major": 0,
                    "minor": 0
                },
                "timestamp": 1545311628,
                "token_amount": 100000000000,
                "token_transaction": true,
                "txid": "a7ffbf0a85a9eff8cdc88601b63a68a72ffc44ecffc48ae34446e49a77de0e36",
                "type": "in",
                "unlock_time": 0
            }
    	]
  }
}

get_transfer_by_txid

Show information about a transfer to/from this address.

Alias: None.

Inputs:

  • txid - string; Transaction ID used to find the transfer.
  • account_index - unsigned int; (Optional) Index of the account to query for the transfer.

Outputs:

  • transfer - JSON object containing payment information:
    • address - string; Address that transferred the funds. Base58 representation of the public keys.
    • amount - unsigned int; Cash amount of this transfer.
    • token_amount - unsigned int; Token amount transferred.
    • token_transaction - boolean; Indicating if transaction has any tokens included.
    • confirmations - unsigned int; Number of block mined since the block containing this transaction (or block height at which the transaction should be added to a block if not yet confirmed).
    • destinations - array of JSON objects containing transfer destinations:
      • amount - unsigned int; Amount transferred to this destination.
      • address - string; Address for this destination. Base58 representation of the public keys.
    • double_spend_seen - boolean; True if the key image(s) for the transfer have been seen before.
    • fee - unsigned int; Transaction fee for this transfer.
    • height - unsigned int; Height of the first block that confirmed this transfer.
    • note - string; Note about this transfer.
    • payment_id - string; Payment ID for this transfer.
    • subaddr_index - JSON object containing the major & minor subaddress index:
      • major - unsigned int; Account index for the subaddress.
      • minor - unsigned int; Index of the subaddress under the account.
    • suggested_confirmations_threshold - unsigned int; Estimation of the confirmations needed for the transaction to be included in a block.
    • timestamp - unsigned int; POSIX timestamp for the block that confirmed this transfer (or timestamp submission if not mined yet).
    • txid - string; Transaction ID of this transfer (same as input TXID).
    • type - string; Type of transfer, one of the following: "in", "out", "pending", "failed", "pool"
    • unlock_time - unsigned int; Number of blocks until transfer is safely spendable.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_transfer_by_txid","params":{"txid":"a7ffbf0a85a9eff8cdc88601b63a68a72ffc44ecffc48ae34446e49a77de0e36"}}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "transfer": {
            "address": "Safex5ztEZcNUScmGWJYEsPHaBPXbenyXaigRJrvrnEX6CUQjuEkgcgBomBp3cseeNLurzSzdzcThDdC7xFjPFuU2PjNFLfJH6J1E",
            "amount": 0,
            "double_spend_seen": false,
            "fee": 18446743473909551616,
            "height": 68002,
            "note": "",
            "payment_id": "a25cc40d8d06aaa7ca0e505809f2d7cf562808565e251e1851f9893754ac5cda",
            "subaddr_index": {
                "major": 0,
                "minor": 0
            },
            "timestamp": 1545311628,
            "token_amount": 100000000000,
            "token_transaction": true,
            "txid": "a7ffbf0a85a9eff8cdc88601b63a68a72ffc44ecffc48ae34446e49a77de0e36",
            "type": "in",
            "unlock_time": 0
        }
  }
}

sign

Alias: None.

Inputs:

  • data - string; Anything you need to sign.

Outputs:

  • signature - string; Signature generated against the "data" and the account public address.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"sign","params":{"data":"This is sample data to be signed"}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "signature": "SigV13pC9tBkEHhiXfdt6er8SJBRjPu38hiftcR8bntTuHL1ZFym9LpMhyhsNVQz2DDy9vp52DSSWMvgw7JkHSeSumayz"
    }
}

verify

Verify a signature on a string.

Alias: None.

Inputs:

  • data - string; What should have been signed.
  • address - string; Public address of the wallet used to sign the data.
  • signature - string; signature generated by sign method.

Outputs:

  • good - boolean;

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"verify","params":{"data":"This is sample data to be signed","address":"Safex5ztEZcNUScmGWJYEsPHaBPXbenyXaigRJrvrnEX6CUQjuEkgcgBomBp3cseeNLurzSzdzcThDdC7xFjPFuU2PjNFLfJH6J1E","signature":"SigV13pC9tBkEHhiXfdt6er8SJBRjPu38hiftcR8bntTuHL1ZFym9LpMhyhsNVQz2DDy9vp52DSSWMvgw7JkHSeSumayz"}}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "good": true
  }
}

export_key_images

Export a signed set of key images.

Alias: None.

Inputs: None.

Outputs:

  • signed_key_images - array of signed key images:
    • key_image - string;
    • signature - string;

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"export_key_images"}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "signed_key_images": [
            {
                "key_image": "db5ca195f5ae0aebb1a21a0744763e922a10f677a6e07ac587d1df8809195de8",
                "signature": "0c3c14e23e893f3f98d8c8f95605a31ebeac55f032fa3607b114fb27f76c5201b61d1559b41f6cac33d6777045a57cff6b06007c0b18eca4d26ff7cfd96dc20d"
            },
            {
                "key_image": "ae2bdfa423b8c83006cd49f60301da3d4e78a325adfb158d559e51b24c202c7a",
                "signature": "22ce2914a8cd7c4cc5cc5fe0b7157edfdc7d5f59aa74334480949198dc521b01506004d25f3721ac06fbdc22ad7340a23c42c16fc93691ba04f384094d15b805"
            },...]
  	}
}

import_key_images

Import signed key images list and verify their spent status.

Alias: None.

Inputs:

  • signed_key_images - array of signed key images:
    • key_image - string;
    • signature - string;

Outputs:

  • height - unsigned int;
  • spent - unsigned int; Amount (in atomic units) spent from those key images.
  • unspent - unsigned int; Amount (in atomic units) still available from those key images.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"import_key_images", "params":{"signed_key_images": [
            {
                "key_image": "db5ca195f5ae0aebb1a21a0744763e922a10f677a6e07ac587d1df8809195de8",
                "signature": "0c3c14e23e893f3f98d8c8f95605a31ebeac55f032fa3607b114fb27f76c5201b61d1559b41f6cac33d6777045a57cff6b06007c0b18eca4d26ff7cfd96dc20d"
            },
            {
                "key_image": "ae2bdfa423b8c83006cd49f60301da3d4e78a325adfb158d559e51b24c202c7a",
                "signature": "22ce2914a8cd7c4cc5cc5fe0b7157edfdc7d5f59aa74334480949198dc521b01506004d25f3721ac06fbdc22ad7340a23c42c16fc93691ba04f384094d15b805"
            }]}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "height": 21238,
        "spent": 60890091854137259,
        "unspent": 2071092872342573
    }
}

make_uri

Create a payment URI using the official URI spec.

Alias: None.

Inputs:

  • address - string; Wallet address
  • amount - unsigned int; (optional) the integer amount to receive, in atomic units
  • token_amount - unsigned int; (optional) the integer token amount to receive, in atomic units
  • payment_id - string; (optional) 16 or 64 character hexadecimal payment id
  • recipient_name - string; (optional) name of the payment recipient
  • tx_description - string; (optional) Description of the reason for the tx

Outputs:

  • uri - string; This contains all the payment input information as a properly formatted payment URI

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"make_uri","params":{"address":"Safex5ztEZcNUScmGWJYEsPHaBPXbenyXaigRJrvrnEX6CUQjuEkgcgBomBp3cseeNLurzSzdzcThDdC7xFjPFuU2PjNFLfJH6J1E","token_amount":10,"payment_id":"420fa29b2d9a49f5","tx_description":"Testing out the make_uri function.","recipient_name":"safex testnet wallet"}}'  -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "uri": "safex:Safex5ztEZcNUScmGWJYEsPHaBPXbenyXaigRJrvrnEX6CUQjuEkgcgBomBp3cseeNLurzSzdzcThDdC7xFjPFuU2PjNFLfJH6J1E?tx_payment_id=420fa29b2d9a49f5&tx_token_amount=0.0000000010&recipient_name=safex%20testnet%20wallet&tx_description=Testing%20out%20the%20make_uri%20function."
    }
}

parse_uri

Parse a payment URI to get payment information.

Alias: None.

Inputs:

  • uri - string; This contains all the payment input information as a properly formatted payment URI

Outputs:

  • uri - JSON object containing payment information:
    • address - string; Wallet address
    • amount - unsigned int; Decimal amount to receive, in coin units (0 if not provided)
    • token_amount - unsigned int; Token amount to receive, in coin units (0 if not provided)
    • payment_id - string; 16 or 64 character hexadecimal payment id (empty if not provided)
    • recipient_name - string; Name of the payment recipient (empty if not provided)
    • tx_description - string; Description of the reason for the tx (empty if not provided)

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"parse_uri","params":{"uri":"safex:Safex5ztEZcNUScmGWJYEsPHaBPXbenyXaigRJrvrnEX6CUQjuEkgcgBomBp3cseeNLurzSzdzcThDdC7xFjPFuU2PjNFLfJH6J1E?tx_payment_id=420fa29b2d9a49f5&tx_token_amount=0.0000000010&recipient_name=safex%20testnet%20wallet&tx_description=Testing%20out%20the%20make_uri%20function."}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "uri": {
            "address": "Safex5ztEZcNUScmGWJYEsPHaBPXbenyXaigRJrvrnEX6CUQjuEkgcgBomBp3cseeNLurzSzdzcThDdC7xFjPFuU2PjNFLfJH6J1E",
            "amount": 0,
            "payment_id": "420fa29b2d9a49f5",
            "recipient_name": "safex testnet wallet",
            "token_amount": 10,
            "tx_description": "Testing out the make_uri function."
        }
    }
}

get_address_book

Retrieves entries from the address book.

Alias: None.

Inputs:

  • entries - array of unsigned int; indices of the requested address book entries

Outputs:

  • entries - array of entries:
    • address - string; Public address of the entry
    • description - string; Description of this address entry
    • index - unsigned int;
    • payment_id - string;

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_address_book","params":{"entries":[0]}}' -H 'Content-Type: application/json'
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "entries": [
            {
                "address": "SafextzUTFwxzj4MGL6Ah496ihRo7AUuJfgdBewqeK5D6PC6LrJF5DbdJJ9nc39eSS3GD7Tk7sL5gYnHX6MJDrMJJYPRxePoCU62P",
                "description": "Third account",
                "index": 0,
                "payment_id": "0000000000000000000000000000000000000000000000000000000000000000"
            }
        ]
    }
}

add_address_book

Add an entry to the address book.

Alias: None.

Inputs:

  • address - string;
  • payment_id - (optional) string, defaults to "0000000000000000000000000000000000000000000000000000000000000000";
  • description - (optional) string, defaults to "";

Outputs:

  • index - unsigned int; The index of the address book entry.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"add_address_book","params":{"address":"SafextzUTFwxzj4MGL6Ah496ihRo7AUuJfgdBewqeK5D6PC6LrJF5DbdJJ9nc39eSS3GD7Tk7sL5gYnHX6MJDrMJJYPRxePoCU62P","description":"Third account"}}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "index": 0
  }
}

delete_address_book

Delete an entry from the address book.

Alias: None.

Inputs:

  • index - unsigned int; The index of the address book entry.

Outputs: None.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"delete_address_book","params":{"index":0}}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
  }
}

rescan_spent

Rescan the blockchain for spent outputs.

Alias: None.

Inputs: None.

Outputs: None.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"rescan_spent"}' -H 'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "result": { } }

start_mining

Start mining in the Safex daemon.

Alias: None.

Inputs:

  • threads_count - unsigned int; Number of threads created for mining.
  • do_background_mining - boolean; Allow to start the miner in smart mining mode.
  • ignore_battery - boolean; Ignore battery status (for smart mining only)

Outputs: None.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"start_mining","params":{"threads_count":1,"do_background_mining":true,"ignore_battery":false}}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
  }
}

stop_mining

Stop mining in the Safex daemon.

Alias: None.

Inputs: None.

Outputs: None.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"stop_mining"}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
  }
}

get_languages

Get a list of available languages for your wallet's seed.

Alias: None.

Inputs: None.

Outputs:

  • languages - array of string; List of available languages

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_languages"}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "languages": ["Deutsch","English","Español","Français","Italiano","Nederlands","Português","русский язык","日本語","简体中文 (中国)","Esperanto","Lojban"]
  }
}

create_wallet

Create a new wallet. You need to have set the argument "–wallet-dir" when launching safex-wallet-rpc to make this work.

Alias: None.

Inputs:

  • filename - string; Wallet file name.
  • password - string; (Optional) password to protect the wallet.
  • language - string; Language for your wallets' seed.

Outputs: None.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"create_wallet","params":{"filename":"mytestwallet","password":"mytestpassword","language":"English"}}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
  }
}

open_wallet

Open a wallet. You need to have set the argument "–wallet-dir" when launching safex-wallet-rpc to make this work.

Alias: None.

Inputs:

  • filename - string; wallet name stored in –wallet-dir.
  • password - string; (Optional) only needed if the wallet has a password defined.

Outputs: None.

Example:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"open_wallet","params":{"filename":"mytestwallet","password":"mytestpassword"}}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
  }
}

is_multisig

Check if a wallet is a multisig one.

Alias: None.

Inputs: None.

Outputs:

  • multisig - boolean; States if the wallet is multisig
  • ready - boolean;
  • threshold - unsigned int; Amount of signature needed to sign a transfer.
  • total - unsigned int; Total amount of signature in the multisig wallet.

Example for a non-multisig wallet:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"is_multisig"}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "multisig": false,
    "ready": false,
    "threshold": 0,
    "total": 0
  }
}

Example for a multisig wallet:

$ curl -X POST http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"is_multisig"}' -H 'Content-Type: application/json'                  {
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "multisig": true,
    "ready": true,
    "threshold": 2,
    "total": 2
  }
}

get_available_interest

Gets total available interest, and available interest per staked tokens output.

Alias: None.

Inputs: None.

Outputs:

  • available_interest - unsigned int;
  • interest_per_output - array of per_output:
    • amount - unsigned int;
    • interest - unsigned int;
    • block_height - unsigned int;