Code Monkey home page Code Monkey logo

bitcoin-api-cpp's Introduction

Bitcoin API

This is a C++ wrapper library for JSON-RPC communication with the Bitcoin daemon. It allows developers to communicate with the Bitcoin daemon without the need to pack and unpack JSON-RPC messages and thus simplifies the interaction with it.

Building the library

Build Status

Dependencies

This library requires CMake, Curl, libjson-cpp and libjson-rpc-cpp packages in order to be built. All of them, with the exception of libjson-rpc-cpp, can be installed as follows

sudo apt-get install cmake libcurl4-openssl-dev libjsoncpp-dev

For the libjson-rpc-cpp library the instructions on libjson-rpc-cpp must be followed.

Build and install

Navigate to the root directory of the library and proceed as follows:

mkdir build
cd build
cmake ..
make
sudo make install

Using the library

This example will show how the library can be used in your project.

Filename getbalance.cpp

#include <bitcoinapi/bitcoinapi.h>

int main()
{
    std::string username = "user";
    std::string password = "pass";
    std::string address = "127.0.0.1";
    int port = 8332;

    /* Constructor to connect to the bitcoin daemon */
    BitcoinAPI btc(username, password, address, port);

    /* Example method - getbalance */
    std::cout << "Wallet balance: " << btc.getbalance() << std::endl;
}

To successfully compile the program you need to link it with the new library:

g++ getbalance.cpp -lbitcoinapi

The full list of available API calls can be found here. Nearly the complete list of calls is implemented and thoroughly tested.

License

The bitcoin-api-cpp library is released under the terms of MIT.

Copyright (c) 2014 Krzysztof Okupski

Permission is hereby granted, free of charge, to any person obtaining a copy of 
this software and associated documentation files (the "Software"), to deal in the 
Software without restriction, including without limitation the rights to 
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 
the Software, and to permit persons to whom the Software is furnished to do so, 
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all 
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 
OR OTHER DEALINGS IN THE SOFTWARE.

Used libraries

  • libjson-rpc-cpp C++ framework for JSON-RPC communication. Note that I am using a modified version of this library in order for it to work correctly with the Bitcoin daemon.

Acknowledgements

The original idea for a C++ wrapper for JSON-RPC communication originates from here. Upon closer evaluation, however, the library contained too many bugs and was thus completely rebuilt from bottom up.

bitcoin-api-cpp's People

Contributors

minium avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.