2

I used the following command to pass a monero transaction with the daemon :

{"jsonrpc":"2.0","id":"0","method":"transfer","params":{"account_index":2,"destinations":[{"amount":100000000,"address":"9wNgSYy2F9qPZu7KBjvsFgZLTKE2TZgEpNFbGka9gA5zPmAXS35QzzYaLKJRkYTnzgArGNX7TvSqZC87tBLwtaC5RQgJ8rm"}]}}

But I need a command whose I can define the source address from which I can send the coin monero.

1 Answer 1

1

Each account in a wallet has a number, and each subaddress in an account has a number.

You can add the account_index and subaddr_indices options when calling the transfer method to indicate from which subaddress (or subaddresses) the coins will be taken.

For example to use subaddress n°3 in account n°2 as source of the coins:

{"jsonrpc":"2.0",
 "id":"0",
 "method":"transfer",
 "params":{"account_index":2,
           "subaddr_indices":[3],
           "destinations":[{"amount":100000000, "address":"9wNgSYy2F9qPZu7KBjvsFgZLTKE2TZgEpNFbGka9gA5zPmAXS35QzzYaLKJRkYTnzgArGNX7TvSqZC87tBLwtaC5RQgJ8rm"}],
           "get_tx_key":true}}

The documentation of the transfer method is here.

3
  • I already tried with these params but the transaction did not send and this error message is returned : { "error": { "code": -16, "message": "tx not possible" }, "id": "0", "jsonrpc": "2.0" }
    – MoneroDev
    Jul 10, 2018 at 9:29
  • Have you checked if the source subaddress contains enough funds for the amount sent and the fee? Are there more details about the error in the logs of monero-wallet-rpc?
    – glv
    Jul 10, 2018 at 12:52
  • yes the address contains enough mony for the transaction and all the params is correct but the same errors
    – MoneroDev
    Jul 10, 2018 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.