Skip to main content

Balance-based non-custodial swap language for Bitcoin

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sophi-0.1.6.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sophi-0.1.6-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file sophi-0.1.6.tar.gz.

File metadata

  • Download URL: sophi-0.1.6.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for sophi-0.1.6.tar.gz
Algorithm Hash digest
SHA256 00138e8196eec1c3481903294e851967b05a7d6ad98ae7a8cf84415d2d390862
MD5 760fac1382f288deb0dcf0171d141464
BLAKE2b-256 e362f8b370511f35634064adb7c9fc33488d0046f0f2de21937c73330bf01410

See more details on using hashes here.

File details

Details for the file sophi-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: sophi-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for sophi-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 f93a1fd9111bd4911ec7b949e750ea36a0aedcc1f58b2c64693e95ab84a7bf7f
MD5 e683e7d07a3a74ded6be65ca0e180b01
BLAKE2b-256 dbf4fe49535389d8335bbc0c335db39218e51162410fc5d3beb535777d388c6c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page