Is there a way to transfer your monero in your own wallet to another subaddress you control? I mainly use the monero cli transfer command. Is there a way to reference your own internal subaddress by the index number?
transfer 100 < subaddress_2 >
Is there a way to transfer your monero in your own wallet to another subaddress you control?
Yes. Using the usual
transfer or any of the
sweep_... commands. E.g.
transfer <address> <amount>. Though if the destination address is in the same wallet, there's really not much point in doing this.
What @scoobybejesus is hinting at is this: Accounts and subaddresses are merely an accounting feature. The funds are all in the same wallet. Think of it like a physical wallet with multiple sections for organizing. In a physical wallet you might have a section for daily use and a section for emergencies; but you can use funds from either section whenever you like. And funds can be received directly into either as well.
Note1 that whenever you send funds from your Monero wallet, the wallet will select an address in the currently selected account and try and use outputs received by that address to fund the transaction. This is done to help prevent a statistical linkage. If the selected address has not received enough outputs, another address in the same account is attempted, and so on.
Is there a way to reference your own internal subaddress by the index number?
Not for the destination/receiver but yes for the sending. From
If the parameter "index=<N1>[,<N2>,...]" is specified, the wallet uses outputs received by addresses of those indices.
Specifying indexes essentially overrides (1).
It sounds like you're asking this question because you think that because XMR was sent to a subaddress that the XMR is sitting "in" that subaddress.
My understanding of subaddresses is that they exist solely for the purpose of classifying deposits when they arrive. They are not intended to act like separate wallets (or like separate bank accounts).
An important point is that the wallet is going to strategically choose which outputs to spend to minimize transaction linkability, so making on-chain transfers from subaddress to subaddress is probably unwise.
I know I didn't answer the question directly, but I'm not sure it should be.