bitcoinjs / bitcoinjs-lib

A javascript Bitcoin library for node.js and browsers.
MIT License
5.68k stars 2.1k forks source link

How to broadcast a transaction? #839

Closed vekexasia closed 7 years ago

vekexasia commented 7 years ago

Hello,

I'm new to BTC and wouldn't want to screw things up. Lets say I can craft and sign a new tx with this library. How do I send it to the network?

arunoda commented 7 years ago

Use this: https://blockchain.info/pushtx or https://blockr.io/tx/push or similar.

(You can push with multiple sites and it's safe)

dcousens commented 7 years ago

If you have a bitcoind node: sendrawtransaction, or use an API as @arunoda suggested

vekexasia commented 7 years ago

Hello @arunoda it seems i cant find an API for any of that.

just regular http form.

dcousens commented 7 years ago
curl -d '{"hex":"TX_HASH"}' http://btc.blockr.io/api/v1/tx/push

From https://blockr.io/documentation/api

edit: blockr is gone

dcousens commented 7 years ago
POST https://blockchain.info/pushtx

For blockchain.info

murphman300 commented 6 years ago

New here

Half the links on this thread points to Coinbase's API on my end.. So just to be clear, your official recommendation is to use a third-party API to broadcast?

dcousens commented 6 years ago

So just to be clear, your official recommendation is to use a third-party API to broadcast?

3rd party, 1st party, it doesn't matter, bitcoinjs-lib doesn't connect to the bitcoin network, so you need to use something else. But that something can be your own bitcoind node.

murphman300 commented 6 years ago

Ahh alright, makes more sense now. Still getting the hang of things :)

educob commented 5 years ago

Hi.

I have a bitcoind but I don't know how to broadcast a transaction.

Thanks.

dabura667 commented 5 years ago

sendrawtransaction RPC call or cli.