How to broadcast a transaction to the Bitcoin Peer-to-peer network?

Let’s say a developer wants to broadcast transactions from their app directly to the P2P network (not using RPC calls). How would this be done? I assume a TCP/IP connection needs to be established to one of the active nodes. What follows after that? Which messages need to be exchanged (examples would be very welcome)? Can connection be closed after the broadcast or should the app maintain its connection?

Bonus question: How to discover other nodes and broadcast the transaction to multiple peers in parallel?

Is there any curated list of the IP addresses of the nodes that belong to major miners?

Submit an answer See answers Share on Twitter Share on Facebook
There are currently no answers to this questions. Add one!

You are creating this answer as an anonymous user. If you log in we will be able to store the draft as you write it.

Submit an Answer

By swiping I acknowledge that the answer will be immutably stored on the Bitcoin SV blockchain forever and that I take full responsibility for any legal or other consequences that might be related to that.
Made with in Slovenia.