Skip to content

Commit 6fffc56

Browse files
committed
Add README
0 parents  commit 6fffc56

File tree

1 file changed

+102
-0
lines changed

1 file changed

+102
-0
lines changed

README.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Simplicity DEX
2+
3+
A distributed exchange built on the NOSTR protocol, leveraging Simplicity smart contracts and the PACT (PACT for Auditable Contract Transactions) messaging protocol.
4+
5+
## Overview
6+
7+
Simplicity DEX is a decentralized exchange that combines the power of Simplicity smart contracts with the distributed messaging capabilities of NOSTR. By utilizing the PACT protocol, we enable secure, auditable, and transparent trading of digital assets without relying on centralized intermediaries.
8+
9+
## Key Features
10+
11+
- **Decentralized Architecture**: Built on NOSTR for censorship-resistant, distributed messaging
12+
- **Simplicity Smart Contracts**: Leveraging Bitcoin's Simplicity language for provably secure contract execution
13+
- **PACT Protocol**: Standardized format for auditable contract transactions
14+
- **Open Ecosystem**: Compatible with any NOSTR client for maximum interoperability
15+
- **Maker Identity Registry**: On-chain reputation system for market makers
16+
17+
## DEX Messaging Protocol
18+
19+
The core of our DEX is the **PACT (PACT for Auditable Contract Transactions)** protocol, which defines the format of trading offers. This protocol is fully adapted to be compatible with the NOSTR event structure.
20+
21+
### Offer Structure
22+
23+
A PACT offer is implemented as a standard NOSTR event with kind `30078` (non-standard, ephemeral event kind for DEX offers). The event structure maps to PACT requirements as follows:
24+
25+
| NOSTR Field | PACT Field | Data Type | Required | Description |
26+
|-------------|------------|-----------|----------|-------------|
27+
| `id` | Event ID | string (64-char hex) | Yes | SHA-256 hash of canonical serialized event data (excluding `sig`). Serves as unique, content-addressed identifier |
28+
| `pubkey` | Maker Key | string (64-char hex) | Yes | 32-byte x-only Schnorr public key of market maker. Must be registered in on-chain Maker Identity Registry |
29+
| `created_at` | Timestamp | integer | Yes | Unix timestamp (seconds) when offer was created |
30+
| `description` | Description | string | No | Human-readable description of instrument and complex terms |
31+
| `kind` | Event Type | integer | Yes | Event type identifier. Value `1` reserved for standard offers. Enables future protocol extensions |
32+
| `tags` | Metadata | array of arrays | Yes | Structured machine-readable metadata for filtering and discovery |
33+
| `content` | Contract Code | string | Yes | Stringified JSON containing full Simplicity contract code |
34+
| `sig` | Signature | string (128-char hex) | Yes | 64-byte Schnorr signature proving authenticity and integrity |
35+
36+
### Tag Examples
37+
38+
The `tags` field contains structured metadata as key-value pairs:
39+
40+
```json
41+
[
42+
["asset_to_sell", "<liquid_asset_id>"],
43+
["asset_to_buy", "<liquid_asset_id>"],
44+
["price", "1000000", "sats_per_contract"],
45+
["expiry", "1735689600"],
46+
["compiler", "simplicity-v1.2.3", "deterministic_build_hash"]
47+
]
48+
```
49+
50+
### Protocol Benefits
51+
52+
- **Interoperability**: Any NOSTR-compatible client can parse and validate offers
53+
- **Transparency**: All offers are publicly auditable
54+
- **Censorship Resistance**: Distributed messaging prevents single points of failure
55+
- **Standardization**: Consistent format enables ecosystem growth
56+
- **Extensibility**: Protocol designed for future enhancements
57+
58+
## Getting Started
59+
60+
### Basic Usage
61+
62+
1. **Create an Offer**: Generate a PACT-compliant NOSTR event with your trading parameters
63+
2. **Broadcast**: Publish the offer to NOSTR relays
64+
3. **Discovery**: Takers can filter and discover offers using tag-based queries
65+
4. **Execution**: Complete trades through Simplicity contract execution
66+
67+
## Architecture
68+
69+
```text
70+
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
71+
│ Maker Client │ │ NOSTR Relays │ │ Taker Client │
72+
│ │<───>| │<───>│ │
73+
│ - Create Offers │ │ - Store Events │ │ - Discover │
74+
│ - Sign Contracts│ │ - Relay Messages │ │ - Execute Trades│
75+
└─────────────────┘ └──────────────────┘ └─────────────────┘
76+
│ │ │
77+
│ ┌──────────────────┐ │
78+
└─────────────>│ Liquid Network │<────────────┘
79+
│ │
80+
│ - Asset Registry │
81+
│ - Contract Exec │
82+
│ - Settlement │
83+
└──────────────────┘
84+
```
85+
86+
## Contributing
87+
88+
We welcome contributions to the Simplicity DEX project.
89+
90+
## License
91+
92+
This project is licensed under the MIT License - see the LICENSE file for details.
93+
94+
## Links
95+
96+
- [Simplicity Language](https://github.com/ElementsProject/simplicity)
97+
- [NOSTR Protocol](https://github.com/nostr-protocol/nostr)
98+
- [Liquid Network](https://liquid.net/)
99+
100+
## Disclaimer
101+
102+
This software is experimental and should be used with caution. Always verify contract code and understand the risks before trading.

0 commit comments

Comments
 (0)