O'Reilly logo

Learning Bitcoin by Richard Caetano

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sending transactions

In Chapter 5, Installing a Bitcoin Node, we used the Bitcoin node to build, sign, and broadcast a Bitcoin transaction using the createrawtransaction, signrawtransaction, and sendrawtransaction commands.

In this example, we'll perform the same operations but using Javascript and the BitcoinJS library. The process involves the same three steps:

  1. Build a transaction with a list of inputs and outputs.
  2. Sign the transaction with the required private keys.
  3. Broadcast the transaction to the network.

Simple transactions

Using the bitcoinjs library, we will work with the TransactionBuilder object to construct a new transaction. We simply provide the object with one or more private keys as the source of our funds and with one or more addresses ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required