1

I want to create an end-to-end test in order to validate that an application doesn't let you spend before an incoming transaction confirms. I'm trying to broadcast an invalid tx to the Monero network via Monero's JSON RPC.

curl --request POST \
  --url http://127.0.0.1:38084/json_rpc \
  --header 'Authorization: Basic [redacted]' \
  --header 'Content-Type: application/jsons/developer-guides/wallet-rpc.html' \
  --data '{"jsonrpc":"2.0","id":"0","method":"transfer","params":{"destinations":[{"amount":250000,"address":"[redacted]"}],"priority":0,"get_tx_metadata":true}}'

Problem is, there are too many sanity checks. I need to force monero to broadcast this transaction regardless of its invalid nature.

{
  "error": {
    "code": -17,
    "message": "not enough money"
    },
  "id": "2555",
  "jsonrpc": "2.0"
}

I have read https://web.getmonero.org/resources/developer-guides/wallet-rpc.html, and I have asked on /r/monerosupport, I have also searched online for solutions to this issue, and haven't found anything useful.

I guess it doesn't necessarily have to be a double-spend, it just needs to attempt to spend more crypto than the wallet's actual balance, even though the transaction is fully intended to fail confirmation.

1 Answer 1

1

Create and fund a test wallet, once confirmed, perform the following on the test wallet:

Create a valid transaction with all funds and do_not_relay:true, create another identical transaction but without do_not_relay (which sends/relays), wait for it to confirm, then relay_tx the output of the first (the one you didn't relay), it will be rejected as tries to double spend.

Your Answer

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

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