Sigil documentation
ReferenceRust referencesigil-core

sigil-core · username

Source declarations, signatures and documentation for username.

Source: sigil/node/sigil-core/src/username.rs. SHA-256: 4eca3b9cc5d5053b105d7df8f518f077856eeffe91e6b604dddb8b726f4fab60.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

username::USERNAME_MAX_LEN

Maximum length of a username.

pub const USERNAME_MAX_LEN: usize;

Source line: 19.

username::USERNAME_MIN_LEN

Minimum length of a username (charset rejects shorter strings entirely).

pub const USERNAME_MIN_LEN: usize;

Source line: 22.

username::RESERVED_GENESIS_USERNAMES

Reserved short genesis handles assigned by the signed recipient manifest.

These names remain invalid for ordinary public registration; they can only appear in genesis/import paths that explicitly call validate_genesis_username.

pub const RESERVED_GENESIS_USERNAMES: &[&str];

Source line: 27.

username::USERNAME_MAX_LEASE_YEARS

Maximum lease duration (years) at registration / renewal.

pub const USERNAME_MAX_LEASE_YEARS: u32;

Source line: 30.

username::DEFAULT_PRICE_3_CHAR

Default per-tier annual lease price (in MINT for mainnet, BITS for canary).

Governance can adjust the global multiplier (price_multiplier_bps); see UsernameParams::price_multiplier_bps.

pub const DEFAULT_PRICE_3_CHAR: u128;

Source line: 36.

username::DEFAULT_PRICE_4_CHAR

pub const DEFAULT_PRICE_4_CHAR: u128;

Source line: 37.

username::DEFAULT_PRICE_5_CHAR

pub const DEFAULT_PRICE_5_CHAR: u128;

Source line: 38.

username::DEFAULT_PRICE_6_PLUS_CHAR

pub const DEFAULT_PRICE_6_PLUS_CHAR: u128;

Source line: 39.

username::UsernameRecord

On-chain record for a registered username.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct UsernameRecord {
/// Canonical (lowercased, ASCII-validated) username.

pub name: String,
/// DID of the current owner.

pub owner_did: String,
/// Block height at registration.

pub registered_at_height: u64,
/// Block height at which the lease expires.

pub expires_at_height: u64,
/// Optional content hash of off-chain metadata (avatar, profile).

pub metadata_cid: Option<SigilHash>,
/// Set if this name is in the genesis-pinned reserved list.

pub is_reserved: bool,
/// Set while a `RaiseUsernameDispute` is pending resolution.

pub is_disputed: bool
}

Source line: 43.

username::ReverseUsernameRecord

Reverse-lookup index entry: DID -> primary username.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ReverseUsernameRecord {
pub did: String,
pub primary: String
}

Source line: 62.

username::UsernameParams

Genesis-time username system parameters.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct UsernameParams {
/// Whether the username feature is enabled at genesis.

pub enabled: bool,
/// Approximate blocks per year (used for lease term computation).

pub blocks_per_year: u64,
/// Per-length-tier annual lease price in base units.

pub price_3_char: u128,
pub price_4_char: u128,
pub price_5_char: u128,
pub price_6_plus_char: u128,
/// Global price multiplier in basis points (10000 = 1.0x).

/// Governance-adjustable with a 90-day timelock.

pub price_multiplier_bps: u32,
/// Maximum lease duration in years.

pub max_lease_years: u32,
/// Reserved list (cannot be registered without governance).

pub reserved: Vec<String>,
/// DID of the dispute-resolver multisig.

pub dispute_multisig_did: String,
/// DID of the appellate dispute multisig.

pub appeal_multisig_did: String,
/// Filing fee for raising a dispute (in base units).

pub dispute_filing_fee: u128,
/// Filing fee for appealing a dispute (in base units).

pub dispute_appeal_fee: u128,
/// Members of the primary dispute multisig (DID + Ed25519 pubkey).

/// Empty list disables dispute resolution (fail-closed).

#[serde(default)]
pub dispute_multisig_signers: Vec<DisputeSignerEntry>,
/// Number of valid signatures required to resolve a dispute.

/// `dispute_multisig_signers.len() >= dispute_multisig_threshold` MUST

/// hold for genesis to be valid.

#[serde(default)]
pub dispute_multisig_threshold: u32
}

Source line: 69.

username::DisputeSignerEntry

One member of the dispute multisig.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct DisputeSignerEntry {
pub signer_did: String,
/// 32-byte Ed25519 public key, hex-encoded (no `0x` prefix).

pub public_key_hex: String
}

Source line: 107.

username::validate_username

