Coder Social home page Coder Social logo

mrkara / casper-cpp-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from caspercppsdk/casper-cpp-sdk

0.0 0.0 0.0 9.58 MB

C++ library to interact with the Casper Network nodes via RPC

License: Apache License 2.0

Shell 0.12% C++ 91.08% C 5.14% Assembly 2.95% Makefile 0.68% CMake 0.03%

casper-cpp-sdk's Introduction

Casper C++ SDK

Casper C++ SDK provides an interface to establish a connection between the Casper Blockchain and a client. Currently, the SDK is compatible with Linux systems.

Dependencies

  1. CMake Version 3.0.0 or newer
  2. Doxygen Version 1.8.8 or newer
  3. OpenSSL Version 1.1.1 or newer

Install Instruction of Dependencies

sudo apt-get install build-essential libssl-dev

sudo apt-get install cmake

sudo apt-get install graphviz

sudo apt-get install doxygen

Install instruction of doxygen for CentOS

On CentOS and Rocky Linux:

sudo dnf config-manager --set-enabled powertools
sudo dnf install doxygen

How to clone the SDK

git clone https://github.com/yusufketen/casper-cpp-sdk.git

Build

Debug

cmake -DCMAKE_BUILD_TYPE=Debug .
make all

Release

cmake -DCMAKE_BUILD_TYPE=Release .
make all

Test

cmake -DCMAKE_BUILD_TYPE=Debug .
make all
./test/CasperSDK_test -v

Run Examples

cmake -DCMAKE_BUILD_TYPE=Debug .
make all
./examples/example

Install

cmake -DCMAKE_BUILD_TYPE=Release .
make all
sudo make install

How to integrate Casper C++ SDK into your project

1. Include the header file to the application file.
    #include "CasperClient.h"
2. Link the installed SDK to the application. A CMake example is given below.
    add_executable(ApplicationName main.cpp)
    target_link_libraries(ApplicationName PUBLIC CasperSDK)

How to use the Casper C++ SDK

Usage of the RPC functions are described in the examples/HelloSDK.cpp file.

1. Define a CasperClient object and connect to the Casper Blockchain. Replace the IP address and port number to the IP address and port number of any Casper Blockchain node.
    Casper::Client client("http://127.0.0.1:7777");

2. Call the client object member functions listed with their return types below to perform RPC functions.
Client Function Return Type
GetNodePeers Casper::InfoGetPeersResult
GetStateRootHash Casper::GetStateRootHashResult
GetDeployInfo Casper::GetDeployInfoResult
GetStatusInfo Casper::GetStatusResult
GetBlockTransfers Casper::GetBlockTransfersResult
GetBlock Casper::GetBlockResult
GetEraInfoBySwitchBlock Casper::GetEraInfoResult
GetItem Casper::GetItemResult
GetDictionaryItem Casper::GetDictionaryItemResult
GetAccountBalance Casper::GetBalanceResult
GetAuctionInfo Casper::GetAuctionInfoResult
PutDeploy Casper::PutDeployResult

Documentation

cd docs
doxygen Doxyfile

The documentation will be available in the "docs/html/index.html" file.

External Libraries

  1. https://github.com/nlohmann/json
  2. https://github.com/jsonrpcx/json-rpc-cxx
  3. https://github.com/yhirose/cpp-httplib
  4. https://github.com/weidai11/cryptopp
  5. https://github.com/Neargye/magic_enum
  6. https://github.com/codeinred/recursive-variant
  7. https://github.com/ckormanyos/wide-integer
  8. https://github.com/mity/acutest

casper-cpp-sdk's People

Contributors

mrkara avatar numlocksoft avatar yusufketen 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.