Skip to content

fatlabsxyz/tongo-docs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Tongo Documentation

Official documentation for the Tongo Protocol and TypeScript SDK. Built with mdbook.

πŸš€ Quick Start

1. Install mdbook (one time only)

# Install via cargo (Rust package manager)
cargo install mdbook

# Or on Arch Linux
sudo pacman -S mdbook

2. Build and View

# Navigate to this directory
cd /home/john/fatsolutions/tongo-v1/tongo-docs

# Option A: Build static HTML
mdbook build
# Output in: book/index.html

# Option B: Serve with live reload (RECOMMENDED)
mdbook serve
# Opens at: http://localhost:3000
# Auto-reloads when you edit files!

# Option C: Serve and auto-open browser
mdbook serve --open

That's it! The docs are now viewable at http://localhost:3000 πŸŽ‰

πŸ“ Editing Documentation

All documentation is written in Markdown and lives in the src/ directory:

src/
β”œβ”€β”€ SUMMARY.md              # Table of contents (navigation)
β”œβ”€β”€ README.md               # Landing page
β”‚
β”œβ”€β”€ protocol/               # Protocol Documentation
β”‚   β”œβ”€β”€ introduction.md
β”‚   β”œβ”€β”€ encryption.md
β”‚   β”œβ”€β”€ transfer.md
β”‚   β”œβ”€β”€ auditor.md
β”‚   └── contracts.md
β”‚
└── sdk/                    # SDK Documentation
    β”œβ”€β”€ README.md           # SDK overview
    β”œβ”€β”€ installation.md
    β”œβ”€β”€ quick-start.md
    β”‚
    β”œβ”€β”€ concepts/           # Core concepts
    β”‚   β”œβ”€β”€ accounts.md
    β”‚   β”œβ”€β”€ operations.md
    β”‚   β”œβ”€β”€ encrypted-state.md
    β”‚   └── key-management.md
    β”‚
    β”œβ”€β”€ guides/             # Step-by-step guides
    β”‚   β”œβ”€β”€ funding.md
    β”‚   β”œβ”€β”€ transfers.md
    β”‚   β”œβ”€β”€ withdrawals.md
    β”‚   β”œβ”€β”€ rollover.md
    β”‚   β”œβ”€β”€ wallet-integration.md
    β”‚   └── transaction-history.md
    β”‚
    β”œβ”€β”€ api/                # API reference
    β”‚   β”œβ”€β”€ account.md
    β”‚   β”œβ”€β”€ operations.md
    β”‚   └── types.md
    β”‚
    └── examples/           # Real-world examples
        β”œβ”€β”€ complete-workflow.md
        └── react-integration.md

Making Changes

  1. Edit any .md file in the src/ directory
  2. With mdbook serve running: Changes appear instantly in browser!
  3. Without serve: Run mdbook build to rebuild

Adding New Pages

  1. Create a new .md file in the appropriate src/ subdirectory
  2. Add an entry to src/SUMMARY.md to include it in navigation:
- [My New Page](path/to/new-page.md)

πŸ“ Project Structure

tongo-docs/
β”œβ”€β”€ book.toml           # mdbook configuration
β”œβ”€β”€ src/                # Markdown source files (EDIT THESE)
β”‚   β”œβ”€β”€ SUMMARY.md      # Navigation structure
β”‚   β”œβ”€β”€ README.md       # Landing page
β”‚   β”œβ”€β”€ protocol/       # Protocol docs
β”‚   └── sdk/            # SDK docs
β”œβ”€β”€ theme/              # Custom styling
β”‚   └── custom.css      # Cyberpunk theme
β”œβ”€β”€ book/               # Generated HTML (gitignored)
└── README.md           # This file

Important: Only edit files in src/. The book/ directory is auto-generated.

🎨 Custom Theming

The docs use a custom cyberpunk theme matching the Tongo landing page:

Colors

  • Jet Black: #0d0d0d - Background
  • Deep Orange: #ff4d00 - Primary accent, headers
  • Warm Coral: #ff693a - Secondary accent
  • Ice Blue: #b9d3d7 - Links, subtle text
  • Soft Gray: #d1d1cf - Body text

Typography

  • Primary: JetBrains Mono
  • Monospace: IBM Plex Mono

Customizing

Edit theme/custom.css to modify:

  • Colors and styling
  • Fonts and typography
  • Layout and spacing
  • Animations and effects

After changes, rebuild with mdbook build or wait for auto-reload.

πŸš€ Deployment

GitHub Pages

# Build the docs
mdbook build

# Push the book/ directory to gh-pages branch
git subtree push --prefix book origin gh-pages

Vercel / Netlify / Cloudflare Pages

  1. Connect your repository
  2. Set build command: mdbook build
  3. Set publish directory: book

Docker

FROM rust:latest as builder
RUN cargo install mdbook
COPY . /docs
WORKDIR /docs
RUN mdbook build

FROM nginx:alpine
COPY --from=builder /docs/book /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

Build and run:

docker build -t tongo-docs .
docker run -p 8080:80 tongo-docs

πŸ“– Documentation Content

What's Included

Protocol Documentation:

  • Introduction to Tongo confidential payments
  • Encryption system (ElGamal, homomorphic encryption)
  • Transfer protocol and ZK proofs
  • Auditing and compliance features
  • Cairo contracts overview

SDK Documentation:

  • Installation and quick start
  • Core concepts (Accounts, Operations, Encrypted State, Key Management)
  • Step-by-step guides (Funding, Transfers, Withdrawals, Rollover)
  • Wallet integration patterns
  • Complete API reference
  • Real-world examples (React integration, complete workflows)

Code Examples

All code examples are:

  • βœ… Verified against actual SDK source code
  • βœ… Tested for correctness
  • βœ… Based on working patterns from production apps
  • βœ… TypeScript with full type annotations

πŸ”§ Troubleshooting

mdbook not found

# Make sure cargo bin is in PATH
export PATH="$HOME/.cargo/bin:$PATH"

# Or reinstall
cargo install mdbook

Port already in use

# Use a different port
mdbook serve --port 3001

Changes not showing

# Hard rebuild
mdbook clean
mdbook build

πŸ”— Links

Releases

No releases published

Packages

 
 
 

Contributors