z_mergetoaddress - Zcash 5.10.0 RPC

z_mergetoaddress ["fromaddress", ... ] "toaddress" ( fee ) ( transparent_limit ) ( shielded_limit ) ( memo ) ( privacyPolicy )

Merge multiple UTXOs and notes into a single UTXO or note.  Coinbase UTXOs are ignored; use `z_shieldcoinbase`
to combine those into a single note.

This is an asynchronous operation, and UTXOs selected for merging will be locked.  If there is an error, they
are unlocked.  The RPC call `listlockunspent` can be used to return a list of locked UTXOs.

The number of UTXOs and notes selected for merging can be limited by the caller.  If the transparent limit
parameter is set to zero will mean limit the number of UTXOs based on the size of the transaction.  Any limit is
constrained by the consensus rule defining a maximum transaction size of 100000 bytes before Sapling, and 2000000
bytes once Sapling activates.

Arguments:
1. fromaddresses         (array, required) A JSON array with addresses.
                         The following special strings are accepted inside the array:
                             - "ANY_TADDR":   Merge UTXOs from any taddrs belonging to the wallet.
                             - "ANY_SPROUT":  Merge notes from any Sprout zaddrs belonging to the wallet.
                             - "ANY_SAPLING": Merge notes from any Sapling zaddrs belonging to the wallet.
                         While it is possible to use a variety of different combinations of addresses and the above values,
                         it is not possible to send funds from both sprout and sapling addresses simultaneously. If a special
                         string is given, any given addresses of that address type will be counted as duplicates and cause an error.
    [
      "address"          (string) Can be a taddr or a zaddr
      ,...
    ]
2. "toaddress"           (string, required) The taddr or zaddr to send the funds to.
3. fee                   (numeric, optional, default=null) The fee amount in ZEC to attach to this transaction. The default behavior
                         is to use a fee calculated according to ZIP 317.
4. transparent_limit     (numeric, optional, default=50) Limit on the maximum number of UTXOs to merge.  Set to 0 to use as many as will fit in the transaction.
5. shielded_limit        (numeric, optional, default=20 Sprout or 200 Sapling Notes) Limit on the maximum number of notes to merge.  Set to 0 to merge as many as will fit in the transaction.
6. "memo"                (string, optional) Encoded as hex. When toaddress is a zaddr, this will be stored in the memo field of the new note.
7. privacyPolicy         (string, optional, default="LegacyCompat") Policy for what information leakage is acceptable.
                         One of the following strings:
                               - "FullPrivacy": Only allow fully-shielded transactions (involving a single shielded value pool).
                               - "LegacyCompat": If the transaction involves any Unified Addresses, this is equivalent to
                                 "FullPrivacy". Otherwise, this is equivalent to "AllowFullyTransparent".
                               - "AllowRevealedAmounts": Allow funds to cross between shielded value pools, revealing the amount
                                 that crosses pools.
                               - "AllowRevealedRecipients": Allow transparent recipients. This also implies revealing
                                 information described under "AllowRevealedAmounts".
                               - "AllowRevealedSenders": Allow transparent funds to be spent, revealing the sending
                                 addresses and amounts. This implies revealing information described under "AllowRevealedAmounts".
                               - "AllowFullyTransparent": Allow transaction to both spend transparent funds and have
                                 transparent recipients. This implies revealing information described under "AllowRevealedSenders"
                                 and "AllowRevealedRecipients".
                               - "AllowLinkingAccountAddresses": Allow selecting transparent coins from the full account,
                                 rather than just the funds sent to the transparent receiver in the provided Unified Address.
                                 This implies revealing information described under "AllowRevealedSenders".
                               - "NoPrivacy": Allow the transaction to reveal any information necessary to create it.
                                 This implies revealing information described under "AllowFullyTransparent" and
                                 "AllowLinkingAccountAddresses".

Result:
{
  "remainingUTXOs": xxx               (numeric) Number of UTXOs still available for merging.
  "remainingTransparentValue": xxx    (numeric) Value of UTXOs still available for merging.
  "remainingNotes": xxx               (numeric) Number of notes still available for merging.
  "remainingShieldedValue": xxx       (numeric) Value of notes still available for merging.
  "mergingUTXOs": xxx                 (numeric) Number of UTXOs being merged.
  "mergingTransparentValue": xxx      (numeric) Value of UTXOs being merged.
  "mergingNotes": xxx                 (numeric) Number of notes being merged.
  "mergingShieldedValue": xxx         (numeric) Value of notes being merged.
  "opid": xxx                         (string) An operationid to pass to z_getoperationstatus to get the result of the operation.
}

Examples:
> zcash-cli z_mergetoaddress '["ANY_SAPLING", "t1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd"]' ztestsapling19rnyu293v44f0kvtmszhx35lpdug574twc0lwyf4s7w0umtkrdq5nfcauxrxcyfmh3m7slemqsj
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "z_mergetoaddress", "params": [["ANY_SAPLING", "t1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd"], "ztestsapling19rnyu293v44f0kvtmszhx35lpdug574twc0lwyf4s7w0umtkrdq5nfcauxrxcyfmh3m7slemqsj"] }' -H 'content-type: text/plain;' http://127.0.0.1:8232/


Maintained by @_garethtdavies; modified by: mdr0id;license of the docs is MIT (see zcash repo), license of the scripts and webpage is also MIT (github repo)

Note it uses a mainnet zcash node