Module payjoin::receive

source ·
Expand description

Receive Payjoin

This module contains types and methods used to receive payjoin via BIP78. Usage is pretty simple:

  1. Generate a pj_uri BIP 21 using payjoin::Uri::from_str
  2. Listen for a sender’s request on the pj endpoint
  3. Parse the request using UncheckedProposal::from_request()
  4. Validate the proposal using the check methods to guide you.
  5. Assuming the proposal is valid, augment it into a payjoin with the available try_preserving_privacy and contribute methods
  6. Extract the payjoin PSBT and sign it
  7. Respond to the sender’s http request with the signed PSBT as payload.

The receive feature provides all of the check methods, PSBT data manipulation, coin selection, and transport structures to receive payjoin and handle errors in a privacy preserving way.

Receiving payjoin entails listening to a secure http endpoint for inbound requests. The endpoint is displayed in the pj parameter of a bip 21 request URI.

reference implementation

Modules§

Structs§

  • Typestate to validate that the Original PSBT has no receiver-owned inputs.
  • Typestate to validate that the Original PSBT has no inputs that have been seen before.
  • Typestate to validate that the Original PSBT has no mixed input types.
  • The receiver has not yet identified which outputs belong to the receiver.
  • A mutable checked proposal that the receiver may contribute inputs to to make a payjoin.
  • A mutable checked proposal that the receiver may contribute inputs to to make a payjoin.
  • Error that may occur when the request from sender is malformed.
  • Error that may occur when coin selection fails.
  • The sender’s original PSBT and optional parameters

Enums§

Traits§