AddressesAddress Types
Base Addresses
Standard Cardano addresses with payment and staking credentials
Base Addresses
Base addresses contain both a payment credential and a staking credential. This is the standard address format on Cardano.
Structure
Base Address = Payment Credential + Staking CredentialPayment Credential: Controls who can spend UTXOs at this address
Staking Credential: Controls delegation and receives staking rewards
Both credentials are typically derived from the same wallet, but can come from different sources (see Franken Addresses).
Construction
Create base addresses by instantiating the BaseAddress class:
import { } from "@evolution-sdk/evolution";
const = new ..({
: 1, // mainnet
: new ..({
: new (28)
}),
: new ..({
: new (28)
})
});
// Convert to Bech32 string
const = ..();
.(); // "addr1..."Parsing Addresses
Parse a Bech32 address string into a BaseAddress instance:
import { } from "@evolution-sdk/evolution";
const = "addr1qx2kd28nq8ac5prwg32hhvudlwggpgfp8utlyqxu6wqgz62f79qsdmm5dsknt9ecr5w468r9ey0fxwkdrwh08ly3tu9sy0f4qd";
const = ..() as ..;
.("Network ID:", .);
.("Payment:", .);
.("Stake:", .);Script-Based Addresses
Base addresses can use script hashes for payment and/or staking credentials:
import { } from "@evolution-sdk/evolution";
// Address with script credentials
const = new ..({
: 1, // mainnet
: new ..({
: new (28) // 28-byte payment script hash
}),
: new ..({
: new (28) // 28-byte stake script hash
})
});
const = ..();
.("Script-based address:", );Address Components
Payment Credential
- Purpose: Spending authorization
- Type: Key hash (28 bytes) or script hash (28 bytes)
- Usage: Required to sign spending transactions
Staking Credential
- Purpose: Delegation and rewards
- Type: Key hash (28 bytes) or script hash (28 bytes)
- Usage: Required to delegate stake or withdraw rewards
Format Details
Bech32 Prefix: addr (mainnet) or addr_test (testnet)
Size: 57 bytes on-chain
Related
- Enterprise Addresses - Payment credential only
- Reward Addresses - Staking credential only
- Franken Addresses - Addresses with credentials from different sources