Back to .md Directory

BIP Compliance Matrix

Maps a BIP specification to its Rust implementation, listing compliance status, deviations, and test coverage for three conformance levels.

May 2, 2026
0 downloads
0 views
ai rag
View source

What this file does

Maps a BIP specification to its Rust implementation, listing compliance status, deviations, and test coverage for three conformance levels.

When to use it

  • Auditing whether a Paykit implementation matches its BIP spec
  • Tracking compliance gaps before a release
  • Documenting deviations for cross-implementation interoperability
  • Planning automated test vector verification

Assumes this stack

Rustpubky-noisepostcarded25519-dalekx25519-dalekChaCha20-Poly1305

BIP Compliance Matrix

This document maps the Paykit BIP specification to the implementation, identifying compliance status and any deviations.

Overview

BIP: Paykit - Payment Method Discovery and Negotiation Protocol
Status: Draft
Implementation Version: 0.2.0

Conformance Levels

The BIP defines three conformance levels:

LevelNameStatusNotes
1Directory Protocol✅ RequiredFully implemented
2Interactive Protocol✅ OptionalFully implemented
3Subscription Protocol✅ OptionalFully implemented

Core Method Compliance

Core Methods (MUST support for Level 1):

MethodStatusLocationNotes
onchainpaykit-lib/src/methods/onchain.rsBIP21-compatible
lightningpaykit-lib/src/methods/lightning.rsBOLT11 + LNURL support

Compliance Status by BIP Section

BIP SectionImplementationStatusNotes
Preamble (BIP3)N/ACompliant headers
AbstractCompleteBitcoin-focused
Conformance LevelsCompleteAll levels implemented
Core ConceptsCompletez-base-32 identity encoding
Directory ProtocolCompletepaykit-lib/src/transport/
Interactive ProtocolCompletepaykit-interactive/
Noise_IK PatternCompleteRequired pattern, in paykit-interactive
Noise_XX Pattern🔸AvailableVia pubky-noise crate; not directly exposed in paykit-interactive
Subscription ProtocolCompletepaykit-subscriptions/
Payment ProofsCompletepaykit-interactive/src/proof/
Backward CompatibilityCompleteBIP21, BOLT11, LNURL
Security ConsiderationsCompleteAll mitigations implemented
Test Vectors🔸Providedbip-paykit/test-vectors.json (no automated verification yet)

Detailed Mapping

Directory Protocol (Level 1)

BIP Section: "Directory Protocol"
Implementation: paykit-lib/src/transport/

FeatureStatusLocation
Path prefix /pub/paykit.app/v0/PAYKIT_PATH_PREFIX constant
Publish endpointsHomeserverSessionStorage::upsert_payment_endpoint
Discover endpointsHomeserverPublicStorageRead::fetch_payment_endpoint
List all methodsHomeserverPublicStorageRead::fetch_supported_payments
Contact discoveryHomeserverPublicStorageRead::fetch_known_contacts
Pubky integrationpaykit-lib/src/transport/pubky/
Endpoint rotationpaykit-lib/src/rotation/

Compliance: ✅ Fully compliant

Interactive Protocol (Level 2)

BIP Section: "Interactive Protocol"
Implementation: paykit-interactive/

FeatureStatusLocation
Noise_IK handshake (REQUIRED)PubkyNoiseChannel::connect
Noise_XX handshake (RECOMMENDED)🔸Available via pubky-noise crate
Cipher suite (25519_ChaChaPoly_BLAKE2s)pubky-noise
Length-prefixed framingPubkyNoiseChannel::send/receive
Max message size (1 MB)MAX_MESSAGE_SIZE constant
Max handshake size (64 KB)MAX_HANDSHAKE_SIZE constant
Message typesPaykitNoiseMessage enum
Receipt exchangePaykitReceipt struct
Private endpoint sharingOfferPrivateEndpoint message

Compliance: ✅ Fully compliant (Noise_XX available but not directly wrapped)

Subscription Protocol (Level 3)

BIP Section: "Subscription Protocol"
Implementation: paykit-subscriptions/

FeatureStatusLocation
Subscription agreementSubscription struct
Payment frequencyPaymentFrequency enum
Cryptographic signaturessigning.rs
Domain separation (PAYKIT_SUBSCRIPTION_V2)SUBSCRIPTION_DOMAIN constant
Deterministic serialization (postcard)hash_subscription_canonical
Replay protection (nonce + expiry)Signature struct
Payment requestsPaymentRequest struct
Auto-pay rulespaykit-subscriptions/src/autopay.rs
Spending limitspaykit-subscriptions/src/autopay.rs, storage.rs

