Skip to main content

Crate zinc_core

Crate zinc_core 

Source
Expand description

Zinc Core - Bitcoin + Ordinals wallet engine.

zinc-core provides reusable wallet primitives for native Rust and WASM hosts: mnemonic handling, descriptor-backed account management, sync helpers, transaction signing, and Ordinal Shield PSBT analysis.

Quick start:

use zinc_core::{Network, WalletBuilder, ZincMnemonic};

let mnemonic = ZincMnemonic::parse(
    "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",
)
.expect("valid mnemonic");
let mut wallet = WalletBuilder::from_mnemonic(Network::Regtest, &mnemonic)
    .build()
    .expect("wallet");
let _address = wallet.next_taproot_address().expect("address");

Additional examples are available in examples/: wallet_setup, sync_and_balance, and psbt_sign_audit.

Re-exports§

pub use builder::Account;
pub use builder::AddressScheme;
pub use builder::CreatePsbtRequest;
pub use builder::CreatePsbtTransportRequest;
pub use builder::DerivationMode;
pub use builder::DiscoveryAccountPlan;
pub use builder::DiscoveryContext;
pub use builder::PaymentAddressType;
pub use builder::ProfileMode;
pub use builder::ScanPolicy;
pub use builder::Seed64;
pub use builder::SignOptions;
pub use builder::SyncRequestType;
pub use builder::SyncSleeper;
pub use builder::WalletBuilder;
pub use builder::WalletKind;
pub use builder::ZincBalance;
pub use builder::ZincPersistence;
pub use builder::ZincSyncRequest;
pub use builder::ZincWallet;
pub use error::ZincError;
pub use error::ZincResult;
pub use history::TxItem;
pub use keys::taproot_descriptors;
pub use keys::DescriptorPair;
pub use keys::ZincMnemonic;
pub use listing::create_listing;
pub use listing::create_listing_purchase;
pub use listing::finalize_listing_purchase;
pub use listing::finalize_listing_sale;
pub use listing::passthrough_script_pubkey;
pub use listing::passthrough_tapscript;
pub use listing::prepare_listing_sale_signature;
pub use listing::sign_listing_coordinator_psbt;
pub use listing::sign_listing_sale_psbt;
pub use listing::CreateListingPurchaseRequest;
pub use listing::CreateListingPurchaseResultV1;
pub use listing::CreateListingRequest;
pub use listing::CreateListingResultV1;
pub use listing::FinalizeListingPurchaseRequest;
pub use listing::FinalizeListingPurchaseResultV1;
pub use listing::FinalizedListingSaleResultV1;
pub use listing::ListingBuyerFundingInput;
pub use listing::ListingEnvelopeV1;
pub use listing::ListingSaleSigningPlanV1;
pub use listing::LISTING_SALE_SIGHASH_U8;
pub use listing_nostr::NostrListingEvent;
pub use listing_nostr::LISTING_EVENT_KIND;
pub use listing_relay::ListingRelayPublishResult;
pub use listing_relay::ListingRelayQueryOptions;
pub use listing_relay::NostrListingRelayClient;
pub use offer::OfferEnvelopeV1;
pub use offer_accept::prepare_offer_acceptance;
pub use offer_accept::OfferAcceptancePlanV1;
pub use offer_create::CreateOfferRequest;
pub use offer_create::OfferCreateResultV1;
pub use offer_nostr::NostrOfferEvent;
pub use offer_nostr::OFFER_EVENT_KIND;
pub use offer_relay::NostrRelayClient;
pub use offer_relay::RelayPublishResult;
pub use offer_relay::RelayQueryOptions;
pub use ordinals::client::OrdClient;
pub use ordinals::types::Inscription;
pub use ordinals::types::RuneBalance;
pub use ordinals::types::Satpoint;
pub use sign_intent::build_pairing_transport_event;
pub use sign_intent::build_signed_pairing_ack;
pub use sign_intent::build_signed_pairing_ack_with_granted;
pub use sign_intent::build_signed_pairing_complete_receipt;
pub use sign_intent::build_signed_sign_intent_approved_receipt;
pub use sign_intent::build_signed_sign_intent_rejection_receipt;
pub use sign_intent::decode_pairing_ack_envelope_event;
pub use sign_intent::decode_pairing_ack_envelope_event_with_secret;
pub use sign_intent::decode_pairing_transport_event_content_with_secret;
pub use sign_intent::decode_signed_pairing_complete_receipt_event;
pub use sign_intent::decode_signed_pairing_complete_receipt_event_with_secret;
pub use sign_intent::decode_signed_sign_intent_event;
pub use sign_intent::decode_signed_sign_intent_event_with_secret;
pub use sign_intent::decode_signed_sign_intent_receipt_event;
pub use sign_intent::decode_signed_sign_intent_receipt_event_with_secret;
pub use sign_intent::decrypt_pairing_transport_content;
pub use sign_intent::encrypt_pairing_transport_content;
pub use sign_intent::generate_secret_key_hex;
pub use sign_intent::pairing_tag_hash_hex;
pub use sign_intent::pairing_transport_tags;
pub use sign_intent::pubkey_hex_from_secret_key;
pub use sign_intent::verify_pairing_approval;
pub use sign_intent::verify_sign_seller_input_scope;
pub use sign_intent::verify_sign_seller_input_scope_json;
pub use sign_intent::BuildBuyerOfferIntentV1;
pub use sign_intent::CapabilityPolicyV1;
pub use sign_intent::NostrTransportEventV1;
pub use sign_intent::PairingAckDecisionV1;
pub use sign_intent::PairingAckEnvelopeV1;
pub use sign_intent::PairingAckV1;
pub use sign_intent::PairingCompleteReceiptStatusV1;
pub use sign_intent::PairingCompleteReceiptV1;
pub use sign_intent::PairingLinkApprovalV1;
pub use sign_intent::PairingRequestV1;
pub use sign_intent::SignIntentActionV1;
pub use sign_intent::SignIntentPayloadV1;
pub use sign_intent::SignIntentReceiptStatusV1;
pub use sign_intent::SignIntentReceiptV1;
pub use sign_intent::SignIntentV1;
pub use sign_intent::SignSellerInputIntentV1;
pub use sign_intent::SignSellerInputScopeV1;
pub use sign_intent::SignedPairingAckV1;
pub use sign_intent::SignedPairingCompleteReceiptV1;
pub use sign_intent::SignedPairingRequestV1;
pub use sign_intent::SignedSignIntentReceiptV1;
pub use sign_intent::SignedSignIntentV1;
pub use sign_intent::NOSTR_PAIRING_ACK_TYPE_TAG_VALUE;
pub use sign_intent::NOSTR_PAIRING_COMPLETE_RECEIPT_TYPE_TAG_VALUE;
pub use sign_intent::NOSTR_SIGN_INTENT_APP_TAG_VALUE;
pub use sign_intent::NOSTR_SIGN_INTENT_RECEIPT_TYPE_TAG_VALUE;
pub use sign_intent::NOSTR_SIGN_INTENT_TYPE_TAG_VALUE;
pub use sign_intent::NOSTR_TAG_APP_KEY;
pub use sign_intent::NOSTR_TAG_PAIRING_HASH_KEY;
pub use sign_intent::NOSTR_TAG_RECIPIENT_PUBKEY_KEY;
pub use sign_intent::NOSTR_TAG_TYPE_KEY;
pub use sign_intent::PAIRING_TRANSPORT_EVENT_KIND;

