Skip to content

deyanzz/hedera-sdk-cpp

 
 

Repository files navigation

Hedera™ C++ SDK

The SDK for interacting with Hedera Hashgraph: the official distributed consensus platform built using the hashgraph consensus algorithm for fast, fair and secure transactions. Hedera enables and empowers developers to build an entirely new class of decentralized applications.

Prerequisites

For MacOS and Linux users (these can be installed with brew install or apt-get install, respectively):

  • ninja
    • MacOS: brew install ninja
  • pkg-config
    • MacOs: brew install pkg-config
  • cmake
    • MacOS: brew install cmake

For Windows users:

  • Visual Studio 2019/2022 Community/Pro with Universal Windows Platform Development Tools
  • Perl (perl.exe must be added to %PATH%)
  • NASM (nasm.exe must be added to %PATH%)

Preparing the Local Node

To run the Integration Tests locally, first you will need to install the Hedera Local Node. Follow the instructions given in the Readme.md.

Build

This project features CMake Presets which simplify the setup of vcpkg based dependencies. The below commands are typically all that is required.

  1. Clone the project
git clone https://github.com/hashgraph/hedera-sdk-cpp.git`
  1. CD to your project directory
cd hedera-sdk-cpp
  1. Complete the following tasks within your project directory
# Ensure the VCPkg Submodule is initialized
git submodule update --init

# Windows (x64) Build
cmake --preset windows-x64-release
cmake --build --preset windows-x64-release

# Linux (x64) Build
cmake --preset linux-x64-release
cmake --build --preset linux-x64-release

# MacOS (Intel x64) Build
cmake --preset macos-x64-release
cmake --build --preset macos-x64-release

# MacOS (Aarch64) Build
cmake --preset macos-arm64-release
cmake --build --preset macos-arm64-release

Testing

To run all SDK tests:

ctest -C Release --test-dir build/<PRESET>

To run a specific test:

ctest -C Release --test-dir build/<PRESET> -R <NAME OF TEST>

Running Integration Tests

To run the integration tests it's necessary to have a running Hedera Local Node. If the local node is already running, check the configuration JSON file for the network settings. Ensure the values for network tag contains a valid AccountId and a valid IP address for an operational node.

Example config file:

{
    "network": {
        "0.0.3": "127.0.0.1:50211"
    },
     
    "operator": {
        "accountId": "0.0.2",
        "privateKey": "302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137"
    }
}

(Source: /config/local_node.json)

To execute a specific integration test, you can use the command from above:

ctest -C Release --test-dir build/<PRESET> -R <NAME OF TEST>

Contributing

To run the integration tests it's necessary to have a running Hedera Local Node. If the local node is already running, check the configuration JSON file for the network settings. Ensure the values for network tag contains a valid AccountId and a valid IP address for an operational node.

Example config file:

{
    "network": {
        "0.0.3": "127.0.0.1:50211"
    },
     
    "operator": {
        "accountId": "0.0.2",
        "privateKey": "302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137"
    }
}

(Source: /config/local_node.json)

To execute a specific integration test, you can use the command from above:

ctest -C Release --test-dir build/<PRESET> -R <NAME OF TEST>

Contributing to this Project

We welcome participation from all developers!

For instructions on how to contribute to this repo, please review the Contributing Guide for C++.

More instructions for contribution can be found in the Global Contributing Guide.

Code of Conduct

This project is governed by the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code of conduct.

If you need to prepare a new SDK release, then see the Step-by-Step guide how to do it.

License

Apache License 2.0

About

C++ SDK for Hedera

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 94.5%
  • Solidity 3.3%
  • PureBasic 1.1%
  • CMake 1.1%