Skip to content

ajuna-network/substrate-cpp

Repository files navigation

📦 libSubstrate

This project has developed a comprehensive library that is compatible with the substrate ecosystem, akin to Substrate.NET.API. It offers all the necessary interfaces for interacting with a substrate node. For practical applications of this library, please consult the provided usage examples.

Setup Git Hooks

This project uses Git hooks to enforce certain rules and perform checks before committing code.

To enable these hooks, run the following command:

git config core.hooksPath .githooks

Setup a development node

version: '2'

services:
  substrate:
    container_name: substrate
    image: parity/substrate:latest
    ports:
      - 30333:30333   # p2p port
      - 9933:9933     # rpc port
      - 9944:9944     # ws port
      - 9615:9615     # Prometheus port
    command: [
      "--dev",
      "--rpc-external",
      "--prometheus-external",
      "--rpc-cors", "all"
    ]

  polkadotui:
    container_name: polkadotui
    image: jacogr/polkadot-js-apps
    environment:
      - WS_URL=ws://[YOUR-MACHINE-IP]:9944
    ports:
      - 80:80

Requirements

🚀 Usage

Add this package to your project's conanfile.txt:

[requires]
libSubstrate/1.0.1@svnscha/dev

[generators]
cmake

To install dependencies, run:

conan install .

To build your project with Conan, run:

mkdir build && cd build
conan build ..

🧪 Export Dependencies

cd external/libcurl-conan/all
conan export --user svnscha --channel dev --version 8.6.0 .

cd external/scale-codec-cpp
conan export --user svnscha --channel dev .

cd external/sr25519
conan export --user svnscha --channel dev .

🧪 Export this Package

To export the Conan package, navigate to the directory containing conanfile.py and run:

conan export --user svnscha --channel dev .

This exports the package to your local cache, usable by other projects.

🧪 Building the Package

For local development you could simply use

conan create --build=missing .

🧪 Development

conan install conanfile.py -s build_type=Debug --build=missing

and then select your CMake presets in your favorite IDE and work on this library.

References