Metadata-Version: 2.4
Name: sophi
Version: 0.1.7
Summary: A simple language for Bitcoin non-custodial smart contracts
Author: Eduardo de Figueiredo
License: BSL-1.1
Project-URL: Homepage, https://github.com/sophi-lang/sophi
Keywords: bitcoin,swap,htlc,language,non-custodial,otc
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Compilers
Classifier: Topic :: Office/Business :: Financial
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Dynamic: requires-python

﻿# Sophi

**A declarative language for mathematically verified value transformations.**

Sophi is not a smart contract language. It has no runtime, no blockchain execution, and no custody of funds. Instead, you describe what a fair exchange looks like — and Sophi proves it is mathematically valid.

## Install

`\
pip install sophi
`\

## Write your first swap

`\
Resource BTC
Resource USDT

State before:
    alice.BTC  = 0.5
    bob.USDT   = 50000

State after:
    alice.USDT = 50000
    bob.BTC    = 0.5

Rule conservation:
    before.alice.BTC + before.bob.USDT == after.alice.USDT + after.bob.BTC

Proof swap:
    verify(conservation)
`\

Save as trade.sph and run:

`\
sophi compile trade.sph
`\

## The four primitives

Resource — anything with value. BTC, USDT, ETH, or any asset you define.

State — who holds what, before and after the transformation.

Rule — a mathematical condition that must be true for the transformation to be valid.

Proof — the verification that all rules pass.

## Non-custodial by construction

Your funds never leave your control. Sophi has no concept of custody. It is mathematically impossible to write a custodial program in Sophi.

## License

Business Source License 1.1 — converts to Apache 2.0 after 4 years.
