No description
Find a file
despiegk 59ce5803bd
Some checks failed
Bootstrap Test / bootstrap (push) Failing after 6s
Build and Test / build (push) Failing after 6m15s
Test / build-and-test (push) Successful in 9m4s
Fix Makefile cargo and shell compatibility
Add SHELL := /bin/bash to use bash instead of sh (enables source command)
Add CARGO_ENV helper to ensure cargo is in PATH before running cargo commands

This fixes exit code 127 errors in CI/CD environments where cargo might not
be in the default PATH.

Applies to all cargo-using targets: build, check, fmt, fmt-check, lint,
run, test, test-all, clean, installdev, deps.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-08 07:07:52 +04:00
.claude Add cluster_manager module and refactor provision module 2026-01-23 07:33:43 +01:00
.forgejo/workflows Add build_lib standardization: buildenv.sh, scripts/build_lib.sh, update Makefile, CI workflows 2026-02-07 09:57:19 +04:00
_archive Remove all Docker functionality and archive to _archive/docker 2026-02-05 10:00:41 +04:00
contracts Fix Makefile cargo and shell compatibility 2026-02-08 07:07:52 +04:00
docker update repo location 2026-02-05 00:20:44 +00:00
docs Update marketplace to handle slice reservations 2026-02-06 21:46:54 +00:00
examples Fixes for accounts using tokens and DNS examples 2026-02-07 03:37:26 +00:00
rhaitests Change credit "bucket" to "line" 2026-02-05 21:34:27 +00:00
scripts Add build_lib standardization: buildenv.sh, scripts/build_lib.sh, update Makefile, CI workflows 2026-02-07 09:57:19 +04:00
specs Fix Makefile cargo and shell compatibility 2026-02-08 07:07:52 +04:00
src Fixes for accounts using tokens and DNS examples 2026-02-07 03:37:26 +00:00
.env.example Cleanup 2026-02-03 05:36:11 +00:00
.gitignore Add organized Rhai examples and contract documentation 2026-01-21 05:32:54 +01:00
.gitmodules Remove geomind_dev_docs submodule 2026-02-07 01:18:37 +00:00
.mcp.json Initial commit: NEAR SPORE token setup with MCP server management 2026-01-01 09:01:48 +01:00
buildenv.sh Add build_lib standardization: buildenv.sh, scripts/build_lib.sh, update Makefile, CI workflows 2026-02-07 09:57:19 +04:00
Cargo.lock Fixes for accounts using tokens and DNS examples 2026-02-07 03:37:26 +00:00
Cargo.toml Standardize Rust edition 2024 and rust-version 1.92 2026-02-07 09:56:53 +04:00
CLAUDE.md Update CLAUDE.md 2026-01-30 07:10:06 +00:00
Makefile Fix Makefile cargo and shell compatibility 2026-02-07 20:53:39 +04:00
README.md update repo location 2026-02-05 00:20:44 +00:00
rust-toolchain.toml Fix toolchains 2026-01-09 13:47:44 -08:00

Hero Ledger

A NEAR-compatible blockchain with its own network, validators, and token economy.

  • 9 Smart Contracts: SPORE, GLD, USDH tokens, SPOREX exchange, DNS, Credit Vault, Groups, KVS, Hosting
  • heroledger CLI: Command-line interface for all operations
  • Rhai Scripting: Automation and testing scripts

Quick Start

Prerequisites: make and curl must be installed.

# Ubuntu/Debian
sudo apt-get install make curl

# macOS
xcode-select --install  # includes make
brew install curl       # if needed

Bootstrap (From Nothing)

git clone https://forge.ourworld.tf/lhumina_code/hero_ledger.git
cd hero_ledger
make bootstrap

This will:

  1. Install system packages (Ubuntu/Debian only)
  2. Install Rust and cargo-near
  3. Build all contracts and CLI
  4. Install binaries to ~/hero/bin
  5. Start local chain and deploy contracts

