Skip to content

Latest commit

 

History

History
158 lines (121 loc) · 5.41 KB

File metadata and controls

158 lines (121 loc) · 5.41 KB

MiHashport Contract

Soroban smart contracts powering MiHashport — chat, build, and pay on Stellar, all from inside WhatsApp.

Part of MiHashport

MiHashport is split across three repositories:

What is MiHashport?

WhatsApp is where billions of people already chat, but not where they hold or move money on a public blockchain. MiHashport bridges that gap: a user texts a WhatsApp bot to send, receive, or swap Stellar assets, or deploy a contract — never touching a wallet app, a seed phrase UI, or a block explorer directly. The backend turns each chat command into a signed Stellar/Soroban transaction; this repo defines what those transactions can actually do on-chain.

The central problem this repo solves: a phone number is not a Stellar address. Every contract here exists to let the backend resolve "the person texting from this WhatsApp number" to "this Stellar account," safely and on-chain, and to build the send/receive/swap/deploy primitives on top of that mapping.

What this repo contains

A Cargo workspace of Soroban contracts:

contracts/
  identity-registry/   # phone_hash -> Address binding (register/resolve/update/unregister)

identity-registry is the foundation contract: it never stores a raw phone number (the backend hashes it off-chain first), only a BytesN<32> hash bound to a Stellar Address, with events emitted on every change so the backend can keep its own view in sync. Later phases (see docs/PLAN.md) add payments, swaps, and a contract-deployment factory on top of this mapping.

Why open source

MiHashport's contracts hold and move real user funds — the more eyes on that code, the safer it is. Open-sourcing this repo lets the community audit the auth checks and storage logic before real value flows through them, lets other builders reuse the phone-hash-identity pattern for their own chat-native or non-custodial-onboarding products, and keeps the project honest about what it actually does on-chain versus what happens off-chain in the backend.

Why it benefits the Soroban/Stellar ecosystem

  • A reusable identity pattern. Mapping an off-chain identifier (phone number, email, username) to a Stellar address via a hashed on-chain registry is a pattern any chat-native or social-login Stellar app can copy directly from identity-registry.
  • Real-world contract usage, not a toy demo. These contracts are meant to route actual payments initiated from WhatsApp — a concrete example of Soroban handling consumer-facing, non-technical-user transaction flows.
  • Tooling exercised end-to-end. The workspace exercises the standard Soroban toolchain (soroban-sdk, wasm32v1-none builds, testutils-based auth mocking) in a CI pipeline other teams can copy wholesale.
  • Onboarding new Soroban developers. A small, well-scoped registry contract with full test coverage is an approachable first contract for developers new to Soroban — and the phased plan in docs/PLAN.md is designed to produce small, single-issue contributions a newcomer can pick up.

Tech stack

  • Rust (edition 2021, pinned via rust-toolchain.toml)
  • soroban-sdk v22
  • Cargo workspace, wasm32v1-none compilation target
  • GitHub Actions for CI

Getting started

Prerequisites

  • rustup (the pinned toolchain and wasm32v1-none target are installed automatically via rust-toolchain.toml the first time you run cargo in this repo)
  • Optionally, the Stellar CLI (stellar / soroban command) for deploying to testnet

Install

git clone https://github.com/MiHashport/MiHashport-Contract.git
cd MiHashport-Contract

No separate install step is needed — cargo will fetch dependencies on first build.

Build

# Native build (fast, for iterating on logic)
cargo build

# Contract WASM build (what actually gets deployed)
cargo build --target wasm32v1-none --release

Test

cargo test

Run / deploy

There's no long-running server here — contracts are deployed to a Stellar network. Once you have the Stellar CLI installed and a funded testnet identity:

stellar contract deploy \
  --wasm target/wasm32v1-none/release/identity_registry.wasm \
  --source <your-identity> \
  --network testnet

Project structure

.
├── contracts/
│   └── identity-registry/
│       ├── src/lib.rs      # contract logic
│       ├── src/test.rs     # unit tests
│       └── Cargo.toml
├── docs/
│   └── PLAN.md             # 6-phase implementation plan
├── .github/
│   ├── workflows/ci.yml
│   ├── ISSUE_TEMPLATE/task.md
│   └── PULL_REQUEST_TEMPLATE.md
├── Cargo.toml               # workspace root
└── rust-toolchain.toml

More docs

License

MIT — see LICENSE.