Kiến thức

Wallet RPC

Introduction

This is a list of the monero-wallet-rpc calls, their inputs and outputs, and examples of each. The program monero-wallet-rpc replaced the rpc interface that was in simplewallet and then monero-wallet-cli.

All monero-wallet-rpc methods use the same JSON RPC interface. For example:

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

Note: “atomic units” refer to the smallest fraction of 1 XMR according to the monerod implementation. 1 XMR = 1e12 atomic units.

This list has been updated on a frozen code on 2018-09-14 after merged commit bb30a7236725e456138f055f96a634c75ce2b491 (Wallet RPC version 1.3), and at block height 1643308.

Index of JSON RPC Methods:

  • set_daemon
  • get_balance
  • get_address
  • get_address_index
  • create_address
  • label_address
  • validate_address
  • get_accounts
  • create_account
  • label_account
  • get_account_tags
  • tag_accounts
  • untag_accounts
  • set_account_tag_description
  • get_height
  • transfer
  • transfer_split
  • sign_transfer
  • submit_transfer
  • sweep_dust
  • sweep_all
  • sweep_single
  • relay_tx
  • store
  • get_payments
  • get_bulk_payments
  • incoming_transfers
  • query_key
  • make_integrated_address
  • split_integrated_address
  • stop_wallet
  • rescan_blockchain
  • set_tx_notes
  • get_tx_notes
  • set_attribute
  • get_attribute
  • get_tx_key
  • check_tx_key
  • get_tx_proof
  • check_tx_proof
  • get_spend_proof
  • check_spend_proof
  • get_reserve_proof
  • check_reserve_proof
  • get_transfers
  • get_transfer_by_txid
  • describe_transfer
  • sign
  • verify
  • export_outputs
  • import_outputs
  • export_key_images
  • import_key_images
  • make_uri
  • parse_uri
  • get_address_book
  • add_address_book
  • edit_address_book
  • delete_address_book
  • refresh
  • auto_refresh
  • rescan_spent
  • start_mining
  • stop_mining
  • get_languages
  • create_wallet
  • generate_from_keys
  • open_wallet
  • restore_deterministic_wallet
  • close_wallet
  • change_wallet_password
  • is_multisig
  • prepare_multisig
  • make_multisig
  • export_multisig_info
  • import_multisig_info
  • finalize_multisig
  • sign_multisig
  • submit_multisig
  • get_version
  • freeze
  • frozen
  • thaw
  • exchange_multisig_keys
  • estimate_tx_size_and_weight
  • scan_tx

JSON RPC Methods:

set_daemon

Connect the RPC server to a Monero daemon.

Alias: None.

Inputs:

  • address – string; (Optional; Default: “”) The URL of the daemon to connect to.
  • trusted – boolean; (Optional; Default: false) If false, some RPC wallet methods will be disabled.
  • ssl_support – string; (Optional; Default: autodetect; Accepts: disabled, enabled, autodetect) Specifies whether the Daemon uses SSL encryption.
  • ssl_private_key_path – string; (Optional) The file path location of the SSL key.
  • ssl_certificate_path – string; (Optional) The file path location of the SSL certificate.
  • ssl_ca_file – string; (Optional) The file path location of the certificate authority file.
  • ssl_allowed_fingerprints – array of string; (Optional) The SHA1 fingerprints accepted by the SSL certificate.
  • ssl_allow_any_cert – boolean; (Optional; Default: false) If false, the certificate must be signed by a trusted certificate authority.
  • username – string; (Optional)
  • password – string; (Optional)

Outputs:

  • None

Example:

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.
  • all_accounts – boolean; (Defaults to false)
  • strict – boolean; (Defaults to false) all changes go to 0-th subaddress (in the current subaddress account)

Outputs:

  • balance – unsigned int; The total balance of the current monero-wallet-rpc in session.
  • unlocked_balance – unsigned int; Unlocked funds are those funds that are sufficiently deep enough in the Monero blockchain to be considered safe to spend.
  • multisig_import_needed – boolean; True if importing multisig data is needed for returning a correct balance.
  • time_to_unlock – unsigned int; Time (in seconds) before balance is safe to spend.
  • blocks_to_unlock – unsigned int; Number of blocks before balance is safe to spend.
  • per_subaddress – array of subaddress information; Balance information for each subaddress in an account.
    • account_index – unsigned int;
    • 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.
    • time_to_unlock – unsigned int;
    • blocks_to_unlock – unsigned int;

