Zerochord
Reference

Configuration

Every field of a network configuration file, and every environment variable the system reads.

One file per network at config/<network>.json, validated against a Zod schema on load. See Networks and configuration for how the file is found and what loading checks.

Top level

FieldTypeMeaning
network"mainnet" | "preprod" | "preview"Must match the network the file is loaded as.
providersobjectChain access.
assetsarray, at least oneThe asset registry for this network.
venuesarrayEvery venue, enabled or not.
oracleobjectPyth configuration.
settlementobjectThis project's settlement validator deployment.
taggingobjectThe CIP-20 label and project name.
routingobjectRouting parameters.
chainLimitsobjectFallback chain limits, asserted against live values by a test.

providers

FieldTypeMeaning
primary"koios" | "blockfrost"The provider that is built and used.
fallbacksame, or nullBuilt when configured and its credentials are present. Never a silent substitute for the primary.
koios.baseUrlURLFor example https://preprod.koios.rest/api/v1.
koios.bearerTokenEnvstring or nullName of the variable holding an optional bearer token.
blockfrost.baseUrlURLFor example https://cardano-preprod.blockfrost.io/api/v0.
blockfrost.projectIdEnvstringName of the variable holding the project id.
ogmios.urlstring or nullWebsocket URL, or null when none is configured.
kupo.urlstring or nullAs above.

Credentials are never inlined. The configuration holds the name of the environment variable.

assets[]

FieldTypeMeaning
symbolstringUnique per network. Used by --in and --out.
policyId56 hex chars28 byte policy hash, lower case.
assetNameHexhex, up to 64 charsAsset name, lower case hex.
decimalsinteger 0 to 30Base unit exponent.
fingerprintasset1...CIP-14 fingerprint, recomputed and compared on load.
stablecoinbooleanThe product routes this asset as user input or output.
verifiedStablecoinbooleanOnly true with a signed Cardano Token Registry entry.
decimalsSourceenumWhere the decimal count came from.
decimalsEvidenceURL or nullRequired when decimalsSource is issuer-declared.
notestring, optionalFree text recorded with the entry.

decimalsSource

ValueMeaning
token-registryThe signed Cardano Token Registry entry from tokens.cardano.org.
provider-token-registryRegistry metadata a chain provider serves for a network the public host does not cover.
issuer-declaredThe issuer's own published constant. Requires decimalsEvidence.
undeclaredNobody has declared it. decimals must then be 0, so amounts are shown in base units.

Three refinements are enforced by the schema:

  • An issuer-declared entry must record its evidence URL.
  • Only a token-registry entry may be a verified stablecoin.
  • An undeclared entry must carry decimals: 0.

venues[]

FieldTypeMeaning
idstringStable venue identifier, for example danogo-clmm.
displayNamestringShown in the interface and in savings claims.
executionClass"kernel" | "commitment"Must match the adapter's own declaration.
enabledbooleanFalse keeps a venue defined but out of routing here.
poolScriptHash56 hex chars or nullNull means not deployed on this network, and the venue is skipped.
poolScriptAddressbech32 or null
orderScriptHash56 hex chars or nullCommitment class venues only.
orderScriptAddressbech32 or null
poolScriptReftxHash#index or nullPublished reference script, so the transaction does not embed it.
orderScriptReftxHash#index or null
referenceUtxosrecord of txHash#index or nullVenue specific references, for example a protocol config UTxO.
executionFeeLovelacedecimal string or nullExecution or batcher fee.
depositLovelacedecimal string or nullRefundable deposit.
paramsrecordVenue specific values the adapter interprets.

oracle.pyth

FieldTypeMeaning
enabledboolean
withdrawScriptHash56 hex chars or nullPyth's own published withdraw script.
storageAddressbech32 or nullWhere the published price UTxO sits. A different script from the withdraw script.
rewardAddressbech32 stake or nullReward account of the withdraw script.
withdrawScriptReftxHash#index or nullPublished reference script carrying the withdraw script.
websocketUrlstring or null
apiKeyEnvstring or nullName of the variable holding the Lazer access token.
trustedSignerExpirystring or nullRecorded expiry of the deployment's trusted signer.
feedsrecord of feedKeyed by a short name, for example adaUsd.
maxPriceAgeMspositive integerMaximum accepted age of a price update.
deviationThresholdBpspositive integerA quote is refused when a pool price differs by more.

