Skip to content

0ceanSlim/anchor

Repository files navigation

anchor anchor

Immutable, permissionless constant-product AMM for Liquid.

anchor uses Simplicity contracts to enforce AMM rules directly on-chain. Pools are covenant-controlled UTXOs with no admin key, no upgrade path, and no off-chain coordinator.

Anyone can deploy a pool between two Liquid assets, provide liquidity, and earn swap fees proportional to their share of the pool.


⚠️ Early Development

anchor is early-stage experimental software.

This repository is public so the protocol and implementation can receive review. The codebase currently contains incomplete features, bugs, and breaking changes.

Do not use with real funds.


Documentation


Build

Requirements:

  • Go 1.21+
  • Rust / cargo
  • Elements / Liquid node

Clone the repository:

git clone https://github.com/0ceanslim/anchor
cd anchor

Install the patched Simplicity compiler:

make install-simc

Install the Go → SimplicityHL transpiler:

make install-simgo

Build the CLI:

make build

Binary will be created at:

bin/anchor

CLI Usage

All commands support interactive wizard mode — run without flags and the CLI will prompt for everything it needs. Every command also works fully non-interactively via flags.

Set up your environment once:

export ANCHOR_RPC_URL=http://localhost:7041
export ANCHOR_RPC_USER=user
export ANCHOR_RPC_PASS=pass
export ANCHOR_NETWORK=testnet
export ANCHOR_ESPLORA_URL=http://localhost:3000

Commands

Command Description
check Validate RPC, Esplora, compiler, and pool config
compile Compile Simplicity contracts (developer tool)
find-pools Discover pools by asset pair or pool ID
pool-info Query live pool reserves and price
create-pool Deploy a new AMM pool
swap Swap between pool assets
add-liquidity Deposit assets and receive LP tokens
remove-liquidity Burn LP tokens and withdraw reserves

Quick Examples

# Find a pool by its LP asset ID
./anchor find-pools --pool-id <lp-asset-hex>

# Query pool reserves
./anchor pool-info --pool-id <lp-asset-hex>

# Interactive swap (prompts for everything)
./anchor swap

# Non-interactive swap
./anchor swap --pool-id <lp-asset-hex> --in-asset asset0 --amount 10000 --broadcast

Full flag reference: docs/cli.md


Repository Layout

cmd/anchor/      CLI entrypoint
pkg/             Core implementation
contracts/       Canonical contract logic (Go → SimplicityHL)
build/           Generated contract files
tests/           Integration tests
docs/            Protocol documentation and notes

License

MIT License

© 2025–2026 0ceanslim

About

Immutable, permissionless constant-product AMM for Liquid.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors