From aa3209b72c4fdf5810853dac323acd628f3250b1 Mon Sep 17 00:00:00 2001 From: Daniela Brozzoni Date: Tue, 8 Oct 2024 15:28:29 +0200 Subject: [PATCH] rest: Add "/broadcast" endpoint --- doc/REST-interface.md | 7 ++++- src/node/transaction.cpp | 6 ++--- src/rest.cpp | 44 +++++++++++++++++++++++++++++++ test/functional/interface_rest.py | 12 +++++++++ 4 files changed, 65 insertions(+), 4 deletions(-) diff --git a/doc/REST-interface.md b/doc/REST-interface.md index 6664bc2a3ae1d1..d9969db10fc1df 100644 --- a/doc/REST-interface.md +++ b/doc/REST-interface.md @@ -36,6 +36,12 @@ Responds with 404 if the transaction doesn't exist. By default, this endpoint will only search the mempool. To query for a confirmed transaction, enable the transaction index via "txindex=1" command line / configuration option. +`POST /rest/broadcast.hex` + +Broadcasts a transaction. +The transaction hex must be passed in the body of the request. +Returns the txid if the transaction was broadcasted correctly, responds with 400 if the transaction hex can't be parsed or if broadcasting failed. + #### Blocks - `GET /rest/block/.` - `GET /rest/block/notxdetails/.` @@ -143,7 +149,6 @@ Refer to the `getrawmempool` RPC help for details. Defaults to setting *Query parameters for `verbose` and `mempool_sequence` available in 25.0 and up.* - Risks ------------- Running a web browser on the same node with a REST enabled bitcoind can be a risk. Accessing prepared XSS websites could read out tx/block data of your node by placing links like `