I'm looking for the specs to craft a Monero transaction and then sign this transaction with my Monero private spend key. Then broadcast this signed transaction to a node. I want to do this in javascript. Is there an easy to follow tutorial on how to go about doing this?
2 Answers
Monero transactions are much more than some simple data that is signed with a private key. You need outputs to spend, mixin outputs from the blockchain, lot's of math for RingCT etc. This is one of the reasons the RPC interfaces (daemon and wallet) exist. These can be called by any language which can call a URL and create/parse JSON.
If you use the wallet RPC, you can call transfer with get_tx_metadata: true
and do_not_relay: true
to get tx_metadata
which can later be broadcast with submit_transfer (or of course do this all in one step with just transfer, without the aforementioned parameters).
If you just want to understand the math that goes into RingCT, read the MRL-0005 paper, or the broader Zero to Monero book. And if you just want to understand the structure of a transaction, see the Monero source code which defines the structures used.
-
I don't want to understand the math to know how to use it. I'm building out a service and I just want to know how to make transactions with just the user's private key to send funds. Feb 3, 2019 at 19:38
-
Apologies, your question was broad/misleading ("specs to craft a Monero transaction" for example). Anyway, to make transactions from javascript, you can use the wallet RPC's transfer method. Note, you will still need an actual wallet though, as you cannot make transactions with just a private key. If all you have is the private keys, you will need to restore a new wallet from the keys first: getmonero.org/resources/user-guides/restore_from_keys.html.– jtgrassie ♦Feb 3, 2019 at 20:50
This can now be done with monero-javascript which supports local, offline transaction signing.