Compliance: ✅ Fully compliant

Implementation Note: BIP specifies migration to RFC 8785 JCS planned for v1.0.

Identity Encoding

BIP Section: "PublicKey"
Implementation: paykit-lib/src/lib.rs

FeatureStatusLocation
z-base-32 encodingVia pubky crate
Pubky URI formatpaykit-lib/src/uri.rs
Ed25519 identityVia pubky crate

Compliance: ✅ Fully compliant

Cryptographic Primitives

BIP Section: bip-paykit/crypto.md
Implementation: Via pubky-noise crate

FeatureStatusLocation
Ed25519 (identity)ed25519-dalek
X25519 (key exchange)x25519-dalek
ChaCha20-Poly1305 (Noise AEAD)chacha20poly1305
XChaCha20-Poly1305 (Sealed Blob v2)chacha20poly1305
BLAKE2s (Noise hash)blake2
SHA-256 (signatures)sha2
HKDF-SHA256hkdf

Compliance: ✅ Fully compliant

Payment Proofs

BIP Section: "Payment Proofs"
Implementation: paykit-interactive/src/proof/

FeatureStatusLocation
Proof typesPaymentProof enum
Bitcoin txid proofBitcoinTxidProof
Lightning preimage proofLightningPreimageProof

Compliance: ✅ Fully compliant

URI Parsing

BIP Section: "PublicKey" (URI format)
Implementation: paykit-lib/src/uri.rs

FeatureStatusLocation
Pubky URI (pubky://)PaykitUri::Pubky
Lightning URIPaykitUri::Invoice
Bitcoin URI (BIP21)PaykitUri::Invoice
Payment request URIPaykitUri::PaymentRequest

Compliance: ✅ Fully compliant

Test Coverage

Unit Tests

  • paykit-lib: 84 tests
  • paykit-subscriptions: 82 tests
  • paykit-interactive: 26 tests
  • paykit-mobile: 28 tests

BIP Test Vectors

Test vectors are provided in bip-paykit/test-vectors.json. These vectors are intended for cross-implementation verification but are not yet consumed by an automated test harness in this repository.

Deviations and Notes

1. Serialization Format

BIP Note: Migration to RFC 8785 JCS planned for v1.0
Current: Postcard (deterministic binary)
Rationale: Postcard provides deterministic serialization. JCS migration will improve cross-language interoperability.

2. Noise_XX Pattern

BIP Requirement: Noise_XX RECOMMENDED for first contact
Status: 🔸 Available via pubky-noise crate
Note: paykit-interactive currently wraps Noise_IK only. Noise_XX is available in the underlying pubky-noise crate but not directly exposed via PubkyNoiseChannel.

3. File-based Storage Encryption

BIP Requirement: Encrypted file storage for private endpoints
Status: 🚧 Placeholder implemented
Rationale: Platform-specific storage (iOS Keychain, Android EncryptedSharedPreferences) is recommended.

4. Test Vector Verification

Status: 🚧 Not yet automated
Note: Test vectors in bip-paykit/test-vectors.json are provided for manual and cross-implementation verification. Automated verification tests are planned.

Implementation Completeness

AreaCompleteness
Level 1: Directory100% ✅
Level 2: Interactive100% ✅
Level 3: Subscriptions100% ✅
Crypto Primitives100% ✅
Test VectorsProvided 🔸
Mobile FFI95% 🚧

Conclusion

The Paykit implementation is fully compliant with all three conformance levels defined in the BIP specification:

  • Level 1 (Directory): ✅ Complete
  • Level 2 (Interactive): ✅ Complete
  • Level 3 (Subscriptions): ✅ Complete

Noise_XX is available via the underlying pubky-noise crate but not directly wrapped in paykit-interactive. Test vectors are provided but not yet verified by automated tests.

What's inside

12 compliance tables, 4 deviation notes, 1 test coverage summary, 1 completeness table

Change this for your project

  • Replace paykit-lib with your own crate name
  • Replace bip-paykit/test-vectors.json with your test vector path
  • Replace PAYKIT_PATH_PREFIX with your own path constant

Where it goes

Keep it in your repository where the agent or team that needs it will read it.

Worth borrowing

  • Conformance level table with required/optional status per level
  • Feature-by-feature mapping from spec section to source file location

Related Documents