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?

EDIT: It is true that Merchant API will be the way to go when available (it is not at the moment) and that using APIs such as Matter Cloud or What’s on chain is the easiest way to do it right now. But this question is more about understanding how Bitcoin’s server network works. It is an interesting piece of technology. It might also be useful for someone - API providers need to deliver transactions to miners at some point after all.

With that said; this question remains open and bounty still waiting for the right response.

Submit an answer See answers Share on Twitter Share on Facebook
Accepted Answer

Accepted: Start with

I. Start with nslookup ( or )

$ nslookup



Non-authoritative answer:





II. Get list of node addresses using getaddr message

  1. Connect using TCP/IP to one of the address from I.
  2. Send version message and receive (its immediately returned) version response and verack message
  3. Send verack message, receive response
  4. Send getaddr message
  5. Send ping message Now you will be constantly be receiving inv message. Just ignore it and wait until you’ll receive addr message.

This message usually contains 1000 ip addresses for nodes.

III. Send transaction to one of the nodes

  1. Connect
  2. send version receive whatever response, ignore it
  3. Send verack message - receive response, ignore it
  4. Send tx message


  1. I got part I and II working in Python 2.7
  2. Part III is based on my research - didn’t wrote anything but there are articles about it for btc. Look at the python scripts in the same repo: and
  3. so called network magic bytes for bsv is different than btc (and testate has its own network magic)
  4. network magic for bsv: 0xe3e1f3e8
  5. Bitcoin Network protocol is described here
  6. every message has the same header (with message type and size) so you can easily ignore not wanted messages as they are sending to you as a stream (you call socket.recv(1024) and you can get 5 and a half of different messages).

And last thing - nodes that are returned from nslookup supposed to be seed servers but it seems they are full bitcoinsv nodes and they broadcast (and probably accept) transactions so the whole dance at part II is not strictly necessary. Just send your ‘tx’ to one of them.

If you have questions you can contact me I BitQ&A telegram channel (Mikołaj) :)

Of Cause You Can

You can use quick-api, to connect directly to P2P network

npm install -g quickapi-sv

Then you can start it by quickapi

It will listen on 8000, and accept any hex tx in post body and broadcast it.

But be careful, it does not validateTX, because it’s designed for stress test.

You will get banned if you try to broadcast malformed TX

There is no such thing as broadcasting directly to the P2P network

This is not just a matter of technicalities, but also of incentives and legality. Right now very few services are offering that. But in the future, either miners directly or highly specialized second layer nodes will offer that as a service with proper SLA (service legal agreements). No serious business will ever build anything of significance if there is no legal contract being established among the parties. Sending transactions to “P2P network” is a flawed concept as it gives no stability/reliability and involves no legal standards and business practices. The market will (eventually) provide specialized services for specific use cases and will propagate transactions to as many major miners possible based on specific cases. If that service is provided by a miner itself (which is best positioned) offering, it goes the same when it comes to the structure of service. Right now miners do not have many incentives to offer those services as it would represent 0.001% (or something) of revenue. But there are entrepreneurs filling the void already. Miners will become more interested when more significant volume will appear. Merchant API and Miner ID will play an important role here. But not on its own as not every app will want to deal with all the miners at once, but rather a service with proper SLA.

And no, SPV will not solve that problem for you on its own. It’s just a protocol that solves scaling issues and can be utilized by any party. It doesn’t mean necessarily you can talk directly to miners “P2P network” unless you limit yourself to a risk-prone hobby-grade product.

At the moment the best option for this kind of service is to use I would highly recommend it.

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.