Welcome to the best Javascript Bitcoin guide! We will explain how to create all the various types of Bitcoin transactions, using the BitcoinJS library.
We will use the Bitcoin Core command-line interface in Regtest mode for various common tasks, as well as some
complementary libraries like bx
aka Libbitcoin Explorer.
Throughout this guide, we want to give enough explanation to each command to understand it, but without drowning the reader in information. You can refer to additional resources to better understand the Bitcoin protocol. For example, check out our Bitcoin Studio presentations.
At the moment, Bitcoin Javascript tutorials are still very scarce, but we believe it doesn't have to be this way. The present guide intend to address this problem.
Already having a theoretical knowledge of the Bitcoin protocol will surely help, but we provide sufficiently detailed explanation throughout this guide so that it remains accessible to beginners.
Technical requirements
- Node v10.x or superior
- BitcoinJS v4.x or superior
- Bitcoin Core v17.x or superior
- Libbitcoin Explorer v3.4.x or superior
Unless otherwise noted, the contents of this repository are Copyright ©2018 by Bitcoin Studio and are licensed CC-BY.
PART ONE: PREPARING THE WORK ENVIRONMENT
- 1.0: Introduction to Bitcoin Programming with BitcoinJS and Bitcoin Core
- 2.0: Generating and Importing Wallets
PART TWO: PAY TO PUBLIC KEY HASH
- 3.0: Legacy P2PKH
- 3.1: Simple Transaction (1 input, 1 output) - Legacy P2PKH
- 3.2: Typical Transaction (1 input, 2 outputs) - Legacy P2PKH
- 3.3: UTXO Consolidation (5 inputs, 1 output) - Legacy P2PKH
- 3.4: Batching Transaction (1 input, 5 outputs) - Legacy P2PKH
- 3.5: Coinjoin Transaction (4 inputs, 4 outputs) - Legacy P2PKH
- 4.0: Native Segwit P2WPKH
- 5.0: Spend a Embedded Segwit P2SH-P2WPKH UTXO
- 6.0: Embedding Data With OP_RETURN
PART THREE: PAY TO SCRIPT HASH
- 7.0: Bitcoin Script Puzzles or Pay to Script Hash
- 8.0: Multi-signature Transactions
- 9.0: Timelock Transactions
Please consider making a donation so that I can continue producing free educational content
Donate with Bitcoin | 3CmJsUcx6txveq32kVqG92pczc1suLh6BD