docs(hf): add 28_Solana_Semantic_Anchor/README.md matching whitepaper standard
Browse files
28_Solana_Semantic_Anchor/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 28. Solana Semantic Anchor & Payments Gateway
|
| 2 |
+
|
| 3 |
+

|
| 4 |
+
|
| 5 |
+
This directory implements the on-chain attestation and payments incentive layers for the **Language-U Semantic Communication Protocol** on the **Solana** blockchain.
|
| 6 |
+
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
## 🏗️ Components
|
| 10 |
+
|
| 11 |
+
1. **Anchor Smart Contract (`solana-cuneiform-anchor`):**
|
| 12 |
+
* Located in `programs/solana-cuneiform-anchor/src/lib.rs`
|
| 13 |
+
* Defines the on-chain PDA account `CoordinateRecord` to store the 6D semantic coordinates (`[DOMAIN, SUBDOMAIN, MODALITY, POLARITY, STRENGTH, DEPTH]`) and corresponding cryptographic `merkle_root` signatures of intents.
|
| 14 |
+
* Instructions:
|
| 15 |
+
* `register_coordinates`: Initializes a coordinate record on-chain.
|
| 16 |
+
* `update_coordinates`: Mutates coordinates, restricted to the original authority.
|
| 17 |
+
2. **TypeScript SDK Client:**
|
| 18 |
+
* Located in `app/src/cuneiform_client.ts`
|
| 19 |
+
* An ESM-compliant helper to serialize instructions and deserialize accounts dynamically (calculating discriminators via SHA-256) without requiring a pre-compiled JSON IDL.
|
| 20 |
+
3. **Solana Pay Mesh Gateway:**
|
| 21 |
+
* Located in `app/src/solana_pay_mock.ts`
|
| 22 |
+
* Compiles standards-compliant Solana Pay request URLs to handle micro-payments (USDC/USDG) to reward mesh routing nodes.
|
| 23 |
+
|
| 24 |
+
---
|
| 25 |
+
|
| 26 |
+
## 🧪 Running the Tests
|
| 27 |
+
|
| 28 |
+
1. Install dependencies:
|
| 29 |
+
```bash
|
| 30 |
+
npm install
|
| 31 |
+
```
|
| 32 |
+
2. Run the integration test suite (validates PDA derivations, mock account deserializations, and Solana Pay URI compliance):
|
| 33 |
+
```bash
|
| 34 |
+
node tests/solana-cuneiform-anchor-standalone.js
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
## 🦀 Building the Rust Program
|
| 40 |
+
|
| 41 |
+
Ensure Cargo is installed, then check compilation via:
|
| 42 |
+
```bash
|
| 43 |
+
cargo check
|
| 44 |
+
```
|