Skip to content

Latest commit

 

History

History

README.md

OPNet Client Library Documentation

Welcome to the comprehensive documentation for opnet, the official client library for building Bitcoin-based applications on OPNet.

Quick Start

npm install opnet @btc-vision/transaction @btc-vision/bitcoin
import { getContract, IOP20Contract, JSONRpcProvider, OP_20_ABI } from 'opnet';
import { networks } from '@btc-vision/bitcoin';

// Connect to OPNet
const provider = new JSONRpcProvider({ url: 'https://regtest.opnet.org', network: networks.regtest });

// Interact with a token contract
const token = getContract<IOP20Contract>(
    'op1...',  // contract address
    OP_20_ABI,
    provider,
    networks.regtest
);

// Read token balance
const balance = await token.balanceOf(myAddress);
console.log('Balance:', balance.properties.balance);

Complete Table of Contents

Getting Started


Providers


Smart Contract Interactions


Examples


Working with Bitcoin


Working with Blocks


Working with Epochs


Storage Operations


Working with Transactions


Working with Public Keys


Utilities


ABI Reference


API Reference