Modules§

builder
Core wallet construction and stateful operations.
crypto
Encryption module for wallet seed protection
error
Unified error types for Zinc wallet
history
Transaction history models and wallet history helpers.
keys
Keys module for mnemonic and descriptor handling
listing
Fixed-price listing and sale PSBT validation helpers. Fixed-price listing primitives inspired by ord.net passthrough sale PSBTs.
listing_nostr
Nostr event models and signing/verification helpers for decentralized listings. Nostr event primitives for decentralized fixed-price listing publication and discovery.
listing_relay
Native Nostr relay publish/discovery transport for listing events. Nostr relay transport helpers for decentralized listing publication/discovery.
offer
Offer envelope models and deterministic offer hashing/signature helpers. Offer envelope primitives for decentralized offer publishing and discovery.
offer_accept
Offer acceptance safety checks and signing plan derivation. Offer acceptance validation helpers.
offer_create
Offer creation helpers for ord-compatible buyer offers. Offer creation helpers aligned with ord-style offer PSBT construction.
offer_nostr
Nostr event models and signing/verification helpers for decentralized offers. Nostr event primitives for decentralized offer publication and discovery.
offer_relay
Native Nostr relay publish/discovery transport for offer events. Nostr relay transport helpers for decentralized offer publication/discovery.
ordinals
Ordinals data models, HTTP client, and protection analysis. Ordinals integration primitives for zinc-core.
sign_intent
Signed pairing + sign-intent protocol primitives. Signed pairing and intent protocol primitives for decentralized agent approval flows.

Structs§

AccountDiscoveryReport
CreateListingTransportRequest
DecryptResponse
WASM response payload for mnemonic decryption.
InscriptionPreview
ListingEnvelopeTransportRequest
ZincWasmWallet
WASM-safe stateful wallet handle wrapping the core ZincWallet.

Enums§

Network
The cryptocurrency network to act on.

Functions§

create_listing_js
decrypt_secret
Decrypt encrypted secret material and return plaintext UTF-8.
decrypt_wallet
Decrypt an encrypted wallet blob.
derive_address
Derive a Taproot address from a mnemonic.
encrypt_secret
Encrypt arbitrary secret material with a password.
encrypt_wallet
Encrypt a mnemonic with a password.
finalize_listing_sale_js
generate_wallet
Generate a new wallet with a random mnemonic.
get_log_level
Get current runtime log level.
init
Initialize WASM module (call once on load).
prepare_listing_sale_signature_js
set_log_level
Set runtime log level for zinc-core internals.
set_logging_enabled
Enable or disable zinc-core logging at runtime.
sign_listing_coordinator_psbt_js
sign_listing_sale_psbt_js
validate_mnemonic
Validate a mnemonic phrase.
validate_nostr_transport_event_json
Validate and verify a signed Nostr transport event payload.
validate_pairing_ack_envelope_json
Validate and verify a pairing ack transport envelope payload.
validate_signed_pairing_ack_json
Validate and verify a signed pairing ack payload.
validate_signed_pairing_complete_receipt_json
Validate and verify a signed pairing-complete receipt payload.
validate_signed_pairing_request_json
Validate and verify a signed pairing request payload.
validate_signed_sign_intent_json
Validate and verify a signed sign-intent payload.
validate_signed_sign_intent_receipt_json
Validate and verify a signed sign-intent receipt payload.
verify_pairing_approval_json
Verify a signed pairing request + signed pairing ack bundle at a given unix timestamp.