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.
sudo apt-get install build-essential libssl-dev
sudo apt-get install cmake
sudo apt-get install graphviz
sudo apt-get install doxygen
On CentOS and Rocky Linux:
sudo dnf config-manager --set-enabled powertools
sudo dnf install doxygen
git clone https://github.com/yusufketen/casper-cpp-sdk.git
cmake -DCMAKE_BUILD_TYPE=Debug .
make all
cmake -DCMAKE_BUILD_TYPE=Release .
make all
cmake -DCMAKE_BUILD_TYPE=Debug .
make all
./test/CasperSDK_test -v
cmake -DCMAKE_BUILD_TYPE=Debug .
make all
./examples/example
cmake -DCMAKE_BUILD_TYPE=Release .
make all
sudo make install
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)
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 |
cd docs
doxygen Doxyfile
The documentation will be available in the "docs/html/index.html" file.
- https://github.com/nlohmann/json
- https://github.com/jsonrpcx/json-rpc-cxx
- https://github.com/yhirose/cpp-httplib
- https://github.com/weidai11/cryptopp
- https://github.com/Neargye/magic_enum
- https://github.com/codeinred/recursive-variant
- https://github.com/ckormanyos/wide-integer
- https://github.com/mity/acutest