Validate a username against the v1 charset and length rules.

Returns Ok(canonicalized) (lowercased copy) if valid, or an error.

pub fn validate_username(input: &str) -> Result<String, CoreError>;

Source line: 138.

username::validate_genesis_username

Validate a username for a signed genesis/import bundle.

Ordinary registration still uses validate_username and rejects names shorter than USERNAME_MIN_LEN. This function admits only the explicit launch-reserved exceptions from RESERVED_GENESIS_USERNAMES.

pub fn validate_genesis_username(input: &str) -> Result<String, CoreError>;

Source line: 165.

username::compute_lease_price

Compute the lease price in base units for a given username and number of years.

Returns an error if the username is invalid or the year count is out of range. Multiplies the per-year tier price by years, then by price_multiplier_bps / 10000. Saturates on overflow (the chain will not silently roll over).

pub fn compute_lease_price(
    canonical_name: &str,
    years: u32,
    params: &UsernameParams,
) -> Result<u128, CoreError>;

Source line: 186.

username::RegisterUsernameData

Register a new username for years years.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct RegisterUsernameData {
/// Username (will be canonicalized at executor time).

pub name: String,
/// DID of the new owner.

pub owner_did: String,
/// Number of years to prepay (1..=`max_lease_years`).

pub years: u32,
/// Optional metadata content hash to set at registration.

pub metadata_cid: Option<SigilHash>
}

Source line: 220.

username::TransferUsernameData

Transfer ownership of a username to a new DID.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct TransferUsernameData {
pub name: String,
pub new_owner_did: String
}

Source line: 233.

username::ReleaseUsernameData

Release a username (current owner gives it up before lease expiry, or anyone after expiry for non-reserved names).

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ReleaseUsernameData {
pub name: String
}

Source line: 241.

username::SetUsernameMetadataData

Set or clear the off-chain metadata content hash for a username.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct SetUsernameMetadataData {
pub name: String,
pub metadata_cid: Option<SigilHash>
}

Source line: 247.

username::SetReverseUsernameData

Designate which of an owner's usernames is the primary reverse-lookup target.

A DID may own many usernames; only one is "primary" for sigil_lookupUsername(did).

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct SetReverseUsernameData {
pub did: String,
pub primary: String
}

Source line: 256.

username::AuctionStatus

Status of a UsernameAuction.

#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum AuctionStatus {
    /// Bidding is still open. The auction will close after
    /// `auction_anti_snipe_blocks` of silence past `closes_at_height`.
    Open,
    /// A winner has been determined; escrow has been settled and the
    /// username has been registered to the winning bidder.
    Settled,
}

Source line: 274.

username::UsernameAuction

On-chain record for a single premium-name auction.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct UsernameAuction {
/// Canonical name being auctioned (lower-cased ASCII).

pub name: String,
/// Block at which bidding opened.

pub opened_at_height: u64,
/// Earliest block at which the auction may finalize. Pushed forward by

/// `auction_anti_snipe_blocks` whenever a new bid lands within the

/// anti-snipe window.

pub closes_at_height: u64,
/// Current high bid in base units (None if no bid yet).

pub current_bid: Option<u128>,
/// DID of the current high bidder (None if no bid yet).

pub current_bidder: Option<String>,
/// Total number of bids received. Used for the per-DID anti-collusion

/// cap and for explorer display.

pub bid_count: u64,
/// Status (`Open` or `Settled`).

pub status: AuctionStatus
}

Source line: 285.

username::UsernameAuction::open

Open a new auction. Caller is responsible for charset validation.

pub fn open(name: String, opened_at_height: u64, closes_at_height: u64) -> Self;

Source line: 307.

username::UsernameAuction::finalizable_at

True if the auction can be finalized at current_height. Auctions finalize when:

  • status is still Open, AND
  • current_height >= closes_at_height, AND
  • at least one bid has been recorded.
pub fn finalizable_at(&self, current_height: u64) -> bool;

Source line: 324.

username::UsernameAuctionBidData

Submit a bid against an open auction.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct UsernameAuctionBidData {
/// Username being bid on (canonical lowercase).

pub name: String,
/// Bidder DID.

pub bidder_did: String,
/// Bid amount in base units (must be ≥ `current_bid + min_increment`,

/// or ≥ opening price if no current bid).

pub bid_amount: u128
}

Source line: 333.

username::UsernameAuctionFinalizeData

Finalize an auction whose anti-snipe window has elapsed.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct UsernameAuctionFinalizeData {
pub name: String
}

Source line: 345.

username::DisputeStatus

