Skip to content

mubarak23/bitcoin-ts-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bitcoin JSON-RPC Client (TypeScript)

A lightweight, type-safe, and modern TypeScript client for interacting with a Bitcoin Core node using JSON-RPC.

License NPM Version Build Status


✨ Features

  • Supports Bitcoin Core v24+ JSON-RPC methods
  • Written in modern TypeScript
  • Fully typed with helpful return types
  • Easy to extend
  • Includes basic unit tests

📦 Installation

npm install bitcoin-ts-client
# or
yarn add bitcoin-ts-client

🛠 Usage

import { BitcoinClient } from 'bitcoin-ts-client';

const client = new BitcoinClient(
  'http://localhost:8332', // RPC URL
  'rpcuser',               // RPC Username
  'rpcpassword'            // RPC Password
);

// Example: Get blockchain info
async function main() {
  const info = await client.getBlockchainInfo();
  console.log(info);
}

main();

✅ Available Methods

You can call common Bitcoin Core RPC methods like:

  • getBlockchainInfo()
  • getNetworkInfo()
  • getBlockCount()
  • getBlockHash(height)
  • getBlock(hash)
  • getRawTransaction(txid, verbose)
  • getNewAddress(label?, addressType?)

Want to request support for more methods? Open an issue or contribute!


🧪 Testing

This package uses Jest for testing.

Run Tests

npm run test

Tests are located under the tests/ directory.


🧱 Development

# Install dependencies
npm install

# Build the project
npm run build

# Run tests
npm run test

📄 License

This project is open-source and available under the MIT License.


🤝 Contributing

We welcome contributions! To contribute:

  1. Fork the repo
  2. Create a new branch: git checkout -b feature-name
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin feature-name
  5. Open a pull request

Please make sure to run tests and follow the coding style before submitting.


🧠 Resources


👥 Authors


📬 Support

If you find this project useful, give it a ⭐ on GitHub. For support, open an issue.

About

A lightweight, type-safe, and modern TypeScript client for interacting with a [Bitcoin Core](https://bitcoincore.org/en/) node using JSON-RPC.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published