Skip to main content

Module payment

Module payment 

Source
Expand description

BIP70: Payment Protocol (P2P Variant)

Specification: https://github.com/bitcoin/bips/blob/master/bip-0070.mediawiki

This is a P2P-based variant of BIP70 that addresses security concerns:

  • Uses Bitcoin P2P network instead of HTTP/HTTPS (privacy-preserving)
  • Uses Bitcoin public key signatures instead of X.509 certificates (decentralized)
  • Supports signed refund addresses (prevents refund attacks)
  • Works with TCP, Iroh, and QUIC transports

Core messages:

  • PaymentRequest: Merchant payment details signed with Bitcoin key
  • Payment: Customer payment transaction(s)
  • PaymentACK: Merchant confirmation of payment

Security enhancements:

  • Merchant authentication via Bitcoin public keys (on-chain verifiable)
  • Signed refund addresses prevent refund attacks
  • P2P routing preserves customer privacy (no direct merchant connection)

Structs§

CovenantProof
CTV covenant proof for payment commitment
Payment
Payment - Customer payment transaction(s)
PaymentACK
Payment ACK - Merchant confirmation
PaymentDetails
Payment Details - Core payment information
PaymentOutput
Payment Output - Address and amount
PaymentProtocolClient
BIP70 Payment Protocol client (for making payments via P2P)
PaymentProtocolServer
BIP70 Payment Protocol server (for receiving payments via P2P)
PaymentRequest
Payment Request - Main payment protocol message
SignedRefundAddress
Signed refund address - Pre-authorized refund address with merchant signature
TemplateInput
Template input (CTV format: no scriptSig)
TemplateOutput
Template output
TransactionTemplate
Transaction template for CTV (without scriptSig)

Enums§

Bip70Error
BIP70 Error types
SettlementStatus
Settlement status for payment

Constants§

PAYMENT_PROTOCOL_VERSION
BIP70 Payment Protocol version