Example:

get_address

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

Alias: getaddress.

Inputs:

  • account_index – unsigned int; Return the addresses for this account.
  • address_index – array of unsigned int; (Optional, defaults to all) List of address indices to return for the account. Index 0 of account 0 is the primary address, all others are subaddresses.

Outputs:

  • address – string; The first address, in base58, of the requested account index. For account index 0, this is the primary address.
  • addresses – array of address information entries
    • address – string; The (sub)address represented in base58.
    • label – string; Label of the (sub)address
    • address_index – unsigned int; index of the (sub)address.
    • used – boolean; states if the (sub)address has already received funds

Example:

get_address_index

Get account and address indexes from a specific (sub)address

Alias: None.

Inputs:

  • address – String; (sub)address to look for.

Outputs:

  • index – subaddress informations
    • major unsigned int; Account index.
    • minor unsigned int; Address index.

Example:

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.
  • count – unsigned int; (Optional) Number of addresses to create (Defaults to 1).

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.
  • address_indices – array of unsigned int; List of address indices.
  • addresses – array of string; list of addresses.

Example:

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:

validate_address

Analyzes a string to determine whether it is a valid monero wallet address and returns the result and the address specifications.

Inputs:

  • address – string; The address to validate.
  • any_net_type – boolean (Optional); If true, consider addresses belonging to any of the three Monero networks (mainnet, stagenet, and testnet) valid. Otherwise, only consider an address valid if it belongs to the network on which the rpc-wallet’s current daemon is running (Defaults to false).
  • allow_openalias – boolean (Optional); If true, consider OpenAlias-formatted addresses valid (Defaults to false).

Outputs:

  • valid – boolean; True if the input address is a valid Monero address.
  • integrated – boolean; True if the given address is an integrated address.
  • subaddress – boolean; True if the given address is a subaddress
  • nettype – string; Specifies which of the three Monero networks (mainnet, stagenet, and testnet) the address belongs to.
  • openalias_address – string; Address which the OpenAlias-formatted address points to, if given.

Example:

get_accounts

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

Alias: None.

Inputs:

  • tag – string; (Optional) Tag for filtering accounts.
  • regex – boolean; (Optional) allow regular expression filters if set to true (Defaults to false).
  • strict_balances – boolean; (Optional) when true, balance only considers the blockchain, when false it considers both the blockchain and some recent actions, such as a recently created transaction which spent some outputs, which isn’t yet mined. 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:

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:

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:

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:

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:

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:

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:

get_height

Returns the wallet’s current block height.

Alias: getheight.

Inputs: None.

Outputs:

  • height – unsigned int; The current monero-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:

transfer

Send monero to a number of recipients.

Alias: None.

Inputs:

  • destinations – array of destinations to receive XMR:
    • 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 empty – all indices)
  • 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). (Unless dealing with pre rct outputs, this field is ignored on mainnet).
  • unlock_time – unsigned int; Number of blocks before the monero can be spent (0 to not add a lock).
  • 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 monero 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:

transfer_split

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

Alias: None.

Inputs:

  • destinations – array of destinations to receive XMR:
    • 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 empty – all indices)
  • ring_size – unsigned int; Sets ringsize to n (mixin + 1). (Unless dealing with pre rct outputs, this field is ignored on mainnet).
  • unlock_time – unsigned int; Number of blocks before the monero can be spent (0 to not add a lock).
  • payment_id – string; (Optional, defaults to a random ID) 16 characters hex encoded.
  • 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 monero network. (Defaults to false)
  • get_tx_hex – boolean; Return the transactions as hex string after sending
  • get_tx_metadata – boolean; Return list of transaction metadata needed to relay the transfer later.
Chuyên gia chia sẻ  Thông tin dành cho phụ huynh

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.
  • weight_list – array of: integer. Metric used to calculate transaction fee.
  • 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.
  • spent_key_images_list – array of: string. Key images of spent outputs.
    • key_images – array of string;

