Skip to content

Commit 3c79f29

Browse files
committed
docs: update docs
1 parent f4406a0 commit 3c79f29

File tree

2 files changed

+63
-51
lines changed

2 files changed

+63
-51
lines changed

docs/content/docs/devnet/configuration.mdx

Lines changed: 62 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -146,45 +146,94 @@ The calculation produces deterministic UTxOs based on the genesis configuration.
146146

147147
## Protocol Parameters
148148

149-
Protocol parameters control transaction fees, size limits, script execution costs, and staking mechanics. Customize these to test edge cases or simulate different network conditions.
149+
The devnet runs on Conway era and uses three genesis files with distinct parameter sets.
150150

151-
Modify protocol parameters within the genesis configuration:
151+
### Genesis Type Definitions
152+
153+
The devnet package exports these types from `DevnetDefault`:
154+
155+
```typescript twoslash
156+
import type { DevnetDefault } from "@evolution-sdk/devnet";
157+
158+
// Use the exported types
159+
type ShelleyGenesis = DevnetDefault.ShelleyGenesis;
160+
type AlonzoGenesis = DevnetDefault.AlonzoGenesis;
161+
type ConwayGenesis = DevnetDefault.ConwayGenesis;
162+
163+
// ShelleyGenesis.protocolParams contains:
164+
// - minFeeA, minFeeB: Transaction fees
165+
// - maxTxSize, maxBlockBodySize: Size limits
166+
// - keyDeposit, poolDeposit: Stake deposits
167+
// - minUTxOValue: Legacy parameter (unused in Conway)
168+
169+
// AlonzoGenesis contains:
170+
// - lovelacePerUTxOWord: UTxO cost (Conway converts to coinsPerUtxoByte ÷8)
171+
// - executionPrices: Plutus script execution costs
172+
// - maxTxExUnits, maxBlockExUnits: Script execution limits
173+
// - collateralPercentage, maxCollateralInputs: Collateral settings
174+
// - costModels: PlutusV1 and PlutusV2 cost models
175+
176+
// ConwayGenesis contains:
177+
// - poolVotingThresholds, dRepVotingThresholds: Governance voting
178+
// - govActionDeposit, dRepDeposit: Governance deposits
179+
// - minFeeRefScriptCostPerByte: Reference script fees
180+
// - plutusV3CostModel: PlutusV3 cost model
181+
```
182+
183+
### Modifying Parameters
184+
185+
Customize protocol parameters by modifying the appropriate genesis configuration:
152186

153187
```typescript twoslash
154188
import { Devnet, DevnetDefault } from "@evolution-sdk/devnet";
155189
declare const addressHex: string;
156190

157-
const genesisConfig = {
191+
// Shelley genesis: fees and transaction limits
192+
const shelleyConfig: Partial<DevnetDefault.ShelleyGenesis> = {
158193
...DevnetDefault.DEFAULT_SHELLEY_GENESIS,
159194
protocolParams: {
160195
...DevnetDefault.DEFAULT_SHELLEY_GENESIS.protocolParams,
161196
minFeeA: 50, // Transaction fee coefficient (default: 44)
162197
minFeeB: 200000, // Minimum fee constant (default: 155381)
163-
maxTxSize: 32768, // Maximum transaction size in bytes (default: 16384)
164-
coinsPerUTxOByte: "4310" // Ada per UTxO byte (as string)
198+
maxTxSize: 32768 // Maximum transaction size in bytes (default: 16384)
165199
},
166200
initialFunds: {
167201
[addressHex]: 100_000_000_000
168202
}
169203
};
170204

205+
// Alonzo genesis: UTxO costs (Conway runtime uses this)
206+
const alonzoConfig: Partial<DevnetDefault.AlonzoGenesis> = {
207+
...DevnetDefault.DEFAULT_ALONZO_GENESIS,
208+
lovelacePerUTxOWord: 34482 // Conway converts to coinsPerUtxoByte (÷8 = 4310.25)
209+
};
210+
171211
const cluster = await Devnet.Cluster.make({
172212
clusterName: "custom-protocol-devnet",
173213
ports: { node: 3001, submit: 3002 },
174-
shelleyGenesis: genesisConfig
214+
shelleyGenesis: shelleyConfig,
215+
alonzoGenesis: alonzoConfig
175216
});
176217

177218
await Devnet.Cluster.start(cluster);
178219
```
179220

180221
Common protocol parameter customizations:
181222

