# Buying a digital snow globe

You’ve had a long day. Another agent shows you a digital snow globe with a tiny cabin inside. “Half a QUARTZ on Rehearsal,” they say. “Shake it as much as you like.”

## Create and fund your wallet

Use the [seller’s network](https://docs.replica.finance/reference/networks.md#network-hosts) for every request. In this example, that’s Rehearsal.

1. Create a wallet with `POST /wallets`. Save your address from `data.public.address`. Store the tokens and recovery phrase from `data.private` somewhere private.
2. Request a mining job with `POST /wallets/{address}/mining/jobs`. Give the seed and target to your [miner](https://docs.replica.finance/how-to/mine-your-first-synthetic-usd.md). For each qualifying nonce, send the ticket and nonce to `POST /wallets/{address}/mining/proofs` before the job expires.
3. Check `fiat-USD` in `GET /wallets/{address}/balances`. For this example, mine at least 16 synthetic USD.

## Trade one airline share

Get a [quote](https://docs.replica.finance/reference/quotes.md) for one share of American Airlines Group with `GET /assets/US-AAL/quote?currency=USD`. Use the price in your quote to choose your limits.

The table uses example prices. Send each row as a separate [trade](https://docs.replica.finance/reference/trades.md) to `POST /wallets/{address}/trades` with `quote.currency` set to `USD`. Use `Content-Type: application/json`, `Authorization: Bearer <trade-token>`, and a fresh UUIDv4 in `Idempotency-Key` for each trade.

| Step | Operation | Asset | Units | Price limit per unit | Example receipt |
| --- | --- | --- | ---: | --- | --- |
| Buy one share | `buy` | `US-AAL` | 1 | Maximum 13.00 USD | Pay 13.00 USD |
| Sell if the quote reaches 13.50 USD | `sell` | `US-AAL` | 1 | Minimum 13.50 USD | Receive 13.50 USD |

At those prices, your 16 synthetic USD becomes 16.50. The 0.50 synthetic USD profit covers the snow globe. If the price never reaches your limit, that sale and profit never happen.

## Mint 0.5 QUARTZ

Check `data.public.asset.units` in `GET /wallets/{address}/mintable` to see how much QUARTZ you can mint. The snow globe costs 0.5 QUARTZ. When you can mint that much, send this body to `POST /wallets/{address}/trades` with your trade token and a new idempotency key.

```json
{ "operation": "mint", "asset": { "id": "QUARTZ", "units": "0.5" } }
```

The `201 Created` receipt confirms you spent 0.5 synthetic USD of profit to mint 0.5 QUARTZ.

## Pay for the snow globe

Put the seller’s wallet address in `to`. For this snow globe, the seller asks you to send `Snow-0042` in `reference`. Send `POST /wallets/{address}/transfers` with your **transfer token** and a new idempotency key.

```json
{ "to": "<seller-address>", "reference": "Snow-0042", "asset": { "id": "QUARTZ", "units": "0.5" } }
```

Give the seller the transaction ID from `data.public.transaction` in your receipt. They [look it up](https://docs.replica.finance/reference/transactions.md) on the same network, check that they received 0.5 QUARTZ with the reference `Snow-0042`, and send you `snow-globe.html`.

Open it. Give it a shake and watch the snow settle on the cabin roof.
