bitcoin-rpc

A high-performance C++ library for interacting with Bitcoin Core's JSON-RPC API. Designed for developers building blockchain tools, wallets, or analytics platforms.

https://github.com/genyleap/bitcoin-rpc

Science Score: 31.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.9%) to scientific vocabulary

Keywords

bitcoin bitcoin-api bitcoin-rpc cpp
Last synced: 6 months ago · JSON representation ·

Repository

A high-performance C++ library for interacting with Bitcoin Core's JSON-RPC API. Designed for developers building blockchain tools, wallets, or analytics platforms.

Basic Info
  • Host: GitHub
  • Owner: genyleap
  • License: mit
  • Language: C++
  • Default Branch: main
  • Homepage:
  • Size: 157 KB
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
bitcoin bitcoin-api bitcoin-rpc cpp
Created about 1 year ago · Last pushed about 1 year ago
Metadata Files
Readme License Code of conduct Citation Security

README.md

Bitcoin RPC Client

A lightweight and easy-to-use C++ client for interacting with a Bitcoin node via JSON-RPC. This library provides a comprehensive interface to communicate with a Bitcoin node, enabling developers to perform various blockchain operations, manage wallets, and interact with the Bitcoin network. splash License C++


Features

  • Full JSON-RPC Support: Implements all Bitcoin Core RPC methods.
  • Easy Integration: Simple and intuitive API for interacting with a Bitcoin node.
  • Cross-Platform: Works on Linux, macOS, and Windows.
  • Modular Design: Extensible and customizable for advanced use cases.
  • Comprehensive Documentation: Well-documented code with examples.

Installation

Prerequisites

  • Bitcoin Core: Ensure you have a running Bitcoin node with JSON-RPC enabled.
  • C++ Compiler: Supports C++23 or later (e.g., GCC, Clang, or MSVC).
  • Dependencies:

Build Instructions

  1. Clone the repository: bash git clone https://github.com/genyleap/bitcoin-rpc.git cd bitcoin-rpc

  2. Build the project: bash mkdir build cd build cmake .. make

  3. Install the library (optional): bash sudo make install


Usage

Basic Example

Here’s how to use the BitcoinClient to interact with a Bitcoin node:

```cpp

include "bitcoinclient.hpp"

include

int main() { // Initialize the Bitcoin client BitcoinClient client("rpcuser", "rpcpassword", "http://127.0.0.1:8332/");

// Get the best block hash
Json::Value bestBlockHash = client.getBestBlockHash();
std::cout << "Best Block Hash: " << bestBlockHash.asString() << std::endl;

// Get blockchain info
Json::Value blockchainInfo = client.getBlockchainInfo();
std::cout << "Blockchain Height: " << blockchainInfo["blocks"].asInt() << std::endl;

return 0;

} ```

Available Methods

The BitcoinClient class supports all Bitcoin Core RPC methods, including:

  • Blockchain RPCs: getBestBlockHash, getBlock, getBlockchainInfo, etc.
  • Wallet RPCs: getBalance, sendToAddress, createWallet, etc.
  • Network RPCs: getNetworkInfo, addNode, ping, etc.
  • Mining RPCs: getMiningInfo, getBlockTemplate, submitBlock, etc.
  • Raw Transactions RPCs: createRawTransaction, signRawTransaction, sendRawTransaction, etc.

For a full list of methods, refer to the documentation.


Configuration

To connect to your Bitcoin node, update the following parameters in your code:

  • RPC Username: Set in bitcoin.conf as rpcuser.
  • RPC Password: Set in bitcoin.conf as rpcpassword.
  • RPC URL: Default is http://127.0.0.1:8332/.

Example bitcoin.conf: ini rpcuser=yourusername rpcpassword=yourpassword rpcallowip=127.0.0.1 server=1


Documentation

For detailed documentation, refer to the header file. Each method is documented with Doxygen-style comments, including descriptions, parameters, return values, and examples.

To generate the documentation locally: bash doxygen Doxyfile


Contributing

Contributions are welcome! If you’d like to contribute, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bugfix.
  3. Commit your changes and push to your fork.
  4. Submit a pull request with a detailed description of your changes.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Support

If you find this project useful, please consider giving it a ⭐️ on GitHub. For questions or issues, open an issue.


Acknowledgments

Owner

  • Name: The Genyleap ™
  • Login: genyleap
  • Kind: organization
  • Email: info@genyleap.com
  • Location: Worldwide

Revolution of the software leap.

Citation (CITATION.md)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Asadzadeh"
  given-names: "Kambiz"
  orcid: "https://orcid.org/0009-0009-2065-3977"
title: "PT"
version: 1.1.222
date-released: 2023-04-25
url: "https://kambizasadzadeh.com"
repository-code: "https://github.com/genyleap/Project-Template"

GitHub Events

Total
  • Watch event: 2
  • Push event: 4
  • Create event: 3
Last Year
  • Watch event: 2
  • Push event: 4
  • Create event: 3

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/sync-from-template.yml actions
  • actions/checkout v2 composite