182-
- **minFeeA / minFeeB**: Control transaction fees. Lower values reduce costs for testing. Higher values test fee edge cases.
183-
- **maxTxSize**: Increase for large transaction testing (multiple inputs/outputs, large datums). Decrease to test size limit errors.
184-
- **maxBlockBodySize**: Control how many transactions fit in a block. Affects throughput testing.
185-
- **coinsPerUTxOByte**: Minimum ADA required per UTxO. Affects multi-output transaction viability.
223+
**ShelleyGenesis.protocolParams:**
224+
- **minFeeA / minFeeB**: Transaction fee coefficient and constant
225+
- **maxTxSize**: Maximum transaction size in bytes
226+
- **maxBlockBodySize**: Maximum block size in bytes
227+
- **keyDeposit / poolDeposit**: Stake credential and pool deposits
228+
229+
**AlonzoGenesis:**
230+
- **lovelacePerUTxOWord**: UTxO cost. Conway runtime converts this to `coinsPerUtxoByte` (÷8). Default 34482 ≈ 4310 lovelace/byte
231+
- **collateralPercentage**: Collateral % for script transactions (default: 150)
232+
- **maxCollateralInputs**: Max collateral inputs (default: 3)
233+
234+
**Important**: The devnet runs Conway era. At runtime, the node uses `coinsPerUtxoByte` (from Alonzo's `lovelacePerUTxOWord`), not Shelley's legacy `minUTxOValue`.
186235

187-
The complete list of parameters is available in the `ShelleyGenesis` type definition. Refer to `DevnetDefault.ts` for all available fields and their defaults.
236+
See the exported types `DevnetDefault.ShelleyGenesis`, `DevnetDefault.AlonzoGenesis`, and `DevnetDefault.ConwayGenesis` for complete definitions.
188237

189238
## Block Timing and Network Behavior
190239

@@ -248,43 +297,6 @@ const genesisConfig = {
248297

249298
Most applications can ignore these parameters and use defaults. Adjust only when testing specific consensus or staking behaviors.
250299

251-
## Network Magic
252-
253-
Network magic identifies the network and prevents cross-network transaction replay. Devnet uses magic `42` by default to distinguish from testnet (1, 2) and mainnet (764824073).
254-
255-
Override network magic if testing network isolation or multi-network scenarios:
256-
257-
```typescript twoslash
258-
import { DevnetDefault } from "@evolution-sdk/devnet";
259-
declare const addressHex: string;
260-
261-
const genesisConfig = {
262-
...DevnetDefault.DEFAULT_SHELLEY_GENESIS,
263-
networkMagic: 12345, // Custom network identifier
264-
initialFunds: {
265-
[addressHex]: 100_000_000_000
266-
}
267-
};
268-
```
269-
270-
Clients must use matching network magic when connecting:
271-
272-
```typescript twoslash
273-
import { createClient } from "@evolution-sdk/evolution";
274-
275-
const client = createClient({
276-
network: 12345, // Must match genesis networkMagic
277-
provider: {
278-
type: "kupmios",
279-
kupoUrl: "http://localhost:1442",
280-
ogmiosUrl: "http://localhost:1337"
281-
},
282-
wallet: { type: "seed", mnemonic: "..." }
283-
});
284-
```
285-
286-
Mismatched network magic causes address format incompatibilities and transaction validation failures.
287-
288300
## Complete Configuration Example
289301

290302
Combining all customization options for a comprehensive devnet:
@@ -446,8 +458,8 @@ With custom genesis configuration, you can now:
446458

447459
**Genesis UTxO not found**: Wait 3-5 seconds after cluster start for full initialization. Query timing matters for fast block configurations.
448460

449-
**Protocol parameter validation**: Some parameter combinations are invalid (e.g., `coinsPerUTxOByte` too low). Check cardano-node logs if startup fails.
461+
**Protocol parameter validation**: Some parameter combinations are invalid (e.g., `lovelacePerUTxOWord` too low in Alonzo genesis). Check cardano-node logs if startup fails.
450462

451-
**Network magic mismatch**: Client network parameter must exactly match genesis `networkMagic`. Addresses won't validate with incorrect magic.
463+
**Client network parameter**: Always use `network: 0` for devnet clients to create testnet-format addresses (addr_test...).
452464

453465
**Excessive funds**: While genesis supports arbitrary amounts, extremely large values may cause numeric overflow in some calculations. Stay under 45B ADA (total supply) per address.

docs/next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3-
import "./out/dev/types/routes.d.ts";
3+
import "./.next/types/routes.d.ts";
44

55
// NOTE: This file should not be edited
66
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

0 commit comments

Comments
 (0)