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

# Shielded Zcash

> Orchard deposits and delivery

Shielded mode lets a user pay ZEC from a shielded balance, or receive ZEC at a shielded address, through Orchard, Zcash's current shielded pool. A payment from a shielded balance to the issued address shows neither its sender nor its amount on chain. A shielded delivery hides the recipient only: Flashnet funds it from transparent inputs, so the delivered amount can be derived from the transaction. The asset stays `zcash:ZEC`. Omitting the mode fields keeps the transparent flow described in [Quotes](https://docs.flashnet.xyz/orchestra/quotes.md).

Shielded mode needs a server key or a client key with `orders:quote`. An estimate or route lookup without a key returns `503 shielded_funding_unavailable`. So does any request made while Orchestra cannot watch the Zcash chain for shielded deposits; retry it with the same idempotency key.

## Prerequisites

* An Orchestra account. Create one in the [dashboard](https://orchestra.flashnet.xyz/dashboard). Flashnet reviews new accounts before enabling API access.
* A server key (`fn_...`) from **API keys** in the dashboard. Keep it on your backend. For browsers and apps, use a scoped client key (`fnp_...`); see [Authentication](https://docs.flashnet.xyz/api/authentication.md).

## Pay from a shielded balance

Set `sourcePaymentMode: "shielded"` on `POST /v1/orchestration/quote` with `zcash:ZEC` as the source. Shielded funding is exact-in with variable delivery, and `refundAddress` is required.

```bash theme={null}
curl -X POST "https://orchestration.flashnet.xyz/v1/orchestration/quote" \
  -H "Authorization: Bearer SERVER_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Idempotency-Key: $(uuidgen)" \
  -d '{
    "sourceChain": "zcash",
    "sourceAsset": "ZEC",
    "destinationChain": "arbitrum",
    "destinationAsset": "USDC",
    "amount": "100000000",
    "amountMode": "exact_in",
    "sourcePaymentMode": "shielded",
    "recipientAddress": "RECIPIENT_ADDRESS",
    "refundAddress": "t1YourTransparentRefundAddress"
  }'
```

> [!NOTE]
>
> Replace `SERVER_KEY` with your `fn_...` key. Use a new `X-Idempotency-Key` for each operation and reuse it when retrying that same request. Amounts are integer strings in the asset's smallest unit: `"100000"` is 0.001 BTC; `"50000000"` is 50 USDC on Base. Read each asset's `decimals` from `/v2/orchestration/routes`.

`RECIPIENT_ADDRESS` is the Arbitrum address that receives USDC. Set `refundAddress` to a Zcash address you control.

`refundAddress` is a mainnet `t1` or `t3` address, or a Unified Address with an Orchard receiver. Anything else returns `400 invalid_refund_address`. A transparent refund reveals the refund recipient and amount on chain.

The response differs from an ordinary quote:

* `depositAddress` is a Unified Address issued for this quote.
* `expiresAt` and `funding.payBy` give 30 minutes to pay. `priceValidUntil` is a separate 2-minute pricing horizon, not a payment deadline.
* `funding.version` is 2, with `amountMode: "actual-input"` and `pricing: "market-at-funding"`. Orchestra accepts the amount that arrives, waits for 10 confirmations, then prices it at market. `indicativeMinAmountOut` is an indication for the requested amount, not a committed floor.
* `funding` also reports the required confirmations, and `maxSourceFeeZats` and `maxRefundFeeZats`, the network fee caps for the source transaction and for each refund transaction.

Quotes created before version 2 report `funding.version: 1`. They keep `lockedMinAmountOut` and require the exact quoted amount.

Shielded swaps run through a third-party venue. `execution` reports the candidates in `eligibleProviders`, the one the price came from in `quotedProvider`, and `estimatedSettlementSeconds`. To restrict the choice, send `executionPolicy`:

```json theme={null}
{
  "executionPolicy": {
    "routing": "best_return",
    "allowedProviders": ["hyperunit", "near-intents"],
    "maxEstimatedSettlementSeconds": 10000
  }
}
```

A lower `maxEstimatedSettlementSeconds` can exclude the slower venue. The estimate is an indication, not a deadline. On `/estimate` the same fields are flat query parameters, with `allowedProviders` comma-separated.

`POST /v1/orchestration/submit` cannot report a shielded payment, because a transaction hash does not prove a private receipt. Until Orchestra has verified the payment it returns `409 shielded_receipt_pending`; after that it returns the order. `/offramp` and `/onramp` do not accept shielded mode.

Orchestra verifies payment to the issued address and its confirmations. It cannot see the sender or screen the history of shielded funds, so `funding` reports `senderVisibility: "shielded"` and `sourceHistoryScreening: "unavailable"`. Recipient, refund, and fee addresses are screened as usual. The order's source address and source transaction hash stay null.

## Deliver to a shielded address

Set `destinationPaymentMode: "shielded"` with `destinationChain: "zcash"`, `destinationAsset: "ZEC"`, and the recipient's Orchard Unified Address as `recipientAddress`. The source is any asset with a route to ZEC. Delivery is exact-in and variable.

The response adds `destinationPaymentMode`, `priceValidUntil`, `execution`, and `delivery`:

```json theme={null}
{
  "delivery": {
    "mode": "shielded",
    "recipientAddress": "RECIPIENT_ADDRESS",
    "feeReserveZats": "90000",
    "requiredConfirmations": 10
  }
}
```

`feeReserveZats` covers the shielded payment's network fee and is already deducted from `estimatedOut`. The delivery transaction spends transparent inputs and pays the recipient their sum minus the network fee, with no change output. The chain hides the recipient and shows the inputs and the fee, so do not tell users the delivered amount is private. Fund the quote before `expiresAt` as for any other quote.

Unsupported combinations return HTTP 400: `shielded_destination_route_unsupported` for ZEC to ZEC or shielded mode on both ends, `shielded_amount_mode_unsupported` for exact-out, and `destination_payment_mode_unsupported` for any other destination.

## Discover routes

The shielded filter is on the v1 route list, not on `/v2/orchestration/routes`:

```bash theme={null}
curl "https://orchestration.flashnet.xyz/v1/orchestration/routes?sourcePaymentMode=shielded" \
  -H "Authorization: Bearer SERVER_KEY"
```

`GET /v1/orchestration/limits` takes the same parameter. Both return the routes that accept shielded funding. `GET /v1/orchestration/estimate` accepts `sourcePaymentMode` and `destinationPaymentMode` as query fields and allocates no address.

## Funding status

A shielded payment needs 10 confirmations before it becomes an order. Until then, read progress by polling, webhook, or SSE:

* Poll `GET /v1/orchestration/status?quoteId=QUOTE_ID&includeShieldedFunding=true`. It returns `fundingStatus` and `fundingDetails`, with `order: null` and `stages: []` until the order exists.
* Subscribe to [`shielded_funding.updated` webhooks](https://docs.flashnet.xyz/api/webhook-events#shielded-funding-events) at `/v1/webhooks/shielded-funding`.
* Stream [SSE](https://docs.flashnet.xyz/api/sse.md#shielded-funding) on the quote id with `includeShieldedFunding=true`.

`fundingStatus` follows one of two paths:

```text theme={null}
awaiting_payment > detected > confirming > ready
  > provider_funding > provider_processing > settling > delivering > completed

recovery_required > refunding > refunded
```

The first row ends when the payment has its confirmations. The second row is the swap and delivery. A payment that cannot proceed leaves for the third row. Version 2 quotes skip `detected` and read `confirming` as soon as a payment is seen.

`fundingDetails` has the shape shown in [Shielded funding events](https://docs.flashnet.xyz/api/webhook-events.md#shielded-funding-events). The expected, received, confirmed, and allocated amounts are integer strings in zatoshis. Received is what arrived, confirmed is what has its confirmations, and allocated is what has been assigned to the order. Version 2 adds `amountActual`, the input the order runs on, in zatoshis, and `committedMinAmountOut`, the output floor set at execution, in the smallest units of the destination asset: 6 decimals for USDC, not the 8 of ZEC. Both are null until then. `selectedProvider` names the third-party venue committed to the swap, null until one is committed.

`recovery_required` means the payment is not converting. `fundingDetails.recoveryReason.code` says why:

* `funding_expired`: `payBy` passed with nothing received, or with less than a version 1 quote required. An unpaid quote reads this after `payBy`.
* `late_payment`: the payment was first included in a block after `payBy`.
* `excess_payment`: more than the quoted amount arrived on a version 1 quote.
* `additional_payment`: a further payment confirmed after a version 2 order had fixed its input.
* `too_many_notes`: the payment arrived as more than 16 notes.
* `mixed_pools`: the payment arrived across more than one shielded pool.
* `provider_failed`, `provider_released`: the venue executing the swap failed or released the order.
* `allocation_reorg`: a chain reorganization removed a payment already assigned to the order.
* `reconciliation_required`: the order is paused, failed, or refunded and needs Flashnet review.

`refunded` means every payment to the quote has a confirmed refund to `refundAddress`, as of `fundingDetails.refundLastVerifiedAt`. Before that the status reads `refunding` or `recovery_required`; a signed refund is not yet a refund.


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