Transfer Multi

The transferMulti method enables advanced MNEE transfers using multiple source UTXOs with different private keys. This method provides full control over which UTXOs to spend and is essential for complex wallet operations like consolidation, HD wallet transfers, and multi-signature scenarios.

Usage

Basic Multi-Source Transfer

const options = {
  inputs: [
    { txid: 'abc123...', vout: 0, wif: 'L1PrivateKey...' },
    { txid: 'def456...', vout: 1, wif: 'L2PrivateKey...' }
  ],
  recipients: [
    { address: '1DestinationAddress...', amount: 100 }
  ],
  changeAddress: '1ChangeAddress...'
};

const response = await mnee.transferMulti(options);
console.log('Ticket ID:', response.ticketId);

// Check transaction status
const status = await mnee.getTxStatus(response.ticketId);
console.log('Transaction ID:', status.tx_id);

Multiple Change Addresses

Transfer with Webhook Callback

Parameters

TransferMultiOptions

  • inputs: Array of input UTXOs to spend

    • txid: Transaction ID of the UTXO

    • vout: Output index within the transaction

    • wif: Private key (WIF format) that controls this UTXO

  • recipients: Array of SendMNEE objects for destinations

    • address: Recipient address

    • amount: Amount in MNEE

  • changeAddress (optional): Where to send change

    • Can be a single address (string)

    • Or array of addresses with specific amounts

TransferOptions (second parameter, optional)

  • broadcast: Whether to broadcast the transaction (default: true)

  • callbackUrl: Webhook URL for status updates (only when broadcast is true)

Response

Returns a TransferResponse object:

Common Use Cases

UTXO Consolidation

HD Wallet Transfer

Multi-Wallet Aggregation

Distributed Change

Specific UTXO Selection

Important Notes

  • Each input must have its own WIF (private key)

  • The method does NOT automatically select UTXOs - you must specify exact inputs

  • Total input amount must cover recipients + fees

  • Change calculation is manual unless using single change address

  • When using multiple change addresses, ensure amounts are specified correctly

  • Fees are automatically calculated and deducted from outputs

Error Handling

The transferMulti method can throw several specific errors:

See Also

Last updated