What is the best way to broadcast a transaction to the network programatically? I know that blockchain.info has /pushtx but I'm pretty sure it rejects XHR requests from external sources because of CORS.


You should not use an online service for broadcasting transaction. This online-service would have full control (censor?) over your transaction. The service could analyze your data behavior and/or decide to not broadcast your transaction regarding some rules.

Wladimir van der Laan (current bitcoin-core project maintainer) has written a neat tool: https://github.com/laanwj/bitcoin-submittx

Another option would be to install bitcoin-core, sync (takes serval hours and around 40GB traffic) and use RPC sendrawtransaction.

| improve this answer | |
  • or you can use of SPV and send RPC requests to it, fast and light. – Hamid Naghipour May 1 at 6:34

I found what I was looking for. Blockr.io has a good service for publishing transactions to the network. This is the url that you would send a post request to http://btc.blockr.io/api/v1/tx/push

Make sure to send it the transaction as a post request like this:

{"hex" : your transaction in hex}

| improve this answer | |
  • This service is down right now. so use of third party is not secure, block your trx, if it is down you can't use it – Hamid Naghipour May 1 at 6:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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