Status of a UsernameDispute.

#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum DisputeStatus {
    /// A dispute has been filed; the username is locked from transfer.
    Filed,
    /// The multisig has resolved the dispute; outcome was applied.
    Resolved,
}

Source line: 362.

username::DisputeOutcome

Possible outcomes of a username dispute. Mirrors USERNAMES.md §5.4.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum DisputeOutcome {
    /// Transfer the username to `claimant_did` (e.g. legitimate trademark
    /// holder). The original lease is retained; only the owner DID rotates.
    TransferTo { claimant_did: String },
    /// The current owner keeps the name; claimant's filing fee is forfeited
    /// to the treasury.
    RetainCurrent,
    /// The username is released and goes into a 1-year cooldown before it
    /// can be re-registered.
    Forfeit,
}

Source line: 371.

username::UsernameDispute

On-chain record for a single open or resolved dispute.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct UsernameDispute {
/// Unique dispute ID. Composed by the executor as

/// `BLAKE3(name || claimant_did || filed_at_height)` truncated to 16

/// bytes (hex-encoded). Provides a deterministic, collision-resistant

/// reference for cross-tx state lookup.

pub dispute_id: String,
/// Username being disputed (canonical lower-cased).

pub name: String,
/// DID of the party that filed the dispute (the claimant).

pub claimant_did: String,
/// DID of the username's owner at filing time.

pub respondent_did: String,
/// Block height at which the dispute was filed.

pub filed_at_height: u64,
/// Optional content hash of off-chain evidence (filing brief, screenshots,

/// trademark certificate, etc.).

pub evidence_cid: Option<crate::hash::SigilHash>,
/// Filing fee paid by the claimant, escrowed pending resolution.

pub filing_fee: u64,
/// Current status (`Filed` or `Resolved`).

pub status: DisputeStatus,
/// Resolution outcome (set when `status == Resolved`).

pub outcome: Option<DisputeOutcome>
}

Source line: 385.

username::RaiseUsernameDisputeData

Submit a UDRP-style dispute against a registered username.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct RaiseUsernameDisputeData {
/// Username being disputed (canonical lower-case).

pub name: String,
/// DID of the claimant (the party filing the dispute). Must equal the

/// transaction sender DID.

pub claimant_did: String,
/// Optional content hash of the off-chain evidence package.

pub evidence_cid: Option<crate::hash::SigilHash>
}

Source line: 412.

username::DisputeMultisigSignature

One signer's contribution to a multisig resolution. The signature is over BLAKE3(canonical_resolve_message) where the canonical message is dispute_id || serde_json(outcome).

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct DisputeMultisigSignature {
/// DID of the signing multisig member.

pub signer_did: String,
/// Ed25519 public key of the signer (32 bytes, hex).

pub public_key_hex: String,
/// Ed25519 signature over the resolution payload (64 bytes, hex).

pub signature_hex: String
}

Source line: 426.

username::ResolveUsernameDisputeData

Resolve a previously-filed dispute. Permissionless to submit (the gas payer can be anyone), but the executor verifies that the included multisig signatures meet the threshold and originate from genesis-pinned multisig members.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ResolveUsernameDisputeData {
pub dispute_id: String,
pub name: String,
pub outcome: DisputeOutcome,
/// Multisig signatures over the canonical resolution payload.

pub signatures: Vec<DisputeMultisigSignature>
}

Source line: 440.

username::dispute_resolve_signing_bytes

Build the canonical bytes that the multisig signs for a resolve. Mirror the same construction in the executor to keep the verification side honest.

pub fn dispute_resolve_signing_bytes(dispute_id: &str, outcome: &DisputeOutcome) -> Vec<u8>;

Source line: 451.

username::compute_dispute_id

Compute a deterministic dispute ID for a (name, claimant, height) triple.

pub fn compute_dispute_id(name: &str, claimant_did: &str, filed_at_height: u64) -> String;

Source line: 461.

username::compute_auction_opening_price

Compute the opening price for a premium-name auction.

Per the spec, the opening price = tier_price × auction_initial_bid_multiplier.

pub fn compute_auction_opening_price(
    canonical_name: &str,
    params: &UsernameParams,
    auction_initial_bid_multiplier: u32,
) -> Result<u128, CoreError>;

Source line: 477.

username::compute_min_next_bid

Compute the minimum next bid given the current high bid (if any) and the minimum increment percentage in basis points (default 500 = 5%).

pub fn compute_min_next_bid(
    current_bid: Option<u128>,
    opening_price: u128,
    min_increment_bps: u32,
) -> u128;

Source line: 503.

On this page