Development Workflow

make setup           # Install dependencies (once)
make build           # Build debug binary (fast)
make install         # Build and install to ~/hero/bin
make test            # Run smoke + full tests

For optimized builds:

make build-release   # Build release binary
make install-release # Install release binary

Available Targets

make help            # Show all targets

# Setup
make setup           # Install system packages, Rust, cargo-near

# Build
make build           # Debug build (contracts + CLI)
make build-release   # Release build (optimized)
make build-contracts # Build WASM contracts only
make check           # Fast syntax check
make fmt             # Format code
make lint            # Run clippy

# Install
make install         # Debug build to ~/hero/bin
make install-release # Release build to ~/hero/bin

# Chain Management
make bootstrap       # Full setup from nothing
make chain-init      # Initialize single-node chain
make chain-destroy   # Destroy local chain and clean up

# Testing
make test            # Run all tests
make test-smoke      # Quick smoke test
make test-full       # Full system test
make test-unit       # Rust unit tests

make clean           # Remove build artifacts

CLI Usage

# Account operations
heroledger list                              # List accounts
heroledger <account> info                    # Account details
heroledger <account> send SPORE 100 <to>     # Send tokens

# SPOREX Exchange
heroledger <account> x rates                 # View rates
heroledger <account> x fund SPORE 100        # Deposit
heroledger <account> x withdraw SPORE 50     # Withdraw

# KVS (Key-Value Store)
heroledger kvs namespaces                    # List namespaces
heroledger <account> kvs create myapp.config # Create namespace
heroledger <account> kvs set myapp.config key value

# DNS
heroledger dns available example.hero        # Check availability
heroledger <account> dns register example.hero 12  # Register for 12 months

# Groups
heroledger groups list                       # List groups
heroledger <account> groups create mygroup "Description"

# Credit Vault
heroledger credit spenders                   # List spenders
heroledger <account> credit deposit bucket1 100

Run heroledger --help for full command reference.


Smart Contracts

Contract Address Purpose
SPORE my_spore.test.hero Primary token (10B supply, NEP-141/NEP-148)
GLD my_gld.test.hero Digital Gold token
USDH my_usdh.test.hero USD stablecoin
SPOREX sporex.test.hero Token exchange
DNS my_dns.test.hero Domain registration
Credit my_credit.test.hero Pull-based payments
Groups my_groups.test.hero Group management
KVS kvs.test.hero Key-value storage
Hosting my_hosting.test.hero Infrastructure registry

Rhai Scripting

Automate workflows with Rhai scripts:

near_localnet("http://localhost:3030");
near_accounts_dir("./accounts");

let alice = account("my_test_1");
print(`Balance: ${alice.balance_near()} NEAR`);

token_send()
    .from("my_test_1")
    .to("my_test_2")
    .amount(100)
    .token("spore")
    .execute();

Run scripts:

heroledger my_script.rhai
heroledger rhaitests/smoke/test_smoke.rhai      # 9 smoke tests
heroledger rhaitests/system/test_full_system.rhai  # 35 system tests

See the Rhai scripting module in src/rhai/ for more examples.


Testing

make test              # Run smoke + full tests
make test-smoke        # Quick smoke test
make test-full         # Full system test
make test-unit         # Rust unit tests

Project Structure

hero_ledger/
├── contracts/           # 9 smart contracts
├── src/                 # SDK and CLI source
│   ├── bin/             # CLI binaries
│   ├── rhai/            # Rhai scripting engine
│   └── ...
├── rhaitests/           # Test scripts
├── examples/            # Rhai and Rust examples
├── docker/              # Docker configuration
└── docs/                # Documentation

Docker

For containerized deployments, see docker/README.md.

make docker-build-full   # Build full image with neard
make docker-test-full    # Build and run all tests
make docker-build-cli    # Build CLI-only image

Documentation