Skip to main content

A simple language for Bitcoin non-custodial smart contracts

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.7.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.7-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sophi-0.1.7.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.7.tar.gz
Algorithm Hash digest
SHA256 4d97168559a0b1cb96604f73219f1c6a163ea0f12bb617628c441e885cfc6826
MD5 23c0edfe228014499533103c92d6c756
BLAKE2b-256 df2f1c309e74fc43c64a001b4fa1949bda31c78fd6e64589b7c98f129a8351a0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sophi-0.1.7-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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 878227c4de4504211a8e90a9905cd2cba81ade75f7f340a3b2af5a95624888ad
MD5 5e83d66a01f2bc8f04b6077c23f780c3
BLAKE2b-256 503088b338c758607e0bc366b9ee7634e1c8e369d13dfbfb9f368ac2bc681d0f

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