C++
Use the C++ SDK to store and retrieve data through a local daemon, a background service called antd. The client uses REST, with optional gRPC support.
Install
Use CMake 3.14 or later, a C++20 compiler, and the exact ant-sdk v0.12.1 release source as a local subdirectory. This workflow does not use a registry package.
git clone --branch v0.12.1 --depth 1 https://github.com/WithAutonomi/ant-sdk.git
test "$(git -C ant-sdk rev-parse HEAD)" = "f9cd5c5fc08133847909e47e04af186593ccbaee"Place your application beside ant-sdk and use this complete CMakeLists.txt:
cmake_minimum_required(VERSION 3.14)
project(autonomi_example LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_subdirectory(../ant-sdk/antd-cpp ${CMAKE_BINARY_DIR}/antd-cpp)
add_executable(autonomi_example main.cpp)
target_link_libraries(autonomi_example PRIVATE antd)Connect to antd
Follow Start the Local Daemon to run antd before connecting.
Expected output:
Store and retrieve data
Start antd in a write-enabled mode before you upload. The public Autonomi Network requires wallet and Ethereum Virtual Machine (EVM) payment configuration. A local development network created with ant dev start includes that configuration.
Expected output:
Type mappings
HealthStatus
struct with ok and network
PutResult
struct with cost and address
Raw data
std::vector<uint8_t>
Error handling
antd 0.14.0 reports a valid address with no stored data as not found. Handle NotFoundError for this case. The client source is pinned independently to v0.12.1.
Output when the valid address is not stored:
Full API reference
For all available antd endpoints, see the REST API.
Last updated