> ## Documentation Index
> Fetch the complete documentation index at: https://docs.soroswap.finance/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Soroswap Aggregator API: base URL https://api.soroswap.finance, pick the network with ?network=mainnet or ?network=testnet (omitted means mainnet).
> Auth: Authorization: Bearer sk_... on every call. Get a key at https://console.soroswap.finance/register. A missing or invalid key returns 401 with code and registerUrl (POST /send returns 403 instead); an expired JWT or a missing role returns 403. Free plan 1 request/s; see https://docs.soroswap.finance/api/plans.md.
> Flow: POST /quote (assetIn, assetOut as C... contract addresses, amount as an integer string in the smallest unit, tradeType, protocols) -> POST /quote/build with the unchanged quote and from -> the user signs the XDR -> POST /send. Build right after quoting: a Soroban XDR is valid for 180 seconds. Submit it as is, never re-simulate it.
> Partner id: every account has one (9 hex chars, permanent). Read partnerId from GET /partner, or in the console at https://console.soroswap.finance under Fees & payouts. The partner fee itself is switched on by Soroswap; see https://docs.soroswap.finance/api/fees.md.
> AI tools: docs MCP at https://docs.soroswap.finance/mcp (claude mcp add --transport http soroswap-docs https://docs.soroswap.finance/mcp), skill with npx skills add https://docs.soroswap.finance. Other clients: https://docs.soroswap.finance/api/build-with-ai.md.
> Units and Stellar pitfalls: https://docs.soroswap.finance/api/stellar-gotchas.md. Errors and retries: https://docs.soroswap.finance/api/errors.md.

# Deploy Soroswap Yourself

> Running the Soroswap contracts yourself: the quickstart from soroswap/core, and where the deploy scripts put their output.

You can deploy the whole protocol yourself, on a local standalone network or on testnet.
The deploy tooling lives in [soroswap/core](https://github.com/soroswap/core) and is the
source of truth; the summary below mirrors that repository's README.

> [!WARNING]
>
> This page used to carry a long CLI walkthrough written against the old `soroban` CLI,
> Futurenet and the `soroban-preview` Docker images. All three are gone: the CLI is now
> `stellar`, and the deploy path is the scripted one below. The walkthrough was removed
> rather than left to mislead. Follow the repository README for anything not covered here.

## Prerequisites

`jq`, `docker`, `docker-compose`, `node`, `yarn`.

## Set up

```bash theme={null}
git clone https://github.com/soroswap/core.git
cd core
cp .env.example .env
```

Fill in `SOROSWAP_ADMIN_SECRET_KEY`, `TEST_TOKENS_ADMIN_SECRET_KEY`,
`TESTING_ACCOUNT_SECRET_KEY` and `MAINNET_RPC_URL`. These are the keys the deploy runs as.

Start the network container in one terminal:

```bash theme={null}
bash scripts/quickstart.sh standalone   # or testnet
```

And the workspace container in another:

```bash theme={null}
bash scripts/run.sh
yarn
cd /workspace/contracts
make build
```

## Deploy

From the workspace container:

```bash theme={null}
yarn build
yarn deploy <network>
```

That one command installs the Pair, Factory and Router WASM, then deploys and initializes
the Factory and the Router. On any network other than mainnet it also seeds the network so
there is something to trade against: eight test tokens, liquidity across three paths, four
Stellar test tokens, and eight random tokens. Native XLM is wrapped if it is not already.

It writes three files:

* `.soroban/tokens.json`
* `.soroban/<NETWORK>.contracts.json`
* `.soroban/random_tokens.json`

## Serve the addresses locally

```bash theme={null}
bash scripts/serve_with_docker.sh
```

| Endpoint | Serves |
| - | - |
| `http://localhost:8010/api/tokens` | The token list |
| `http://localhost:8010/api/random_tokens` | The random tokens |
| `http://localhost:8010/api/<network>/factory` | The factory address |
| `http://localhost:8010/api/<network>/router` | The router address |

These mirror the shape of the public API, so a frontend pointed at localhost behaves the
same way it does against production.

## The deployed contracts

If you only want to talk to the contracts that are already live rather than run your own,
you do not need any of the above. The mainnet addresses are on
[Deployed Addresses](https://docs.soroswap.finance/amm/technical-reference/deployed-addresses.md), and the current values
are always in
[`public/mainnet.contracts.json`](https://github.com/soroswap/core/blob/main/public/mainnet.contracts.json).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.