Example:

sign_transfer

Sign a transaction created on a read-only wallet (in cold-signing process)

Alias: None.

Inputs:

  • unsigned_txset – string. Set of unsigned tx returned by “transfer” or “transfer_split” methods.
  • export_raw – boolean; (Optional) If true, return the raw transaction data. (Defaults to false)
  • get_tx_keys – boolean; (Optional) Return the transaction keys after signing.

Outputs:

  • signed_txset – string. Set of signed tx to be used for submitting transfer.
  • tx_hash_list – array of: string. The tx hashes of every transaction.
  • tx_raw_list – array of: string. The tx raw data of every transaction.
  • tx_key_list – array of: string.

In the example below, we first generate an unsigned_txset on a read only wallet before signing it:

Generate unsigned_txset using the above “transfer” method on read-only wallet:

Sign tx using the previously generated unsigned_txset

submit_transfer

Submit a previously signed transaction on a read-only wallet (in cold-signing process).

Alias: None.

Inputs:

  • tx_data_hex – string; Set of signed tx returned by “sign_transfer”

Outputs:

  • tx_hash_list – array of: string. The tx hashes of every transaction.

In the example below, we submit the transfer using the signed_txset generated above:

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 monero 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.
  • weight_list – array of: integer. Metric used to calculate transaction fee.
  • 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.
  • spent_key_images_list – array of: string. Key images of spent outputs.
    • key_images – array of string;

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

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.
  • subaddr_indices_all – boolean; (Optional) use outputs in all subaddresses within an account (Defaults to false).
  • priority – unsigned int; (Optional) Priority for sending the sweep transfer, partially determines fee.
  • outputs – unsigned int; specify the number of separate outputs of smaller denomination that will be created by sweep operation.
  • ring_size – unsigned int; Sets ringsize to n (mixin + 1). (Unless dealing with pre rct outputs, this field is ignored on mainnet).
  • unlock_time – unsigned int; Number of blocks before the monero can be spent (0 to not add a lock).
  • payment_id – string; (Optional, defaults to a random ID) 16 characters hex encoded.
  • 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.
  • weight_list – array of: integer. Metric used for adjusting fee.
  • 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.
  • spent_key_images_list – array of: string. Key images of spent outputs.
    • key_images – array of string;

Example:

sweep_single

Send all of a specific unlocked output to an address.

Alias: None.

Inputs:

  • address – string; Destination public address.
  • priority – unsigned int; (Optional) Priority for sending the sweep transfer, partially determines fee.
  • outputs – unsigned int; specify the number of separate outputs of smaller denomination that will be created by sweep operation.
  • ring_size – unsigned int; Sets ringsize to n (mixin + 1). (Unless dealing with pre rct outputs, this field is ignored on mainnet).
  • unlock_time – unsigned int; Number of blocks before the monero can be spent (0 to not add a lock).
  • payment_id – string; (Optional, defaults to a random ID) 16 characters hex encoded.
  • get_tx_key – boolean; (Optional) Return the transaction keys after sending.
  • key_image – string; Key image of specific output to sweep.
  • 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_hasht – array of: string. The tx hashes of every transaction.
  • tx_key – array of: string. The transaction keys for every transaction.
  • amount – array of: integer. The amount transferred for every transaction.
  • fee – array of: integer. The amount of fees paid for every transaction.
  • weight – unsigned int; Metric used to calculate transaction fee.
  • tx_blob – array of: string. The tx as hex string for every transaction.
  • tx_metadata – string. 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.
  • spent_key_images – array of: string. Key images of spent outputs.

Example:

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:

store

Save the wallet file.

Alias: None.

Inputs: None.

Outputs: None.

Example:

get_payments

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

WARNING Verify that the payment has a sane unlock_time otherwise the funds might be inaccessible

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.
    • locked – boolean; Is the output spendable.
    • 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:

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.

WARNING Verify that the payment has a sane unlock_time otherwise the funds might be inaccessible.

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.
    • 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:

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.

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.
    • spent – boolean; Indicates if this transfer has been spent.
    • 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.
    • tx_hash – string; Several incoming transfers may share the same hash if they were in the same transaction.
    • frozen – boolean; has the output been frozen by freeze.
    • unlocked – boolean; is the output spendable.
    • block_height – unsigned int;
    • pubkey – string; public key of our owned output.

Example, get all transfers:

Example, get available transfers:

Example, get unavailable transfers:

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 OR “spend_key”.

Outputs:

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

Example (Query view key):

Example (Query mnemonic key):

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):

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
Chuyên gia chia sẻ  Quĩ đầu tư tư nhân (Private Equity- PE) là gì?

Example:

stop_wallet

Store the current state of any open wallet and exit the monero-wallet-rpc process.

Alias: None.

Inputs: None.

Outputs: None.

Example:

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:

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:

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:

set_attribute

Set arbitrary attribute.

Alias: None.

Inputs:

  • key – string; attribute name
  • value – string; attribute value

Outputs: None.

Example:

get_attribute

Get attribute value by name.

Alias: None.

Inputs:

  • key – string; attribute name

Outputs:

  • value – string; attribute value

Example:

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:

check_tx_key

Check a transaction in the blockchain with its secret key.

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 the transaction.

Example:

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:

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.

In the example below, the transaction has been proven:

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

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:

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:

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

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 which to prove reserve. (ignored if all is set to true)
  • amount – unsigned int; Amount (in atomic units) to prove the account has in reserve. (ignored if all is set to true)
  • message – string; (Optional) add a message to the signature to further authenticate the proving process. If a message is added to get_reserve_proof (optional), this message will be required when using check_reserve_proof

Outputs:

  • signature – string; reserve signature.

Example:

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; If a message was added to get_reserve_proof (optional), this message will be required when using check_reserve_proof
  • signature – string; reserve signature to confirm.

Outputs:

  • good – boolean; States if the inputs proves the reserve.
  • spent – unsigned int; Amount (in atomic units) of the total that has been spent.
  • total – unsigned int; Total amount (in atomic units) of the reserve that was proven.

In the example below, the reserve has been proven:

In the example below, all wallet reserve has been proven:

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

get_transfers

Returns a list of transfers.

WARNING Verify that the transfer has a sane unlock_time otherwise the funds might be inaccessible.

Alias: None.

Inputs:

  • in – boolean; (defaults to false) Include incoming transfers.
  • out – boolean; (defaults to false) Include outgoing transfers.
  • pending – boolean; (defaults to false) Include pending transfers.
  • failed – boolean; (defaults to false) Include failed transfers.
  • pool – boolean; (defaults to false) 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; (Optional) 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 empty – all indices).
  • all_accounts – boolean; (Optional) (Defaults to false).

Outputs:

  • in array of transfers:
    • address – string; Public address of the transfer.
    • amount – unsigned int; Amount transferred.
    • amounts – array of unsigned int; If multiple amounts where recived they are individually listed.
    • 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.
    • destinations – array; amount – unsigned int; address – string;
    • 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.
    • subaddr_indices – array; list of indices if multiple where requested.
      • major – unsigned int; Account index for the subaddress.
      • minor – unsigned int; Index of the subaddress under the account.
    • suggested_confirmations_threshold – unsigned int; Number of confirmations needed for the amount received to be lower than the accumulated block reward (or close to that).
    • 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.
    • locked – boolean; Is the output 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:

get_transfer_by_txid

Show information about a transfer to/from this address.

WARNING Verify that the transfer has a sane unlock_time otherwise the funds might be inaccessible.

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; Amount of this transfer.
    • amounts – list; Individual amounts if multiple where received.
    • 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: (only for outgoing transactions)
      • 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.
    • locked – boolean;
    • 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; Number of confirmations needed for the amount received to be lower than the accumulated block reward (or close to that).
    • 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.
  • transfers – list; If the list length is > 1 then multiple outputs where received in this transaction, each of which has its own transfer JSON object.