A feed carries id (the Lazer numeric feed id), label, and expectedExponent which is an integer or null.

settlement

FieldTypeMeaning
validatorHash56 hex chars or nullNull until deployed on this network.
addressbech32 or null
referenceScripttxHash#index or null
deploymentTx64 hex chars or nullThe transaction that published the script. The checker proves the script's first on-chain appearance is this transaction.
expirySlotspositive integerHow long a settlement UTxO waits before the refund path opens.

tagging

FieldTypeMeaning
labelpositive integerCIP-20 metadata label. 674 in both shipped configurations.
projectNamenon empty stringEvery tag must have a line starting with this. Immutable once transactions carry it.

routing

FieldTypeMeaning
intermediateAssetsarray of "ada" or symbolAllowed as an intermediate hop, never as user input or output.
maxPathLengthinteger 1 to 4Maximum hops in a candidate path.
maxCandidatePathsinteger 1 to 16Maximum candidate paths carried into the subset enumeration.
defaultSlippageBpsinteger 0 to 10 000Deducted from the expected output to derive the on-chain minimum.
singleClassPreferenceBpsinteger 0 to 10 000A single class route is preferred when its net output is within this many basis points of a mixed route.
dynamicFeePolicy"exclude" | "label"What to do with pools that can change their fee after the quote.

Both shipped configurations use intermediateAssets: ["ada"], maxPathLength: 3, maxCandidatePaths: 8, defaultSlippageBps: 50, singleClassPreferenceBps: 10 and dynamicFeePolicy: "exclude".

chainLimits

maxTxSize, maxTxExMem and maxTxExSteps, all positive integers.

Chain limits are read live from the provider at runtime. These values are the fallback used by budget tests and sizing checks when a live read is not available, and a test asserts them against the live values.

Environment variables

Command line and libraries

VariableRequiredMeaning
CARDANO_SWAP_NETWORKWhen --network is omittedmainnet, preprod or preview. There is no default.
CARDANO_SWAP_CONFIG_DIRNoOverrides where <network>.json files are found.
CARDANO_SWAP_SECRETS_DIRNoOverrides where operator key material lives. Defaults to secrets/ at the repository root.
CARDANO_SWAP_OPERATOR_MNEMONICNoSupplies the operator wallet directly instead of reading the stored file.
KOIOS_BEARER_TOKENNoNamed by providers.koios.bearerTokenEnv. Raises the Koios rate limit.
BLOCKFROST_PROJECT_IDWhen Blockfrost is the providerNamed by providers.blockfrost.projectIdEnv.
PYTH_LAZER_API_KEYFor a direct Lazer subscriptionNamed by oracle.pyth.apiKeyEnv.

requireEnv throws naming the variable when a required one is unset, and never returns an empty string.

Web application

VariableRequiredMeaning
VITE_CARDANO_SWAP_NETWORKYesThe network this deployment reads. Unset throws WebConfigError.
VITE_KOIOS_BEARER_TOKENNoRaises the Koios rate limit.

Anything given to a VITE_ variable is compiled into the browser bundle and is therefore public. For a deployment that needs a raised rate limit without publishing the token, put a proxy in front of the provider and point providers.koios.baseUrl at the proxy.

Test only

These gate live tests that spend or emit transactions. They are read by test files, never by shipped code.

VariableMeaning
CARDANO_SWAP_WEB_SUBMITSet to 1 to let the web live test submit. Otherwise it builds and signs only.
CARDANO_SWAP_HANDOVER_WINDOW_MSOverrides the submit window that test builds with.
CARDANO_SWAP_EMIT_SETTLEMENT_LOCKWrites a signed settlement lock transaction. Never submitted by the test.
CARDANO_SWAP_EMIT_SETTLEMENT_CLAIMAs above, for a claim.
CARDANO_SWAP_EMIT_SETTLEMENT_REFUNDAs above, for a refund.

On this page