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.
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
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
Statistics
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Topics
Metadata Files
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.
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
Clone the repository:
bash git clone https://github.com/genyleap/bitcoin-rpc.git cd bitcoin-rpcBuild the project:
bash mkdir build cd build cmake .. makeInstall 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.confasrpcuser. - RPC Password: Set in
bitcoin.confasrpcpassword. - 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:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes and push to your fork.
- 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
- Bitcoin Core for the JSON-RPC API.
- JSONCPP for JSON parsing.
- cURL for HTTP requests.
Owner
- Name: The Genyleap ™
- Login: genyleap
- Kind: organization
- Email: info@genyleap.com
- Location: Worldwide
- Website: https://genyleap.com
- Twitter: genyleap
- Repositories: 3
- Profile: https://github.com/genyleap
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
- actions/checkout v2 composite