Socket
Book a DemoInstallSign in
Socket

clarity-bitcoin-client

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clarity-bitcoin-client

Clarity Bitcoin Client is an open-source TypeScript library for interacting with the **[Clarity-Bitcoin-V5](https://explorer.hiro.so/txid/SP2PABAF9FTAJYNFZH93XENAJ8FVY99RRM50D2JG9.clarity-bitcoin-lib-v5?chain=mainnet) contract** on the Stacks blockchain.

latest
npmnpm
Version
1.0.18
Version published
Maintainers
1
Created
Source

Clarity Bitcoin Client

Clarity Bitcoin Client is an open-source TypeScript library for interacting with the Clarity-Bitcoin-V5 contract on the Stacks blockchain.

Given a bitcoin txid the library fetches the block and transaction data necessary to build the merkle proofs to submit to the clarity-bitcoin-lib-v5 contract.

Installation

npm install clarity-bitcoin-client

Usage

1. Library

import { fetchApiData, extractProofInfo, parseWTx, type TxForClarityBitcoin } from "clarity-bitcoin-client";
const data: ProofRequest = await getProofData(req.params.txid, blockHash, getRpcParams());
const pgd: ProofGenerationData = getProofGenerationData(data);
const proof: TransactionProofSet = extractProofInfo(pgd, data);

The bitcoin connection parameters are expected;

{
   rpcHost: CONFIG.rpcHost,
   rpcPort: CONFIG.rpcPort,
   rpcPass: CONFIG.rpcPass,
   rpcUser: CONFIG.rpcUser
}

2. API Usage

A hosted service is avaliable here

Test client

A svelte app using this lib is available here.

Known Issues

  • the bitcoin node is pruned to 500 blocks roughly 3 days of transactions.

Development

Clone the repository and install dependencies:

git clone https://github.com/BigMarketDao/clarity-bitcoin-client.git
cd clarity-bitcoin-client
npm install

Build & Test

npm run build  # Compile to dist/
npm test       # Run tests

Publishing to NPM

npm run build
npm publish

License

MIT

Contributors

Open to contributions! Feel free to submit a PR. 🚀

FAQs

Package last updated on 10 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts