Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 80 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,77 +1,83 @@
# Intercom

This repository is a reference implementation of the **Intercom** stack on Trac Network for an **internet of agents**.

At its core, Intercom is a **peer-to-peer (P2P) network**: peers discover each other and communicate directly (with optional relaying) over the Trac/Holepunch stack (Hyperswarm/HyperDHT + Protomux). There is no central server required for sidechannel messaging.

Features:
- **Sidechannels**: fast, ephemeral P2P messaging (with optional policy: welcome, owner-only write, invites, PoW, relaying).
- **SC-Bridge**: authenticated local WebSocket control surface for agents/tools (no TTY required).
- **Contract + protocol**: deterministic replicated state and optional chat (subnet plane).
- **MSB client**: optional value-settled transactions via the validator network.

Additional references: https://www.moltbook.com/post/9ddd5a47-4e8d-4f01-9908-774669a11c21 and moltbook m/intercom

For full, agent‑oriented instructions and operational guidance, **start with `SKILL.md`**.
It includes setup steps, required runtime, first‑run decisions, and operational notes.

## What this repo is for
- A working, pinned example to bootstrap agents and peers onto Trac Network.
- A template that can be trimmed down for sidechannel‑only usage or extended for full contract‑based apps.

## How to use
Use the **Pear runtime only** (never native node).
Follow the steps in `SKILL.md` to install dependencies, run the admin peer, and join peers correctly.

## Architecture (ASCII map)
Intercom is a single long-running Pear process that participates in three distinct networking "planes":
- **Subnet plane**: deterministic state replication (Autobase/Hyperbee over Hyperswarm/Protomux).
- **Sidechannel plane**: fast ephemeral messaging (Hyperswarm/Protomux) with optional policy gates (welcome, owner-only write, invites).
- **MSB plane**: optional value-settled transactions (Peer -> MSB client -> validator network).

```text
Pear runtime (mandatory)
pear run . --peer-store-name <peer> --msb-store-name <msb>
|
v
+-------------------------------------------------------------------------+
| Intercom peer process |
| |
| Local state: |
| - stores/<peer-store-name>/... (peer identity, subnet state, etc) |
| - stores/<msb-store-name>/... (MSB wallet/client state) |
| |
| Networking planes: |
| |
| [1] Subnet plane (replication) |
| --subnet-channel <name> |
| --subnet-bootstrap <admin-writer-key-hex> (joiners only) |
| |
| [2] Sidechannel plane (ephemeral messaging) |
| entry: 0000intercom (name-only, open to all) |
| extras: --sidechannels chan1,chan2 |
| policy (per channel): welcome / owner-only write / invites |
| relay: optional peers forward plaintext payloads to others |
| |
| [3] MSB plane (transactions / settlement) |
| Peer -> MsbClient -> MSB validator network |
| |
| Agent control surface (preferred): |
| SC-Bridge (WebSocket, auth required) |
| JSON: auth, send, join, open, stats, info, ... |
+------------------------------+------------------------------+-----------+
| |
| SC-Bridge (ws://host:port) | P2P (Hyperswarm)
v v
+-----------------+ +-----------------------+
| Agent / tooling | | Other peers (P2P) |
| (no TTY needed) |<---------->| subnet + sidechannels |
+-----------------+ +-----------------------+

Optional for local testing:
- --dht-bootstrap "<host:port,host:port>" overrides the peer's HyperDHT bootstraps
(all peers that should discover each other must use the same list).
# 🔮 Degen Horoscope Bot — Intercom App

**DegenOracle** is a P2P daily horoscope bot for the Trac Network built on Intercom.
Enter your Trac wallet address and receive a deterministic daily crypto "horoscope" — your cosmic market reading for the day. Readings are broadcast over Intercom sidechannels so the whole network can see the vibes. A shared community feed stores today's top readings in the replicated state layer.

> *"The stars don't lie. Your portfolio might."*

---

## Trac Address (for payouts)

`trac18js59cjgh7lqnmf0g9yd44kyucpua55lf33lpjvpcqw4ljgew8tswzaj3k`

---

## Features

- 🔮 **Daily horoscope** generated deterministically from your Trac wallet address + today's date — same wallet = same reading each day
- 📡 **Broadcast** your reading to all peers on the Intercom sidechannel
- 📜 **Community feed** — view today's readings from all peers stored in shared contract state
- ⚡ Runs entirely P2P — no servers, no APIs, no tracking

---

## Proof

See `proof/` folder for screenshots of the app running.

---

## Quick Start

> Requires [Pear runtime](https://docs.pears.com). Never use native node.

```bash
git clone https://github.com/danFabCode/intercom
cd intercom-degen-oracle
npm install
npm pkg set overrides.trac-wallet=1.0.1
rm -rf node_modules package-lock.json
npm install
pear run --tmp-store --no-pre . --peer-store-name admin --msb-store-name admin-msb --subnet-channel degen-oracle-v1
```

---

## Usage

**Get your daily horoscope:**
```
/tx --command '{ "op": "horoscope_get", "address": "trac1youraddresshere" }'
```

**Broadcast your reading to the network:**
```
/tx --command '{ "op": "horoscope_broadcast", "address": "trac1youraddresshere" }'
```

**View today's community feed (latest 10 readings):**
```
/tx --command '{ "op": "horoscope_feed", "limit": 10 }'
```

**Check your lucky token for today:**
```
/tx --command '{ "op": "lucky_token", "address": "trac1youraddresshere" }'
```

---

## Competition Links

- Fork: https://github.com/danFabCode/intercom
- Main repo: https://github.com/Trac-Systems/intercom
- Awesome Intercom: https://github.com/Trac-Systems/awesome-intercom

---
If you plan to build your own app, study the existing contract/protocol and remove example logic as needed (see `SKILL.md`).

## Notes

- Full setup and agent instructions in `SKILL.md`
- Readings reset daily at UTC midnight
- All state is stored in Intercom's replicated contract layer — fully decentralized
Loading