lib

Core libraries for Radroots
git clone https://radroots.dev/git/lib.git
Log | Files | Refs | README

README.md (4101B)


      1 ![Radroots libraries — foundations for local food networks](https://radroots.dev/files/assets/library/readme/radroots_library_banner.png?v=1.0.0)
      2 
      3 Build local food networks that help farms and communities organize and communicate.
      4 
      5 **What it does:** Radroots specifies the event and networking foundations for building interoperable local food networks, where governance and data ownership remain in the hands of the communities that run them.
      6 
      7 **[Install](https://radroots.dev/docs/install)**
      8 | [Docs](https://radroots.dev/docs)
      9 | [Examples](https://radroots.dev/docs/examples)
     10 | [Releases](https://radroots.dev/downloads/)
     11 | [License](#license)
     12 
     13 ### Use cases
     14 - Farmers post what they are growing and receive orders for upcoming harvests
     15 - Food hubs organize group buying across farms, households and local businesses
     16 - Farms and food hubs schedule drops and market days where buyers pick up orders
     17 - Restaurants and local businesses arrange regular orders directly with nearby farms
     18 - Local couriers carry orders from farms to homes, businesses and pickup points
     19 
     20 ### How to use
     21 ```rust
     22 use radroots::prelude::*;
     23 
     24 let client = Client::builder()
     25     .signer(signer)
     26     .transport(Nostr::relays(["wss://radroots.org"])?)
     27     .build()
     28     .await?;
     29 
     30 let farm = client
     31     .seller(seller_account)?
     32     .farm(farm_id)?;
     33 
     34 // Farmer creates a listing for freshly picked tomatoes
     35 let receipt = farm
     36     .listings()
     37     .publish("Heirloom tomatoes")
     38     .id("fresh-tomatoes")
     39     .description("Locally grown and picked this morning.")
     40     .price(Price::cad_per_kg(4)?)
     41     .available(Quantity::kg(20)?)
     42     .pickup_in(Locality::city("Victoria", "BC", "CA")?)
     43     .send() // Validates, signs, saves locally, and attempts publication
     44     .await?;
     45 
     46 // Log the published event address
     47 println!("Published: {}", receipt.address());
     48 …
     49 ```
     50 
     51 ### Getting started
     52 
     53 > **Status:** Alpha (`0.1.0-alpha`)
     54 > Still a `draft`. Not recommended for use before `0.1.0` is published.
     55 
     56 The Radroots libraries are a Rust workspace with a small set of native build
     57 dependencies. Governed repository commands use `cargo extbuild`; see
     58 [`BUILD.md`](BUILD.md) for the complete native setup guide.
     59 
     60 #### Governed development
     61 
     62 After installing the native dependencies below and configuring extbuild:
     63 
     64 ```sh
     65 git clone https://radroots.dev/git/lib.git && cd lib
     66 
     67 cargo extbuild doctor
     68 cargo extbuild run -- cargo check --workspace --locked
     69 ```
     70 
     71 Checked-in Nix expressions are deferred compatibility surfaces. Nix
     72 evaluation and Nix-derived packages, apps, checks, development shells, NixOS
     73 modules, and OCI outputs are not current qualification prerequisites.
     74 
     75 #### macOS and Linux
     76 
     77 To setup manually, install [Rust](https://rustup.rs/), Git, LLVM/Clang with `libclang`, `pkg-config`, and `libsodium`.
     78 
     79 On macOS with Homebrew:
     80 
     81 ```sh
     82 brew install llvm pkgconf libsodium
     83 export LIBCLANG_PATH="$(brew --prefix llvm)/lib"
     84 ```
     85 
     86 On Debian or Ubuntu:
     87 
     88 ```sh
     89 sudo apt install build-essential clang libclang-dev pkg-config libsodium-dev
     90 ```
     91 
     92 Then clone and check the workspace:
     93 
     94 ```sh
     95 git clone https://radroots.dev/git/lib.git && cd lib
     96 
     97 export SODIUM_USE_PKG_CONFIG=1
     98 cargo check --workspace --locked
     99 ```
    100 
    101 On macOS, if `bindgen` cannot locate the system headers:
    102 
    103 ```sh
    104 export SDKROOT="$(xcrun --sdk macosx --show-sdk-path)"
    105 export BINDGEN_EXTRA_CLANG_ARGS="--sysroot=${SDKROOT}"
    106 ```
    107 
    108 #### SP1 (*optional*)
    109 
    110 SP1 is required to compile programs and generate proofs. Install Protocol Buffers and the SP1 toolchain:
    111 
    112 ```sh
    113 # macOS
    114 brew install protobuf
    115 
    116 # Debian or Ubuntu
    117 sudo apt install protobuf-compiler
    118 
    119 curl -L https://sp1up.succinct.xyz | bash
    120 sp1up
    121 ```
    122 
    123 Run proof generation in release mode. CUDA proving is supported on compatible Linux systems, not on macOS. See [`BUILD.md`](BUILD.md) for the complete setup.
    124 
    125 ## Status
    126 
    127 Radroots is under active development. The API is not yet stable and will change quite often.
    128 
    129 ## License
    130 
    131 This repository is licensed under either:
    132 
    133 - [Apache License 2.0](LICENSE-APACHE), or
    134 - [MIT License](LICENSE-MIT),
    135 
    136 at your option. 
    137 
    138 Vendored or third-party material retains its own notices and license.