In the example below, a single output was received at 1 address (note how it is duplicated in transfers:

In the example below, 2 outputs where sent to 2 addresses in the same transaction. Note that transfer contains only one of them, but transfers contains both. If the length of transfers is != 1 then we have received multiple outputs in one transaction and must loop the transfers list accordingly.

describe_transfer

Returns details for each transaction in an unsigned or multisig transaction set. Transaction sets are obtained as return values from one of the following RPC methods:

  • transfer
  • transfer_split
  • sweep_all
  • sweep_single
  • sweep_dust

These methods return unsigned transaction sets if the wallet is view-only (i.e. the wallet was created without the private spend key).

WARNING Verify that the transfer has a sane unlock_time otherwise the funds might be inaccessible.

Inputs:

  • unsigned_txset – string; (Optional) A hexadecimal string representing a set of unsigned transactions (empty for multisig transactions; non-multisig signed transactions are not supported).
  • multisig_txset – string; (Optional) A hexadecimal string representing the set of signing keys used in a multisig transaction (empty for unsigned transactions; non-multisig signed transactions are not supported).

Outputs:

  • desc – The description of the transfer as a list of:
    • amount_in – unsigned int (64 bit); The sum of the inputs spent by the transaction in atomic units.
    • amount_out – unsigned int (64 bit); The sum of the outputs created by the transaction in atomic units.
    • recipients – list of:
      • address – string; The public address of the recipient.
      • amount – unsigned int; The amount sent to the recipient in atomic units.
    • change_address – string; The address of the change recipient.
    • change_amount – unsigned int; The amount sent to the change address in atomic units.
    • fee – unsigned int; The fee charged for the transaction in atomic units.
    • payment_id – string; payment ID for this transfer.
    • ring_size – unsigned int; The number of inputs in the ring (1 real output + the number of decoys from the blockchain) (Unless dealing with pre rct outputs, this field is ignored on mainnet).
    • unlock_time – unsigned int; The number of blocks before the monero can be spent (0 for no lock).
    • dummy_outputs – unsigned int; The number of fake outputs added to single-output transactions. Fake outputs have 0 amount and are sent to a random address.
    • extra – string; Arbitrary transaction data in hexadecimal format.
Chuyên gia chia sẻ  Chi phí trả trước là gì? Thế nào là thanh toán trả trước? Lợi ích và rủi ro của Upfront Cost là gì?

Example:

sign

Sign a string.

Alias: None.

Inputs:

  • data – string; Anything you need to sign.

Outputs:

  • signature – string; Signature generated against the “data” and the account public address.

Example:

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:

export_outputs

Export outputs in hex format.

Alias: None.

Inputs:

  • all – boolean (optional); If true, export all outputs. Otherwise, export outputs since the last export. (default = false)

Outputs:

  • outputs_data_hex – string; wallet outputs in hex format.

Example:

import_outputs

Import outputs in hex format.

Alias: None.

Inputs:

  • outputs_data_hex – string; wallet outputs in hex format.

Outputs:

  • num_imported – unsigned int; number of outputs imported.

Example:

export_key_images

Export a signed set of key images.

Alias: None.

Inputs:

  • all – boolean (optional); If true, export all key images. Otherwise, export key images since the last export. (default = false)

Outputs:

  • offset – unsigned int
  • signed_key_images – array of signed key images:
    • key_image – string;
    • signature – string;

Example:

import_key_images

Import signed key images list and verify their spent status.

Alias: None.

Inputs:

  • offset – unsigned int (optional)
  • 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:

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
  • payment_id – string; (Optional, defaults to a random ID) 16 characters hex encoded.
  • 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:

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; Integer amount to receive, in atomic units (0 if not provided)
    • payment_id – string; (Optional, defaults to a random ID) 16 characters hex encoded.
    • 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:

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:

add_address_book

Add an entry to the address book.

Alias: None.

Inputs:

  • address – string;
  • payment_id – string; (Optional, defaults to a random ID) 16 characters hex encoded.
  • description – (optional) string, defaults to “”;

Outputs:

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

Example:

edit_address_book

Edit an existing address book entry.

Alias: None

Inputs:

  • index – unsigned_int; Index of the address book entry to edit.
  • set_address – boolean; If true, set the address for this entry to the value of “address”.
  • address – string; (Optional) The 95-character public address to set.
  • set_description – boolean; If true, set the description for this entry to the value of “description”.
  • description – string; (Optional) Human-readable description for this entry.
  • set_payment_id – boolean; If true, set the payment ID for this entry to the value of “payment_id”.
  • payment_id – string; (Optional, defaults to a random ID) 16 characters hex encoded.

Outputs: none.

Example:

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:

refresh

Refresh a wallet after openning.

Alias: None.

Inputs:

  • start_height – unsigned int; (Optional) The block height from which to start refreshing. Passing no value or a value less than the last block scanned by the wallet refreshes from the last block scanned.

Outputs:

  • blocks_fetched – unsigned int; Number of new blocks scanned.
  • received_money – boolean; States if transactions to the wallet have been found in the blocks.

Example:

auto_refresh

Set whether and how often to automatically refresh the current wallet.

Inputs:

  • enable – boolean; (Optional) Enable or disable automatic refreshing (default = true).
  • period – unsigned integer; (Optional) The period of the wallet refresh cycle (i.e. time between refreshes) in seconds.

Outputs: none.

Example:

rescan_spent

Rescan the blockchain for spent outputs.

Alias: None.

Inputs: None.

Outputs: None.

Example:

start_mining

Start mining in the Monero 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:

stop_mining

Stop mining in the Monero daemon.

Alias: None.

Inputs: None.

Outputs: None.

Example:

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:

create_wallet

Create a new wallet. You need to have set the argument “-wallet-dir” when launching monero-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:

generate_from_keys

Restores a wallet from a given wallet address, view key, and optional spend key.

Inputs:

  • restore_height – integer; (Optional; defaults to 0) The block height to restore the wallet from.
  • filename – string; The wallet’s file name on the RPC server.
  • address – string; The wallet’s primary address.
  • spendkey – string; (Optional; omit to create a view-only wallet) The wallet’s private spend key.
  • viewkey – string; The wallet’s private view key.
  • password – string; The wallet’s password.
  • autosave_current – boolean; (Defaults to true) If true, save the current wallet before generating the new wallet.

Outputs:

  • address – string; The wallet’s address.
  • info – string; Verification message indicating that the wallet was generated successfully and whether or not it is a view-only wallet.

Example:

open_wallet

Open a wallet. You need to have set the argument “-wallet-dir” when launching monero-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:

restore_deterministic_wallet

Create and open a wallet on the RPC server from an existing mnemonic phrase and close the currently open wallet.

Alias: None.

Inputs:

  • filename – string; Name of the wallet.
  • password – string; Password of the wallet.
  • seed – string; Mnemonic phrase of the wallet to restore.
  • restore_height – integer; (Optional) Block height to restore the wallet from (default = 0).
  • language – string; (Optional) Language of the mnemonic phrase in case the old language is invalid.
  • seed_offset – string; (Optional) Offset used to derive a new seed from the given mnemonic to recover a secret wallet from the mnemonic phrase.
  • autosave_current – boolean; Whether to save the currently open RPC wallet before closing it (Defaults to true).

Outputs:

  • address – string; 95-character hexadecimal address of the restored wallet as a string.
  • info – string; Message describing the success or failure of the attempt to restore the wallet.
  • seed – string; Mnemonic phrase of the restored wallet, which is updated if the wallet was restored from a deprecated-style mnemonic phrase.
  • was_deprecated – boolean; Indicates if the restored wallet was created from a deprecated-style mnemonic phrase.

Example:

close_wallet

Close the currently opened wallet, after trying to save it.

Alias: None.

Inputs: None.

Outputs: None.

Example:

change_wallet_password

Change a wallet password.

Alias: None.

Inputs:

  • old_password – string; (Optional) Current wallet password, if defined.
  • new_password – string; (Optional) New wallet password, if not blank.

Outputs: None.

Example:

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:

Example for a multisig wallet:

prepare_multisig

Prepare a wallet for multisig by generating a multisig string to share with peers.

Alias: None.

Inputs: None.

Outputs:

  • multisig_info – string; Multisig string to share with peers to create the multisig wallet.

Example:

make_multisig

Make a wallet multisig by importing peers multisig string.

Alias: None.

Inputs:

  • multisig_info – array of string; List of multisig string from peers.
  • threshold – unsigned int; Amount of signatures needed to sign a transfer. Must be less or equal than the amount of signature in multisig_info.
  • password – string; Wallet password

Outputs:

  • address – string; multisig wallet address.
  • multisig_info – string; Multisig string to share with peers to create the multisig wallet (extra step for N-1/N wallets).

Example for 2/2 Multisig Wallet:

Example for 2/3 Multisig Wallet:

export_multisig_info

Export multisig info for other participants.

Alias: None.

Inputs: None.

Outputs:

  • info – string; Multisig info in hex format for other participants.

Example:

import_multisig_info

Import multisig info from other participants.

Alias: None.

Inputs:

  • info – array of string; List of multisig info in hex format from other participants.

Outputs:

  • n_outputs – unsigned int; Number of outputs signed with those multisig info.

Example:

finalize_multisig

Turn this wallet into a multisig wallet, extra step for N-1/N wallets.

Alias: None.

Inputs:

  • multisig_info – array of string; List of multisig string from peers.
  • password – string; Wallet password

Outputs:

  • address – string; multisig wallet address.

Example:

sign_multisig

Sign a transaction in multisig.

Alias: None.

Inputs:

  • tx_data_hex – string; Multisig transaction in hex format, as returned by transfer under multisig_txset.

Outputs:

  • tx_data_hex – string; Multisig transaction in hex format.
  • tx_hash_list – array of string; List of transaction Hash.

Example:

submit_multisig

Submit a signed multisig transaction.

Alias: None.

Inputs:

  • tx_data_hex – string; Multisig transaction in hex format, as returned by sign_multisig under tx_data_hex.

Outputs:

  • tx_hash_list – array of string; List of transaction Hash.

Example:

get_version

Get RPC version Major & Minor integer-format, where Major is the first 16 bits and Minor the last 16 bits.

Alias: None.

Inputs: None.

Outputs:

  • version – unsigned int; RPC version, formatted with Major * 2^16 + Minor (Major encoded over the first 16 bits, and Minor over the last 16 bits).

Example:

freeze

Freeze a single output by key image so it will not be used

Alias: None.

Inputs:

  • key_image – string;

Outputs:

  • None

Example:

frozen

Checks whether a given output is currently frozen by key image

Alias: None.

Inputs:

  • key_image – string;

Outputs:

  • frozen – bool;

Example:

thaw

Thaw a single output by key image so it may be used again

Alias: None.

Inputs:

  • key_image – string;

Outputs:

  • None

Example:

exchange_multisig_keys

Performs extra multisig keys exchange rounds. Needed for arbitrary M/N multisig wallets

Alias: None.

Inputs:

  • password – string;
  • multisig_info – string;
  • force_update_use_with_caution – bool; (Optional; Default false) only require the minimum number of signers to complete this round (including local signer) ( minimum = num_signers – (round num – 1).

Outputs:

  • address – string;
  • multisig_info – string;

Example:

estimate_tx_size_and_weight

Alias: None.

Inputs:

  • n_inputs – unsigned int;
  • n_outputs – unsigned int;
  • ring_size – unsigned int; Sets ringsize to n (mixin + 1). (Unless dealing with pre rct outputs, this field is ignored on mainnet).
  • rct – bool; Is this a Ring Confidential Transaction (post blockheight 1220516)

Outputs:

  • size – int;
  • weight – int;

Example:

scan_tx

Given list of txids, scan each for outputs belonging to your wallet. Note that the node will see these specific requests and may be a privacy concern.

Alias: None.

Inputs:

  • txids – string list;

Outputs: None.

Example:

Logfile output:

« Вернуться к списку

Đánh giá bài viết post

Phạm Văn Sỹ

Tôi là Phạm Văn Sỹ chuyên gia uy tín trong lĩnh vực kinh tế và kinh doanh là sinh viên của trường Đại học Ngoại Thương. Với kiến thức sâu rộng sau 12 năm ở bên ngoài thương trường thị trường tôi mong muốn chia sẻ các kiến thức chuyên sâu hữu ích dành cho mọi người.

Related Articles

Check Also
Close
Back to top button