Installing the Libraries

Overview

OP_NET provides a suite of TypeScript client libraries for building Bitcoin-based smart contract applications. These libraries range from low-level Bitcoin utilities to high-level APIs.

@btc-vision/bitcoin

A low-level client Bitcoin library. Provides Bitcoin primitives, PSBT, address encoding/decoding, payment script creation, and cryptographic operations across multiple networks.

Official Repository

For source code, issues, and contributions, visit the Official GitHub repository.

Package Installation

bash
Install using npm
npm install @btc-vision/bitcoin

Peer Dependencies

The following peer dependencies are required and installed automatically with the core package:

Package Purpose
@btc-vision/bip32 BIP32 HD key derivation with ML-DSA quantum support (BIP360)
@btc-vision/ecpair Secp256k1 EC key pair signing (Schnorr and ECDSA)
tiny-secp256k1 ECC backend

If your package manager does not install peer dependencies automatically, install them manually.

bash
Install using npm
npm install @btc-vision/ecpair @btc-vision/bip321 tiny-secp256k1

@btc-vision/transaction

A low-level client Bitcoin Transaction library. Provides a comprehensive set of functions to facilitate the creation, reading, and manipulation of OP_NET transactions, smart contracts, and other OP_NET-related technologies.

Official Repository

For source code, issues, and contributions, visit the Official Github repository.

Package Installation

Install the library and its Bitcoin library dependency:

bash
Install using npm
npm install @btc-vision/transaction @btc-vision/bitcoin

Peer Dependencies

The following peer dependencies are required and installed automatically with the core packages:

Package Purpose
@btc-vision/bip32 BIP32 HD key derivation with ML-DSA quantum support (BIP360)
@btc-vision/ecpair Secp256k1 EC key pair signing (Schnorr and ECDSA)
@noble/curves Elliptic curve primitives (secp256k1)
@noble/hashes Cryptographic hash functions (SHA-256, RIPEMD-160)
bip39 BIP39 mnemonic phrase generation and validation
pako Zlib compression for bytecode and calldata

If your package manager does not install peer dependencies automatically, install them manually.

bash
Install using npm
npm install @btc-vision/ecpair

opnet Library

The official high-level client library for building applications on OP_NET. Built on top of @btc-vision/bitcoin and @btc-vision/transaction, this library provides type-safe contract interactions, provider management, and transaction broadcasting.

Refers to Using the OP_NET Client Library section for detailled usage instructions.

Official Repository

For source code, issues, and contributions, visit the Official GitHub repository.

Package Installation

Install the library and its dependencies:

bash
Install using npm
npm install opnet @btc-vision/transaction @btc-vision/bitcoin

Peer Dependencies

If your package manager does not resolve peer dependencies automatically, refers to @btc-vision/bitcoin and @btc-vision/transaction sections on this page for installation instructions.