Expand description
Encode and decode Cardano addresses of every kind.
Byron, Shelley payment, and stake addresses are all parsed through the same
Address entry point: feed it a bech32 / base58 / hex string (or raw
bytes), match on the variant, and inspect the network, payment credential,
delegation, or pointer parts. Address shape follows
CIP-19.
§Usage
use pallas_addresses::Address;
let addr = Address::from_bech32(
"addr1qx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzer3\
n0d3vllmyqwsx5wktcd8cc3sq835lu7drv2xwl2wywfgse35a3x",
)?;
match addr {
Address::Byron(b) => println!("byron: {}", b.to_base58()),
Address::Shelley(s) => println!("shelley: {} on {:?}", s.to_bech32()?, s.network()),
Address::Stake(s) => println!("stake: {}", s.to_bech32()?),
}§Overview
Address— top-level decoded form, dispatching to the three variants.ByronAddress,ShelleyAddress,StakeAddress— per-kind decoded representations.ShelleyPaymentPart,ShelleyDelegationPart,StakePayload,Pointer— the structural pieces that make up a Shelley / stake address.Network— Mainnet / Testnet /Other(u8)discriminator parsed from the address header.byronsubmodule — Byron-specific structures and CBOR helpers.varuintsubmodule — variable-length integer codec used by stake pointers.
§Usage as part of pallas
When depending on the umbrella pallas crate, this crate is re-exported
as pallas::ledger::addresses.
Re-exports§
pub use byron::ByronAddress;
Modules§
- byron
- Byron-era addresses (base58, CBOR-encoded).
- varuint
- Variable-length unsigned integer codec used inside Shelley pointer addresses. Decode / encode variable-length uints
Structs§
- Pointer
- An on-chain pointer to a stake key
- Shelley
Address - A decoded Shelley address.
- Stake
Address - A decoded stake address.
Enums§
- Address
- A decoded Cardano address of any type.
- Error
- Errors produced while decoding or encoding a Cardano address.
- Network
- The network tag of an address.
- Shelley
Delegation Part - The delegation part of a Shelley address.
- Shelley
Payment Part - The payment part of a Shelley address.
- Stake
Payload - The payload of a stake address.
Type Aliases§
- CertIdx
- Index of a certificate within a transaction.
- Payment
KeyHash - Hash of a payment verification key (Blake2b-224).
- Script
Hash - Hash of a script (Blake2b-224).
- Slot
- Absolute slot number on the Cardano chain.
- Stake
KeyHash - Hash of a stake verification key (Blake2b-224).
- TxIdx
- Index of a transaction within a block.